@tmlmobilidade/interfaces 20260717.1052.50 → 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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { goDb } from '@tmlmobilidade/go-interfaces-godb';
|
|
2
2
|
import { UserDisplayFields } from '@tmlmobilidade/types';
|
|
3
3
|
const isUserRefKey = (k) => k === 'created_by' || k === 'updated_by';
|
|
4
4
|
const isEligibleId = (v) => typeof v === 'string' && v && v !== 'system';
|
|
@@ -39,7 +39,7 @@ function replaceRefs(input, map) {
|
|
|
39
39
|
async function fetchUsersMap(ids) {
|
|
40
40
|
if (ids.size === 0)
|
|
41
41
|
return new Map();
|
|
42
|
-
const coll = await
|
|
42
|
+
const coll = await goDb.core.users.getCollection();
|
|
43
43
|
// Only fetch UserDisplay fields
|
|
44
44
|
const projection = Object.keys(UserDisplayFields).reduce((acc, field) => {
|
|
45
45
|
acc[field] = 1;
|
|
@@ -14,7 +14,7 @@ declare class FileExportsClass extends MongoCollectionClass<FileExport, CreateFi
|
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* @deprecated This class is deprecated and will be removed in the future.
|
|
17
|
-
* Use `@tmlmobilidade/go-interfaces-
|
|
17
|
+
* Use `@tmlmobilidade/go-interfaces-godb` instead.
|
|
18
18
|
*/
|
|
19
19
|
export declare const fileExports: FileExportsClass;
|
|
20
20
|
export {};
|
|
@@ -42,6 +42,6 @@ class FileExportsClass extends MongoCollectionClass {
|
|
|
42
42
|
/* * */
|
|
43
43
|
/**
|
|
44
44
|
* @deprecated This class is deprecated and will be removed in the future.
|
|
45
|
-
* Use `@tmlmobilidade/go-interfaces-
|
|
45
|
+
* Use `@tmlmobilidade/go-interfaces-godb` instead.
|
|
46
46
|
*/
|
|
47
47
|
export const fileExports = asyncSingletonProxy(FileExportsClass);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* * */
|
|
2
2
|
import { MongoCollectionClass } from '../../common/mongo-collection.js';
|
|
3
3
|
import { getModuleConfig } from '@tmlmobilidade/consts';
|
|
4
|
-
import {
|
|
4
|
+
import { goDb } from '@tmlmobilidade/go-interfaces-godb';
|
|
5
5
|
import { CreateNotificationSchema, UpdateNotificationSchema } from '@tmlmobilidade/types';
|
|
6
6
|
import { asyncSingletonProxy, mergeObjects } from '@tmlmobilidade/utils';
|
|
7
7
|
/* * */
|
|
@@ -22,9 +22,9 @@ class NotificationsClass extends MongoCollectionClass {
|
|
|
22
22
|
}
|
|
23
23
|
async sendNotification(scope, topic, user, id, title, description) {
|
|
24
24
|
// Fetch roles and users that have access to this topic
|
|
25
|
-
const rolesWithTopic = await
|
|
25
|
+
const rolesWithTopic = await goDb.core.roles.findMany({ 'permissions.action': topic });
|
|
26
26
|
const roleIdsWithTopic = rolesWithTopic.map(r => r._id);
|
|
27
|
-
const usersWithTopic = await
|
|
27
|
+
const usersWithTopic = await goDb.core.users.findMany({
|
|
28
28
|
$or: [
|
|
29
29
|
{ 'permissions.action': topic },
|
|
30
30
|
{ role_ids: { $in: roleIdsWithTopic } },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tmlmobilidade/interfaces",
|
|
3
|
-
"version": "20260717.
|
|
3
|
+
"version": "20260717.1316.58",
|
|
4
4
|
"author": {
|
|
5
5
|
"email": "iso@tmlmobilidade.pt",
|
|
6
6
|
"name": "TML-ISO"
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@tmlmobilidade/databases": "*",
|
|
41
41
|
"@tmlmobilidade/dates": "*",
|
|
42
42
|
"@tmlmobilidade/files": "*",
|
|
43
|
-
"@tmlmobilidade/go-interfaces-
|
|
43
|
+
"@tmlmobilidade/go-interfaces-godb": "*",
|
|
44
44
|
"@tmlmobilidade/logger": "*",
|
|
45
45
|
"@tmlmobilidade/mongo": "*",
|
|
46
46
|
"@tmlmobilidade/ssh": "*",
|