@tmlmobilidade/controllers 20260714.2327.46 → 20260716.1615.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* * */
|
|
2
2
|
import { HTTP_STATUS, HttpException } from '@tmlmobilidade/consts';
|
|
3
|
-
import {
|
|
3
|
+
import { goDB } from '@tmlmobilidade/go-interfaces-go-db';
|
|
4
4
|
import { Logger } from '@tmlmobilidade/logger';
|
|
5
5
|
import { PermissionCatalog } from '@tmlmobilidade/types';
|
|
6
6
|
function getAgencyIdsFromPermission(permission) {
|
|
@@ -40,7 +40,7 @@ export class AgenciesSharedController {
|
|
|
40
40
|
}
|
|
41
41
|
const allowAllAgencies = permittedAgencyIds.includes(PermissionCatalog.ALLOW_ALL_FLAG);
|
|
42
42
|
const queryFilters = allowAllAgencies ? {} : { _id: { $in: permittedAgencyIds } };
|
|
43
|
-
const allAgencies = await agencies.findMany(queryFilters, { sort: { _id: 1 } });
|
|
43
|
+
const allAgencies = await goDB.core.agencies.findMany(queryFilters, { sort: { _id: 1 } });
|
|
44
44
|
reply.send({ data: allAgencies, error: null, statusCode: HTTP_STATUS.OK });
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
@@ -69,7 +69,7 @@ export class AgenciesSharedController {
|
|
|
69
69
|
}
|
|
70
70
|
const allowAllAgencies = permittedAgencyIds.includes(PermissionCatalog.ALLOW_ALL_FLAG);
|
|
71
71
|
const queryFilters = allowAllAgencies ? { _id: request.params.id } : { _id: { $eq: request.params.id, $in: permittedAgencyIds } };
|
|
72
|
-
const agencyData = await agencies.findOne(queryFilters);
|
|
72
|
+
const agencyData = await goDB.core.agencies.findOne(queryFilters);
|
|
73
73
|
if (!agencyData) {
|
|
74
74
|
const error = new HttpException(HTTP_STATUS.NOT_FOUND, 'Agency not found');
|
|
75
75
|
Logger.issue({
|