@tmlmobilidade/controllers 20260716.2128.43 → 20260717.1316.58
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-godb';
|
|
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
|
|
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
|
|
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({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tmlmobilidade/controllers",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20260717.1316.58",
|
|
4
4
|
"author": {
|
|
5
5
|
"email": "iso@tmlmobilidade.pt",
|
|
6
6
|
"name": "TML-ISO"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@tmlmobilidade/consts": "*",
|
|
40
40
|
"@tmlmobilidade/fastify": "*",
|
|
41
|
-
"@tmlmobilidade/go-interfaces-
|
|
41
|
+
"@tmlmobilidade/go-interfaces-godb": "*",
|
|
42
42
|
"@tmlmobilidade/interfaces": "*",
|
|
43
43
|
"@tmlmobilidade/logger": "*",
|
|
44
44
|
"@tmlmobilidade/normalizers": "*",
|