@youjunhuang/entity-core 1.0.0
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.
- package/dist/data_access/base/base.repository.d.ts +29 -0
- package/dist/data_access/base/base.repository.d.ts.map +1 -0
- package/dist/data_access/base/base.repository.js +7 -0
- package/dist/data_access/base/base.repository.js.map +1 -0
- package/dist/data_access/base/index.d.ts +4 -0
- package/dist/data_access/base/index.d.ts.map +1 -0
- package/dist/data_access/base/index.js +20 -0
- package/dist/data_access/base/index.js.map +1 -0
- package/dist/data_access/base/mongo-base.repository.d.ts +34 -0
- package/dist/data_access/base/mongo-base.repository.d.ts.map +1 -0
- package/dist/data_access/base/mongo-base.repository.js +229 -0
- package/dist/data_access/base/mongo-base.repository.js.map +1 -0
- package/dist/data_access/base/sql-base.repository.d.ts +20 -0
- package/dist/data_access/base/sql-base.repository.d.ts.map +1 -0
- package/dist/data_access/base/sql-base.repository.js +180 -0
- package/dist/data_access/base/sql-base.repository.js.map +1 -0
- package/dist/data_access/index.d.ts +3 -0
- package/dist/data_access/index.d.ts.map +1 -0
- package/dist/data_access/index.js +20 -0
- package/dist/data_access/index.js.map +1 -0
- package/dist/data_access/mongo/account-mongo.repository.d.ts +14 -0
- package/dist/data_access/mongo/account-mongo.repository.d.ts.map +1 -0
- package/dist/data_access/mongo/account-mongo.repository.js +43 -0
- package/dist/data_access/mongo/account-mongo.repository.js.map +1 -0
- package/dist/data_access/mongo/attachment-mongo.repository.d.ts +139 -0
- package/dist/data_access/mongo/attachment-mongo.repository.d.ts.map +1 -0
- package/dist/data_access/mongo/attachment-mongo.repository.js +355 -0
- package/dist/data_access/mongo/attachment-mongo.repository.js.map +1 -0
- package/dist/data_access/mongo/biometric-cred.repository.d.ts +8 -0
- package/dist/data_access/mongo/biometric-cred.repository.d.ts.map +1 -0
- package/dist/data_access/mongo/biometric-cred.repository.js +32 -0
- package/dist/data_access/mongo/biometric-cred.repository.js.map +1 -0
- package/dist/data_access/mongo/camera-mongo.repository.d.ts +9 -0
- package/dist/data_access/mongo/camera-mongo.repository.d.ts.map +1 -0
- package/dist/data_access/mongo/camera-mongo.repository.js +39 -0
- package/dist/data_access/mongo/camera-mongo.repository.js.map +1 -0
- package/dist/data_access/mongo/camera-recording-mongo.repository.d.ts +9 -0
- package/dist/data_access/mongo/camera-recording-mongo.repository.d.ts.map +1 -0
- package/dist/data_access/mongo/camera-recording-mongo.repository.js +39 -0
- package/dist/data_access/mongo/camera-recording-mongo.repository.js.map +1 -0
- package/dist/data_access/mongo/event-mongo.repository.d.ts +23 -0
- package/dist/data_access/mongo/event-mongo.repository.d.ts.map +1 -0
- package/dist/data_access/mongo/event-mongo.repository.js +175 -0
- package/dist/data_access/mongo/event-mongo.repository.js.map +1 -0
- package/dist/data_access/mongo/event-template-mongo.repository.d.ts +8 -0
- package/dist/data_access/mongo/event-template-mongo.repository.d.ts.map +1 -0
- package/dist/data_access/mongo/event-template-mongo.repository.js +36 -0
- package/dist/data_access/mongo/event-template-mongo.repository.js.map +1 -0
- package/dist/data_access/mongo/event-template-name-mongo.repository.d.ts +19 -0
- package/dist/data_access/mongo/event-template-name-mongo.repository.d.ts.map +1 -0
- package/dist/data_access/mongo/event-template-name-mongo.repository.js +47 -0
- package/dist/data_access/mongo/event-template-name-mongo.repository.js.map +1 -0
- package/dist/data_access/mongo/index.d.ts +17 -0
- package/dist/data_access/mongo/index.d.ts.map +1 -0
- package/dist/data_access/mongo/index.js +33 -0
- package/dist/data_access/mongo/index.js.map +1 -0
- package/dist/data_access/mongo/map-mongo.repository.d.ts +9 -0
- package/dist/data_access/mongo/map-mongo.repository.d.ts.map +1 -0
- package/dist/data_access/mongo/map-mongo.repository.js +46 -0
- package/dist/data_access/mongo/map-mongo.repository.js.map +1 -0
- package/dist/data_access/mongo/password-cred.repository.d.ts +8 -0
- package/dist/data_access/mongo/password-cred.repository.d.ts.map +1 -0
- package/dist/data_access/mongo/password-cred.repository.js +32 -0
- package/dist/data_access/mongo/password-cred.repository.js.map +1 -0
- package/dist/data_access/mongo/permission-mongo.repository.d.ts +8 -0
- package/dist/data_access/mongo/permission-mongo.repository.d.ts.map +1 -0
- package/dist/data_access/mongo/permission-mongo.repository.js +32 -0
- package/dist/data_access/mongo/permission-mongo.repository.js.map +1 -0
- package/dist/data_access/mongo/report.repository.d.ts +12 -0
- package/dist/data_access/mongo/report.repository.d.ts.map +1 -0
- package/dist/data_access/mongo/report.repository.js +52 -0
- package/dist/data_access/mongo/report.repository.js.map +1 -0
- package/dist/data_access/mongo/role-mongo.repository.d.ts +7 -0
- package/dist/data_access/mongo/role-mongo.repository.d.ts.map +1 -0
- package/dist/data_access/mongo/role-mongo.repository.js +35 -0
- package/dist/data_access/mongo/role-mongo.repository.js.map +1 -0
- package/dist/data_access/mongo/third-party-cred.repository.d.ts +8 -0
- package/dist/data_access/mongo/third-party-cred.repository.d.ts.map +1 -0
- package/dist/data_access/mongo/third-party-cred.repository.js +32 -0
- package/dist/data_access/mongo/third-party-cred.repository.js.map +1 -0
- package/dist/data_access/mongo/ui-item-mongo.repository.d.ts +7 -0
- package/dist/data_access/mongo/ui-item-mongo.repository.d.ts.map +1 -0
- package/dist/data_access/mongo/ui-item-mongo.repository.js +35 -0
- package/dist/data_access/mongo/ui-item-mongo.repository.js.map +1 -0
- package/dist/data_access/mongo/user-mongo.repository.d.ts +8 -0
- package/dist/data_access/mongo/user-mongo.repository.d.ts.map +1 -0
- package/dist/data_access/mongo/user-mongo.repository.js +39 -0
- package/dist/data_access/mongo/user-mongo.repository.js.map +1 -0
- package/dist/data_access/sql/index.d.ts +1 -0
- package/dist/data_access/sql/index.d.ts.map +1 -0
- package/dist/data_access/sql/index.js +3 -0
- package/dist/data_access/sql/index.js.map +1 -0
- package/dist/data_access/sql/user-profiles.repository.d.ts +1 -0
- package/dist/data_access/sql/user-profiles.repository.d.ts.map +1 -0
- package/dist/data_access/sql/user-profiles.repository.js +36 -0
- package/dist/data_access/sql/user-profiles.repository.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/models/account.d.ts +27 -0
- package/dist/models/account.d.ts.map +1 -0
- package/dist/models/account.js +3 -0
- package/dist/models/account.js.map +1 -0
- package/dist/models/attachment.d.ts +147 -0
- package/dist/models/attachment.d.ts.map +1 -0
- package/dist/models/attachment.js +25 -0
- package/dist/models/attachment.js.map +1 -0
- package/dist/models/auth-credential.d.ts +46 -0
- package/dist/models/auth-credential.d.ts.map +1 -0
- package/dist/models/auth-credential.js +10 -0
- package/dist/models/auth-credential.js.map +1 -0
- package/dist/models/camera.d.ts +156 -0
- package/dist/models/camera.d.ts.map +1 -0
- package/dist/models/camera.js +34 -0
- package/dist/models/camera.js.map +1 -0
- package/dist/models/chatroom.d.ts +55 -0
- package/dist/models/chatroom.d.ts.map +1 -0
- package/dist/models/chatroom.js +3 -0
- package/dist/models/chatroom.js.map +1 -0
- package/dist/models/device.d.ts +50 -0
- package/dist/models/device.d.ts.map +1 -0
- package/dist/models/device.js +3 -0
- package/dist/models/device.js.map +1 -0
- package/dist/models/event.d.ts +170 -0
- package/dist/models/event.d.ts.map +1 -0
- package/dist/models/event.js +195 -0
- package/dist/models/event.js.map +1 -0
- package/dist/models/index.d.ts +19 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +35 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/inform.d.ts +146 -0
- package/dist/models/inform.d.ts.map +1 -0
- package/dist/models/inform.js +61 -0
- package/dist/models/inform.js.map +1 -0
- package/dist/models/map.d.ts +26 -0
- package/dist/models/map.d.ts.map +1 -0
- package/dist/models/map.js +3 -0
- package/dist/models/map.js.map +1 -0
- package/dist/models/permission.d.ts +83 -0
- package/dist/models/permission.d.ts.map +1 -0
- package/dist/models/permission.js +78 -0
- package/dist/models/permission.js.map +1 -0
- package/dist/models/report.d.ts +167 -0
- package/dist/models/report.d.ts.map +1 -0
- package/dist/models/report.js +61 -0
- package/dist/models/report.js.map +1 -0
- package/dist/models/role.d.ts +84 -0
- package/dist/models/role.d.ts.map +1 -0
- package/dist/models/role.js +25 -0
- package/dist/models/role.js.map +1 -0
- package/dist/models/schedule.d.ts +39 -0
- package/dist/models/schedule.d.ts.map +1 -0
- package/dist/models/schedule.js +3 -0
- package/dist/models/schedule.js.map +1 -0
- package/dist/models/task.d.ts +97 -0
- package/dist/models/task.d.ts.map +1 -0
- package/dist/models/task.js +24 -0
- package/dist/models/task.js.map +1 -0
- package/dist/models/template.d.ts +197 -0
- package/dist/models/template.d.ts.map +1 -0
- package/dist/models/template.js +64 -0
- package/dist/models/template.js.map +1 -0
- package/dist/models/ui-item.d.ts +40 -0
- package/dist/models/ui-item.d.ts.map +1 -0
- package/dist/models/ui-item.js +17 -0
- package/dist/models/ui-item.js.map +1 -0
- package/dist/models/user.d.ts +125 -0
- package/dist/models/user.d.ts.map +1 -0
- package/dist/models/user.js +22 -0
- package/dist/models/user.js.map +1 -0
- package/dist/models/utils.d.ts +28 -0
- package/dist/models/utils.d.ts.map +1 -0
- package/dist/models/utils.js +3 -0
- package/dist/models/utils.js.map +1 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +18 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/mongo/account-mongo.schema.d.ts +27 -0
- package/dist/schemas/mongo/account-mongo.schema.d.ts.map +1 -0
- package/dist/schemas/mongo/account-mongo.schema.js +22 -0
- package/dist/schemas/mongo/account-mongo.schema.js.map +1 -0
- package/dist/schemas/mongo/attachment-mongo.schema.d.ts +134 -0
- package/dist/schemas/mongo/attachment-mongo.schema.d.ts.map +1 -0
- package/dist/schemas/mongo/attachment-mongo.schema.js +182 -0
- package/dist/schemas/mongo/attachment-mongo.schema.js.map +1 -0
- package/dist/schemas/mongo/biometric-cred.schema.d.ts +27 -0
- package/dist/schemas/mongo/biometric-cred.schema.d.ts.map +1 -0
- package/dist/schemas/mongo/biometric-cred.schema.js +24 -0
- package/dist/schemas/mongo/biometric-cred.schema.js.map +1 -0
- package/dist/schemas/mongo/camera-mongo.schema.d.ts +21 -0
- package/dist/schemas/mongo/camera-mongo.schema.d.ts.map +1 -0
- package/dist/schemas/mongo/camera-mongo.schema.js +54 -0
- package/dist/schemas/mongo/camera-mongo.schema.js.map +1 -0
- package/dist/schemas/mongo/camera-recording-mongo.schema.d.ts +21 -0
- package/dist/schemas/mongo/camera-recording-mongo.schema.d.ts.map +1 -0
- package/dist/schemas/mongo/camera-recording-mongo.schema.js +24 -0
- package/dist/schemas/mongo/camera-recording-mongo.schema.js.map +1 -0
- package/dist/schemas/mongo/event-mongo.schema.d.ts +51 -0
- package/dist/schemas/mongo/event-mongo.schema.d.ts.map +1 -0
- package/dist/schemas/mongo/event-mongo.schema.js +63 -0
- package/dist/schemas/mongo/event-mongo.schema.js.map +1 -0
- package/dist/schemas/mongo/event-template-mongo.schema.d.ts +39 -0
- package/dist/schemas/mongo/event-template-mongo.schema.d.ts.map +1 -0
- package/dist/schemas/mongo/event-template-mongo.schema.js +33 -0
- package/dist/schemas/mongo/event-template-mongo.schema.js.map +1 -0
- package/dist/schemas/mongo/index.d.ts +16 -0
- package/dist/schemas/mongo/index.d.ts.map +1 -0
- package/dist/schemas/mongo/index.js +32 -0
- package/dist/schemas/mongo/index.js.map +1 -0
- package/dist/schemas/mongo/map-mongo.schema.d.ts +20 -0
- package/dist/schemas/mongo/map-mongo.schema.d.ts.map +1 -0
- package/dist/schemas/mongo/map-mongo.schema.js +16 -0
- package/dist/schemas/mongo/map-mongo.schema.js.map +1 -0
- package/dist/schemas/mongo/password-cred.schema.d.ts +27 -0
- package/dist/schemas/mongo/password-cred.schema.d.ts.map +1 -0
- package/dist/schemas/mongo/password-cred.schema.js +22 -0
- package/dist/schemas/mongo/password-cred.schema.js.map +1 -0
- package/dist/schemas/mongo/permission-mongo.schema.d.ts +21 -0
- package/dist/schemas/mongo/permission-mongo.schema.d.ts.map +1 -0
- package/dist/schemas/mongo/permission-mongo.schema.js +70 -0
- package/dist/schemas/mongo/permission-mongo.schema.js.map +1 -0
- package/dist/schemas/mongo/report-mongo.schema.d.ts +41 -0
- package/dist/schemas/mongo/report-mongo.schema.d.ts.map +1 -0
- package/dist/schemas/mongo/report-mongo.schema.js +71 -0
- package/dist/schemas/mongo/report-mongo.schema.js.map +1 -0
- package/dist/schemas/mongo/role-mongo.schema.d.ts +22 -0
- package/dist/schemas/mongo/role-mongo.schema.d.ts.map +1 -0
- package/dist/schemas/mongo/role-mongo.schema.js +73 -0
- package/dist/schemas/mongo/role-mongo.schema.js.map +1 -0
- package/dist/schemas/mongo/third-party-cred.schema.d.ts +27 -0
- package/dist/schemas/mongo/third-party-cred.schema.d.ts.map +1 -0
- package/dist/schemas/mongo/third-party-cred.schema.js +30 -0
- package/dist/schemas/mongo/third-party-cred.schema.js.map +1 -0
- package/dist/schemas/mongo/ui-item.schema.d.ts +23 -0
- package/dist/schemas/mongo/ui-item.schema.d.ts.map +1 -0
- package/dist/schemas/mongo/ui-item.schema.js +61 -0
- package/dist/schemas/mongo/ui-item.schema.js.map +1 -0
- package/dist/schemas/mongo/user-mongo.schema.d.ts +24 -0
- package/dist/schemas/mongo/user-mongo.schema.d.ts.map +1 -0
- package/dist/schemas/mongo/user-mongo.schema.js +34 -0
- package/dist/schemas/mongo/user-mongo.schema.js.map +1 -0
- package/package.json +34 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EventDataModel = exports.EventDataSchema = exports.EventModel = exports.EventSchema = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
// 定義 Event 的 Schema
|
|
7
|
+
exports.EventSchema = new mongoose_1.Schema({
|
|
8
|
+
id: { type: String, required: true, immutable: true }, // 使用 UUID 作為 id
|
|
9
|
+
pinned: { type: Boolean, default: false }, // 是否已釘選
|
|
10
|
+
templateId: { type: String, required: true, index: true }, // 關聯樣板
|
|
11
|
+
category: { type: String, required: true, enum: Object.values(models_1.EventCategory), index: true }, // 事件分類
|
|
12
|
+
type: { type: String, required: true, enum: Object.values(models_1.EventType), index: true }, // 事件類型
|
|
13
|
+
subjectType: { type: String, enum: Object.values(models_1.SubjectType), index: true }, // 主體類型
|
|
14
|
+
subjectId: { type: String }, // 主體ID(可為 ObjectId 或 string)
|
|
15
|
+
severity: { type: Number, min: 1, max: 5, default: null, required: false }, // 嚴重度
|
|
16
|
+
// status: { type: String, enum: Object.values(EventStatus), default: EventStatus.Unprocessed }, // 事件狀態
|
|
17
|
+
description: { type: String, default: '' }, // 描述文
|
|
18
|
+
occurredAt: { type: Date, required: true }, // 發生時間
|
|
19
|
+
reId: { type: String, default: null }, // 人臉reId
|
|
20
|
+
snapshotUrl: { type: String, default: null }, // 處理截圖URL
|
|
21
|
+
groupId: { type: String, default: null, index: true }, // 事件群組ID
|
|
22
|
+
}, { collection: 'events', timestamps: true });
|
|
23
|
+
exports.EventSchema.virtual('_template', {
|
|
24
|
+
ref: 'EventTemplate', // 指定 EventTemplate 模型
|
|
25
|
+
localField: 'templateId',
|
|
26
|
+
foreignField: 'id',
|
|
27
|
+
justOne: true,
|
|
28
|
+
});
|
|
29
|
+
// ✅ 用函式 ref 取代 refPath
|
|
30
|
+
exports.EventSchema.virtual('_subject', {
|
|
31
|
+
ref: (doc) => {
|
|
32
|
+
// 依 subjectType 回傳真正的模型名;沒有的就回傳 undefined
|
|
33
|
+
switch (doc.subjectType) {
|
|
34
|
+
case 'Camera': return 'Camera';
|
|
35
|
+
case 'User': return 'UserProfile'; // 沒有模型 → 不 populate
|
|
36
|
+
case 'Entrance': return null; // 沒有模型 → 不 populate
|
|
37
|
+
case 'Device': return null; // 沒有模型 → 不 populate
|
|
38
|
+
default: return null;
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
localField: 'subjectId',
|
|
42
|
+
foreignField: 'id',
|
|
43
|
+
justOne: true,
|
|
44
|
+
});
|
|
45
|
+
// // 創建 Event 模型
|
|
46
|
+
exports.EventModel = (0, mongoose_1.model)('Event', exports.EventSchema);
|
|
47
|
+
// 定義 EventData 的 Schema
|
|
48
|
+
exports.EventDataSchema = new mongoose_1.Schema({
|
|
49
|
+
id: { type: String, required: true, immutable: true }, // 使用 UUID 作為 id
|
|
50
|
+
eventId: { type: String, required: true }, // 關聯事件ID(可為 ObjectId 或 string)
|
|
51
|
+
payload: { type: mongoose_1.Schema.Types.Mixed, required: true }, // 彈性 JSON 資料
|
|
52
|
+
schemaRef: { type: String, default: null }, // 可選的 schema 參考
|
|
53
|
+
version: { type: String, required: true, default: '1.0.0' }, // 版本號
|
|
54
|
+
}, { collection: 'event_data', timestamps: true });
|
|
55
|
+
exports.EventDataSchema.virtual('_event', {
|
|
56
|
+
ref: 'Event', // 指定 Event 模型
|
|
57
|
+
localField: 'eventId',
|
|
58
|
+
foreignField: 'id',
|
|
59
|
+
justOne: true,
|
|
60
|
+
});
|
|
61
|
+
// // 創建 EventData 模型
|
|
62
|
+
exports.EventDataModel = (0, mongoose_1.model)('EventData', exports.EventDataSchema);
|
|
63
|
+
//# sourceMappingURL=event-mongo.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-mongo.schema.js","sourceRoot":"","sources":["../../../schemas/mongo/event-mongo.schema.ts"],"names":[],"mappings":";;;AACA,uCAA0D;AAC1D,yCAAsH;AAgBtH,oBAAoB;AACP,QAAA,WAAW,GAAG,IAAI,iBAAM,CAAgB;IACnD,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,gBAAgB;IACvE,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,QAAQ;IACnD,UAAU,EAAE,EAAE,I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EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,aAAa;IACpE,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,gBAAgB;IAC5D,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,MAAM;CACpE,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;AAEnD,uBAAe,CAAC,OAAO,CAAC,QAAQ,EAAE;IAChC,GAAG,EAAE,OAAO,EAAU,cAAc;IACpC,UAAU,EAAE,SAAS;IACrB,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,IAAI;CACd,CAAC,CAAC;AAGH,qBAAqB;AACR,QAAA,cAAc,GAAG,IAAA,gBAAK,EAAoB,WAAW,EAAE,uBAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Schema, Document, Types } from 'mongoose';
|
|
2
|
+
import { EventTemplate, EventTemplateName } from '../../models';
|
|
3
|
+
export type EventTemplateNameMongoose = Omit<EventTemplateName, 'model'> & {};
|
|
4
|
+
export interface EventTemplateNameDocument extends Document, EventTemplateNameMongoose {
|
|
5
|
+
id: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const EventTemplateNameSchema: Schema<EventTemplateNameDocument, import("mongoose").Model<EventTemplateNameDocument, any, any, any, Document<unknown, any, EventTemplateNameDocument, any, {}> & EventTemplateNameDocument & Required<{
|
|
8
|
+
_id: Types.ObjectId;
|
|
9
|
+
}> & {
|
|
10
|
+
__v: number;
|
|
11
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, EventTemplateNameDocument, Document<unknown, {}, import("mongoose").FlatRecord<EventTemplateNameDocument>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<EventTemplateNameDocument> & Required<{
|
|
12
|
+
_id: Types.ObjectId;
|
|
13
|
+
}> & {
|
|
14
|
+
__v: number;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const EventTemplateNameModel: import("mongoose").Model<EventTemplateNameDocument, {}, {}, {}, Document<unknown, {}, EventTemplateNameDocument, {}, {}> & EventTemplateNameDocument & Required<{
|
|
17
|
+
_id: Types.ObjectId;
|
|
18
|
+
}> & {
|
|
19
|
+
__v: number;
|
|
20
|
+
}, any>;
|
|
21
|
+
export type EventTemplateMongoose = Omit<EventTemplate, 'model'> & {};
|
|
22
|
+
export interface EventTemplateDocument extends Document, EventTemplateMongoose {
|
|
23
|
+
id: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const EventTemplateSchema: Schema<EventTemplateDocument, import("mongoose").Model<EventTemplateDocument, any, any, any, Document<unknown, any, EventTemplateDocument, any, {}> & EventTemplateDocument & Required<{
|
|
26
|
+
_id: Types.ObjectId;
|
|
27
|
+
}> & {
|
|
28
|
+
__v: number;
|
|
29
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, EventTemplateDocument, Document<unknown, {}, import("mongoose").FlatRecord<EventTemplateDocument>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<EventTemplateDocument> & Required<{
|
|
30
|
+
_id: Types.ObjectId;
|
|
31
|
+
}> & {
|
|
32
|
+
__v: number;
|
|
33
|
+
}>;
|
|
34
|
+
export declare const EventTemplateModel: import("mongoose").Model<EventTemplateDocument, {}, {}, {}, Document<unknown, {}, EventTemplateDocument, {}, {}> & EventTemplateDocument & Required<{
|
|
35
|
+
_id: Types.ObjectId;
|
|
36
|
+
}> & {
|
|
37
|
+
__v: number;
|
|
38
|
+
}, any>;
|
|
39
|
+
//# sourceMappingURL=event-template-mongo.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-template-mongo.schema.d.ts","sourceRoot":"","sources":["../../../schemas/mongo/event-template-mongo.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAS,QAAQ,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAA8C,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAK5G,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG,EAE1E,CAAC;AAEF,MAAM,WAAW,yBAA0B,SAAQ,QAAQ,EAAE,yBAAyB;IACpF,EAAE,EAAE,MAAM,CAAC;CACZ;AAGD,eAAO,MAAM,uBAAuB;;;;;;;;EAKZ,CAAC;AAKzB,eAAO,MAAM,sBAAsB;;;;OAAiF,CAAC;AAOrH,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,GAAG,EAElE,CAAC;AAEF,MAAM,WAAW,qBAAsB,SAAQ,QAAQ,EAAE,qBAAqB;IAC5E,EAAE,EAAE,MAAM,CAAC;CACZ;AAGD,eAAO,MAAM,mBAAmB;;;;;;;;EAQR,CAAC;AAUzB,eAAO,MAAM,kBAAkB;;;;OAAqE,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EventTemplateModel = exports.EventTemplateSchema = exports.EventTemplateNameModel = exports.EventTemplateNameSchema = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
// 定義 EventTemplate 的 Schema
|
|
7
|
+
exports.EventTemplateNameSchema = new mongoose_1.Schema({
|
|
8
|
+
id: { type: String, required: true, immutable: true }, // 使用 UUID 作為 id
|
|
9
|
+
code: { type: String, required: true, unique: true }, // 唯一代碼
|
|
10
|
+
displayName: { type: mongoose_1.Schema.Types.Mixed, required: true }, // 顯示名稱
|
|
11
|
+
isActive: { type: Boolean, default: true }, // 是否啟用
|
|
12
|
+
}, { timestamps: true });
|
|
13
|
+
// // 創建 EventTemplate 模型
|
|
14
|
+
exports.EventTemplateNameModel = (0, mongoose_1.model)('EventTemplateName', exports.EventTemplateNameSchema);
|
|
15
|
+
// 定義 EventTemplate 的 Schema
|
|
16
|
+
exports.EventTemplateSchema = new mongoose_1.Schema({
|
|
17
|
+
id: { type: String, required: true, immutable: true }, // 使用 UUID 作為 id
|
|
18
|
+
nameCode: { type: String, required: true }, // 模板名稱
|
|
19
|
+
category: { type: String, required: true, enum: Object.values(models_1.EventCategory) }, // 事件分類
|
|
20
|
+
type: { type: String, required: true, enum: Object.values(models_1.EventType) }, // 事件類型
|
|
21
|
+
severity: { type: Number, required: false, min: 1, max: 5 }, // 事件嚴重程度
|
|
22
|
+
description: { type: String, required: false }, // 模板描述
|
|
23
|
+
isActive: { type: Boolean, default: true }
|
|
24
|
+
}, { timestamps: true });
|
|
25
|
+
exports.EventTemplateSchema.virtual('_eventName', {
|
|
26
|
+
ref: 'EventTemplateName', // 指定 EventTemplate 模型
|
|
27
|
+
localField: 'nameCode',
|
|
28
|
+
foreignField: 'code',
|
|
29
|
+
justOne: true,
|
|
30
|
+
});
|
|
31
|
+
// // 創建 EventTemplate 模型
|
|
32
|
+
exports.EventTemplateModel = (0, mongoose_1.model)('EventTemplate', exports.EventTemplateSchema);
|
|
33
|
+
//# sourceMappingURL=event-template-mongo.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-template-mongo.schema.js","sourceRoot":"","sources":["../../../schemas/mongo/event-template-mongo.schema.ts"],"names":[],"mappings":";;;AAAA,uCAA0D;AAC1D,yCAA4G;AAa5G,4BAA4B;AACf,QAAA,uBAAuB,GAAG,IAAI,iBAAM,CAA4B;IAC3E,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,gBAAgB;IACvE,IAAI,EAAE,EAAE,IAAI,EAAE,MAA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AAO,EAAE,IAAI,EAAE;CAC3C,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;AAEzB,2BAAmB,CAAC,OAAO,CAAC,YAAY,EAAE;IACxC,GAAG,EAAE,mBAAmB,EAAU,sBAAsB;IACxD,UAAU,EAAE,UAAU;IACtB,YAAY,EAAE,MAAM;IACpB,OAAO,EAAE,IAAI;CACd,CAAC,CAAC;AAEH,yBAAyB;AACZ,QAAA,kBAAkB,GAAG,IAAA,gBAAK,EAAwB,eAAe,EAAE,2BAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from './account-mongo.schema';
|
|
2
|
+
export * from './attachment-mongo.schema';
|
|
3
|
+
export * from './biometric-cred.schema';
|
|
4
|
+
export * from './camera-mongo.schema';
|
|
5
|
+
export * from './camera-recording-mongo.schema';
|
|
6
|
+
export * from './event-mongo.schema';
|
|
7
|
+
export * from './event-template-mongo.schema';
|
|
8
|
+
export * from './map-mongo.schema';
|
|
9
|
+
export * from './password-cred.schema';
|
|
10
|
+
export * from './permission-mongo.schema';
|
|
11
|
+
export * from './report-mongo.schema';
|
|
12
|
+
export * from './role-mongo.schema';
|
|
13
|
+
export * from './third-party-cred.schema';
|
|
14
|
+
export * from './ui-item.schema';
|
|
15
|
+
export * from './user-mongo.schema';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schemas/mongo/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iCAAiC,CAAC;AAChD,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./account-mongo.schema"), exports);
|
|
18
|
+
__exportStar(require("./attachment-mongo.schema"), exports);
|
|
19
|
+
__exportStar(require("./biometric-cred.schema"), exports);
|
|
20
|
+
__exportStar(require("./camera-mongo.schema"), exports);
|
|
21
|
+
__exportStar(require("./camera-recording-mongo.schema"), exports);
|
|
22
|
+
__exportStar(require("./event-mongo.schema"), exports);
|
|
23
|
+
__exportStar(require("./event-template-mongo.schema"), exports);
|
|
24
|
+
__exportStar(require("./map-mongo.schema"), exports);
|
|
25
|
+
__exportStar(require("./password-cred.schema"), exports);
|
|
26
|
+
__exportStar(require("./permission-mongo.schema"), exports);
|
|
27
|
+
__exportStar(require("./report-mongo.schema"), exports);
|
|
28
|
+
__exportStar(require("./role-mongo.schema"), exports);
|
|
29
|
+
__exportStar(require("./third-party-cred.schema"), exports);
|
|
30
|
+
__exportStar(require("./ui-item.schema"), exports);
|
|
31
|
+
__exportStar(require("./user-mongo.schema"), exports);
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schemas/mongo/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,4DAA0C;AAC1C,0DAAwC;AACxC,wDAAsC;AACtC,kEAAgD;AAChD,uDAAqC;AACrC,gEAA8C;AAC9C,qDAAmC;AACnC,yDAAuC;AACvC,4DAA0C;AAC1C,wDAAsC;AACtC,sDAAoC;AACpC,4DAA0C;AAC1C,mDAAiC;AACjC,sDAAoC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Schema, Document, Types } from 'mongoose';
|
|
2
|
+
import { Map } from '../../models';
|
|
3
|
+
export interface MapDocument extends Document, Map {
|
|
4
|
+
id: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const MapSchema: Schema<MapDocument, import("mongoose").Model<MapDocument, any, any, any, Document<unknown, any, MapDocument, any, {}> & MapDocument & Required<{
|
|
7
|
+
_id: Types.ObjectId;
|
|
8
|
+
}> & {
|
|
9
|
+
__v: number;
|
|
10
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, MapDocument, Document<unknown, {}, import("mongoose").FlatRecord<MapDocument>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<MapDocument> & Required<{
|
|
11
|
+
_id: Types.ObjectId;
|
|
12
|
+
}> & {
|
|
13
|
+
__v: number;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const MapModel: import("mongoose").Model<MapDocument, {}, {}, {}, Document<unknown, {}, MapDocument, {}, {}> & MapDocument & Required<{
|
|
16
|
+
_id: Types.ObjectId;
|
|
17
|
+
}> & {
|
|
18
|
+
__v: number;
|
|
19
|
+
}, any>;
|
|
20
|
+
//# sourceMappingURL=map-mongo.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-mongo.schema.d.ts","sourceRoot":"","sources":["../../../schemas/mongo/map-mongo.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAS,QAAQ,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,MAAM,WAAW,WAAY,SAAQ,QAAQ,EAAE,GAAG;IAChD,EAAE,EAAE,MAAM,CAAC;CACZ;AAGD,eAAO,MAAM,SAAS;;;;;;;;EAOE,CAAC;AAGzB,eAAO,MAAM,QAAQ;;;;OAAuC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MapModel = exports.MapSchema = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
// 定義 Map 的 Schema
|
|
6
|
+
exports.MapSchema = new mongoose_1.Schema({
|
|
7
|
+
id: { type: String, required: true, immutable: true }, // 使用 UUID 作為 id
|
|
8
|
+
name: { type: String, required: true, index: true }, // 地圖名稱
|
|
9
|
+
imageUrl: { type: String, required: true }, // 地圖圖片的 URL
|
|
10
|
+
width: { type: Number, required: true }, // 圖片長
|
|
11
|
+
height: { type: Number, required: true }, // 圖片寬
|
|
12
|
+
description: { type: String, required: false }, // 對地圖的附加說明
|
|
13
|
+
}, { timestamps: true });
|
|
14
|
+
// // 創建 Map 模型
|
|
15
|
+
exports.MapModel = (0, mongoose_1.model)('Map', exports.MapSchema);
|
|
16
|
+
//# sourceMappingURL=map-mongo.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-mongo.schema.js","sourceRoot":"","sources":["../../../schemas/mongo/map-mongo.schema.ts"],"names":[],"mappings":";;;AAAA,uCAA0D;AAO1D,kBAAkB;AACL,QAAA,SAAS,GAAG,IAAI,iBAAM,CAAc;IAC/C,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,gBAAgB;IACvE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO;IAC5D,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,YAAY;IACxD,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,MAAM;IAC/C,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,MAAM;IAChD,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,WAAW;CAC5D,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;AAEzB,eAAe;AACF,QAAA,QAAQ,GAAG,IAAA,gBAAK,EAAc,KAAK,EAAE,iBAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Schema, Document, Types } from 'mongoose';
|
|
2
|
+
import { PasswordCredential } from '../../models';
|
|
3
|
+
import { UserProfileDocument } from './user-mongo.schema';
|
|
4
|
+
export type PasswordCredentialMongoose = Omit<PasswordCredential, 'userId'> & {
|
|
5
|
+
userId: Types.ObjectId | string | UserProfileDocument;
|
|
6
|
+
_user?: UserProfileDocument;
|
|
7
|
+
};
|
|
8
|
+
export interface PasswordCredentialDocument extends Document, PasswordCredentialMongoose {
|
|
9
|
+
id: string;
|
|
10
|
+
userId: Types.ObjectId | string | UserProfileDocument;
|
|
11
|
+
_user?: UserProfileDocument;
|
|
12
|
+
}
|
|
13
|
+
export declare const PasswordCredentialSchema: Schema<PasswordCredentialDocument, import("mongoose").Model<PasswordCredentialDocument, any, any, any, Document<unknown, any, PasswordCredentialDocument, any, {}> & PasswordCredentialDocument & Required<{
|
|
14
|
+
_id: Types.ObjectId;
|
|
15
|
+
}> & {
|
|
16
|
+
__v: number;
|
|
17
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, PasswordCredentialDocument, Document<unknown, {}, import("mongoose").FlatRecord<PasswordCredentialDocument>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<PasswordCredentialDocument> & Required<{
|
|
18
|
+
_id: Types.ObjectId;
|
|
19
|
+
}> & {
|
|
20
|
+
__v: number;
|
|
21
|
+
}>;
|
|
22
|
+
export declare const PasswordCredentialModel: import("mongoose").Model<PasswordCredentialDocument, {}, {}, {}, Document<unknown, {}, PasswordCredentialDocument, {}, {}> & PasswordCredentialDocument & Required<{
|
|
23
|
+
_id: Types.ObjectId;
|
|
24
|
+
}> & {
|
|
25
|
+
__v: number;
|
|
26
|
+
}, any>;
|
|
27
|
+
//# sourceMappingURL=password-cred.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password-cred.schema.d.ts","sourceRoot":"","sources":["../../../schemas/mongo/password-cred.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAS,QAAQ,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAI1D,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAC,GAAG;IAC5E,MAAM,EAAE,KAAK,CAAC,QAAQ,GAAG,MAAM,GAAG,mBAAmB,CAAC;IACtD,KAAK,CAAC,EAAE,mBAAmB,CAAC;CAC7B,CAAC;AAEF,MAAM,WAAW,0BAA2B,SAAQ,QAAQ,EAAE,0BAA0B;IACtF,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,KAAK,CAAC,QAAQ,GAAG,MAAM,GAAG,mBAAmB,CAAC;IACtD,KAAK,CAAC,EAAE,mBAAmB,CAAC;CAC7B;AAGD,eAAO,MAAM,wBAAwB;;;;;;;;EAUpC,CAAC;AAUF,eAAO,MAAM,uBAAuB;;;;OAAoF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PasswordCredentialModel = exports.PasswordCredentialSchema = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
// 定義 PasswordCredential 的 Schema
|
|
6
|
+
exports.PasswordCredentialSchema = new mongoose_1.Schema({
|
|
7
|
+
id: { type: String, required: true, immutable: true }, // 使用 UUID 作為 id
|
|
8
|
+
userId: { type: String, required: false, index: true }, // 使用者的唯一識別碼
|
|
9
|
+
passwordHash: { type: String, required: true },
|
|
10
|
+
// 密碼的雜湊值
|
|
11
|
+
isActive: { type: Boolean, default: true },
|
|
12
|
+
// 是否啟用此密碼登入
|
|
13
|
+
}, { timestamps: true });
|
|
14
|
+
exports.PasswordCredentialSchema.virtual('_user', {
|
|
15
|
+
ref: 'UserProfile',
|
|
16
|
+
localField: 'userId',
|
|
17
|
+
foreignField: 'id',
|
|
18
|
+
justOne: true,
|
|
19
|
+
});
|
|
20
|
+
// // 創建 PasswordCredential 模型
|
|
21
|
+
exports.PasswordCredentialModel = (0, mongoose_1.model)('PasswordCredential', exports.PasswordCredentialSchema);
|
|
22
|
+
//# sourceMappingURL=password-cred.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password-cred.schema.js","sourceRoot":"","sources":["../../../schemas/mongo/password-cred.schema.ts"],"names":[],"mappings":";;;AAAA,uCAA0D;AAiB1D,iCAAiC;AACpB,QAAA,wBAAwB,GAAG,IAAI,iBAAM,CAChD;IACE,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,gBAAgB;IACvE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,YAAY;IACpE,YAAY,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC9C,SAAS;IACT,QAAQ,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;IAC1C,YAAY;CACb,EACD,EAAE,UAAU,EAAE,IAAI,EAAE,CACrB,CAAC;AAEF,gCAAwB,CAAC,OAAO,CAAC,OAAO,EAAE;IACxC,GAAG,EAAE,aAAa;IAClB,UAAU,EAAE,QAAQ;IACpB,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,IAAI;CACd,CAAC,CAAC;AAEH,8BAA8B;AACjB,QAAA,uBAAuB,GAAG,IAAA,gBAAK,EAA6B,oBAAoB,EAAE,gCAAwB,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Schema, Document, Model } from 'mongoose';
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
import { Permission } from '../../models';
|
|
4
|
+
export interface PermissionDocument extends Document, Permission {
|
|
5
|
+
id: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const PermissionSchema: Schema<PermissionDocument, Model<PermissionDocument, any, any, any, Document<unknown, any, PermissionDocument, any, {}> & PermissionDocument & Required<{
|
|
8
|
+
_id: mongoose.Types.ObjectId;
|
|
9
|
+
}> & {
|
|
10
|
+
__v: number;
|
|
11
|
+
}, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, PermissionDocument, Document<unknown, {}, mongoose.FlatRecord<PermissionDocument>, {}, mongoose.ResolveSchemaOptions<mongoose.DefaultSchemaOptions>> & mongoose.FlatRecord<PermissionDocument> & Required<{
|
|
12
|
+
_id: mongoose.Types.ObjectId;
|
|
13
|
+
}> & {
|
|
14
|
+
__v: number;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const PermissionModel: Model<PermissionDocument, {}, {}, {}, Document<unknown, {}, PermissionDocument, {}, {}> & PermissionDocument & Required<{
|
|
17
|
+
_id: mongoose.Types.ObjectId;
|
|
18
|
+
}> & {
|
|
19
|
+
__v: number;
|
|
20
|
+
}, any>;
|
|
21
|
+
//# sourceMappingURL=permission-mongo.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission-mongo.schema.d.ts","sourceRoot":"","sources":["../../../schemas/mongo/permission-mongo.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,UAAU,EAAsB,MAAM,cAAc,CAAC;AAM9D,MAAM,WAAW,kBAAmB,SAAQ,QAAQ,EAAE,UAAU;IAC9D,EAAE,EAAE,MAAM,CAAC;CACZ;AAGD,eAAO,MAAM,gBAAgB;;;;;;;;EAKL,CAAC;AAkCzB,eAAO,MAAM,eAAe;;;;OAAqE,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.PermissionModel = exports.PermissionSchema = void 0;
|
|
37
|
+
const mongoose_1 = require("mongoose");
|
|
38
|
+
const mongoose = __importStar(require("mongoose"));
|
|
39
|
+
const models_1 = require("../../models");
|
|
40
|
+
// 定義 Permission 的 Schema
|
|
41
|
+
exports.PermissionSchema = new mongoose_1.Schema({
|
|
42
|
+
id: { type: String, required: true, immutable: true }, // 使用 UUID 作為 id
|
|
43
|
+
description: { type: String },
|
|
44
|
+
category: { type: String, enum: Object.values(models_1.PermissionCategory), required: true },
|
|
45
|
+
action: { type: String, required: true }
|
|
46
|
+
}, { timestamps: true });
|
|
47
|
+
exports.PermissionSchema.post('findOneAndDelete', async function (doc) {
|
|
48
|
+
if (doc) {
|
|
49
|
+
const session = await mongoose.startSession();
|
|
50
|
+
try {
|
|
51
|
+
await session.withTransaction(async () => {
|
|
52
|
+
console.log(`Permission ${doc.id} removed, updating Roles...`);
|
|
53
|
+
const RoleModel = mongoose.model('Role');
|
|
54
|
+
const UserModel = mongoose.model('UserProfile');
|
|
55
|
+
const roleResult = await RoleModel.updateMany({ permissionId_list: doc.id }, { $pull: { permissionId_list: doc.id } }, { session });
|
|
56
|
+
const userResult = await UserModel.updateMany({ permissionId_list: doc.id }, { $pull: { permissionId_list: doc.id } }, { session });
|
|
57
|
+
console.log(`Permission ${doc.id} removed from ${roleResult.modifiedCount} roles and ${userResult.modifiedCount} user-profiles.`);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
console.error(`Error updating roles: ${error.message}`);
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
session.endSession();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
// 創建 Permission 模型
|
|
69
|
+
exports.PermissionModel = mongoose.model('Permission', exports.PermissionSchema);
|
|
70
|
+
//# sourceMappingURL=permission-mongo.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission-mongo.schema.js","sourceRoot":"","sources":["../../../schemas/mongo/permission-mongo.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAmD;AACnD,mDAAqC;AACrC,yCAA8D;AAU9D,yBAAyB;AACZ,QAAA,gBAAgB,GAAG,IAAI,iBAAM,CAAqB;IAC7D,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,gBAAgB;IACvE,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;IAC7B,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM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C,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,yBAAyB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1D,CAAC;gBAAS,CAAC;YACT,OAAO,CAAC,UAAU,EAAE,CAAC;QACvB,CAAC;IACH,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,mBAAmB;AACN,QAAA,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAqB,YAAY,EAAE,wBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Schema, Document } from 'mongoose';
|
|
2
|
+
import { ReportDefinition, ReportRun } from '../../models';
|
|
3
|
+
export interface ReportDefinitionDocument extends Document, ReportDefinition {
|
|
4
|
+
id: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const ReportDefinitionSchema: Schema<ReportDefinitionDocument, import("mongoose").Model<ReportDefinitionDocument, any, any, any, Document<unknown, any, ReportDefinitionDocument, any, {}> & ReportDefinitionDocument & Required<{
|
|
7
|
+
_id: import("mongoose").Types.ObjectId;
|
|
8
|
+
}> & {
|
|
9
|
+
__v: number;
|
|
10
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ReportDefinitionDocument, Document<unknown, {}, import("mongoose").FlatRecord<ReportDefinitionDocument>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ReportDefinitionDocument> & Required<{
|
|
11
|
+
_id: import("mongoose").Types.ObjectId;
|
|
12
|
+
}> & {
|
|
13
|
+
__v: number;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const ReportDefinitionModel: import("mongoose").Model<ReportDefinitionDocument, {}, {}, {}, Document<unknown, {}, ReportDefinitionDocument, {}, {}> & ReportDefinitionDocument & Required<{
|
|
16
|
+
_id: import("mongoose").Types.ObjectId;
|
|
17
|
+
}> & {
|
|
18
|
+
__v: number;
|
|
19
|
+
}, any>;
|
|
20
|
+
export type IReportRunMongoose = Omit<ReportRun, 'definitionId'> & {
|
|
21
|
+
definitionId: Schema.Types.ObjectId | string;
|
|
22
|
+
_definition: ReportDefinitionDocument;
|
|
23
|
+
};
|
|
24
|
+
export interface ReportRunDocument extends Document, IReportRunMongoose {
|
|
25
|
+
id: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const ReportRunSchema: Schema<ReportRunDocument, import("mongoose").Model<ReportRunDocument, any, any, any, Document<unknown, any, ReportRunDocument, any, {}> & ReportRunDocument & Required<{
|
|
28
|
+
_id: import("mongoose").Types.ObjectId;
|
|
29
|
+
}> & {
|
|
30
|
+
__v: number;
|
|
31
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ReportRunDocument, Document<unknown, {}, import("mongoose").FlatRecord<ReportRunDocument>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ReportRunDocument> & Required<{
|
|
32
|
+
_id: import("mongoose").Types.ObjectId;
|
|
33
|
+
}> & {
|
|
34
|
+
__v: number;
|
|
35
|
+
}>;
|
|
36
|
+
export declare const ReportRunModel: import("mongoose").Model<ReportRunDocument, {}, {}, {}, Document<unknown, {}, ReportRunDocument, {}, {}> & ReportRunDocument & Required<{
|
|
37
|
+
_id: import("mongoose").Types.ObjectId;
|
|
38
|
+
}> & {
|
|
39
|
+
__v: number;
|
|
40
|
+
}, any>;
|
|
41
|
+
//# sourceMappingURL=report-mongo.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-mongo.schema.d.ts","sourceRoot":"","sources":["../../../schemas/mongo/report-mongo.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAS,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEnD,OAAO,EAAiB,gBAAgB,EAAE,SAAS,EAAmB,MAAM,cAAc,CAAC;AAW3F,MAAM,WAAW,wBAAyB,SAAQ,QAAQ,EAAE,gBAAgB;IAC1E,EAAE,EAAE,MAAM,CAAC;CACZ;AAGD,eAAO,MAAM,sBAAsB;;;;;;;;EAcX,CAAC;AAGzB,eAAO,MAAM,qBAAqB;;;;OAA8E,CAAC;AAOjH,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,GAAG;IACjE,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC;IAC7C,WAAW,EAAE,wBAAwB,CAAA;CACtC,CAAC;AAEF,MAAM,WAAW,iBAAkB,SAAQ,QAAQ,EAAE,kBAAkB;IACrE,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,eAAO,MAAM,eAAe;;;;;;;;EAgCJ,CAAC;AAOzB,eAAO,MAAM,cAAc;;;;OAG1B,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportRunModel = exports.ReportRunSchema = exports.ReportDefinitionModel = exports.ReportDefinitionSchema = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
// 定義 ReportDefinition 的 Schema
|
|
7
|
+
exports.ReportDefinitionSchema = new mongoose_1.Schema({
|
|
8
|
+
id: { type: String, required: true, immutable: true }, // 使用 UUID 作為 id
|
|
9
|
+
code: { type: String, required: true, unique: true, index: true },
|
|
10
|
+
name: { type: String, required: true },
|
|
11
|
+
category: { type: String, enum: Object.values(models_1.EventCategory), default: models_1.EventCategory.Visual },
|
|
12
|
+
description: { type: String },
|
|
13
|
+
eventFilters: [mongoose_1.Schema.Types.Mixed], // 定義過濾條件 (eventType, keywords, payload 條件)
|
|
14
|
+
sections: [
|
|
15
|
+
{
|
|
16
|
+
title: String,
|
|
17
|
+
rules: [mongoose_1.Schema.Types.Mixed] // e.g. { eventType: "speech_note", keywords: ["止血"] }
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
isActive: { type: Boolean, default: true, index: true },
|
|
21
|
+
}, { timestamps: true });
|
|
22
|
+
// // 創建 ReportDefinition 模型
|
|
23
|
+
exports.ReportDefinitionModel = (0, mongoose_1.model)('ReportDefinition', exports.ReportDefinitionSchema);
|
|
24
|
+
exports.ReportRunSchema = new mongoose_1.Schema({
|
|
25
|
+
id: { type: String, required: true, immutable: true }, // 使用 UUID 作為 id
|
|
26
|
+
definitionId: { type: String, required: true, index: true },
|
|
27
|
+
encounterId: { type: String, required: true },
|
|
28
|
+
status: { type: String, enum: Object.values(models_1.ReportRunStatus), default: models_1.ReportRunStatus.Draft, index: true },
|
|
29
|
+
eventsUsed: [
|
|
30
|
+
{
|
|
31
|
+
eventId: { type: String }, // ✅ 改為 String
|
|
32
|
+
eventType: { type: String },
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
generatedContent: {
|
|
36
|
+
title: { type: String, required: true },
|
|
37
|
+
summary: { type: String },
|
|
38
|
+
sections: [
|
|
39
|
+
{
|
|
40
|
+
title: { type: String, required: true },
|
|
41
|
+
content: { type: String, required: false },
|
|
42
|
+
data: { type: mongoose_1.Schema.Types.Mixed }
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
provenance: {
|
|
46
|
+
definitionName: { type: String },
|
|
47
|
+
definitionVersion: { type: Number },
|
|
48
|
+
model: {
|
|
49
|
+
name: { type: String },
|
|
50
|
+
version: { type: String }
|
|
51
|
+
},
|
|
52
|
+
params: { type: mongoose_1.Schema.Types.Mixed, index: true }
|
|
53
|
+
}
|
|
54
|
+
}, // 存 JSON {title, sections: [...]}
|
|
55
|
+
finalizedAt: { type: Date }
|
|
56
|
+
}, { timestamps: true });
|
|
57
|
+
// 依時間與狀態查詢(排程/監控常用)
|
|
58
|
+
exports.ReportRunSchema.index({ status: 1, started_at: 1 });
|
|
59
|
+
// 查定義內的最近一次成功產出
|
|
60
|
+
exports.ReportRunSchema.index({ definitionId: 1, status: 1, startedAt: -1 });
|
|
61
|
+
exports.ReportRunModel = (0, mongoose_1.model)("ReportRun", exports.ReportRunSchema);
|
|
62
|
+
exports.ReportRunSchema.virtual('_definition', {
|
|
63
|
+
ref: 'ReportDefinition',
|
|
64
|
+
localField: 'definitionId',
|
|
65
|
+
foreignField: 'id',
|
|
66
|
+
justOne: true,
|
|
67
|
+
});
|
|
68
|
+
// =======================================================
|
|
69
|
+
// ReportArtifact MongoDB Types & Schema
|
|
70
|
+
// =======================================================
|
|
71
|
+
//# sourceMappingURL=report-mongo.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-mongo.schema.js","sourceRoot":"","sources":["../../../schemas/mongo/report-mongo.schema.ts"],"names":[],"mappings":";;;AAAA,uCAAmD;AAEnD,yCAA2F;AAe3F,+BAA+B;AAClB,QAAA,sBAAsB,GAAG,IAAI,iBAAM,CAA2B;IACzE,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,gBAAgB;IACvE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;IACjE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACtC,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,sBAAa,CAAC,EAAE,OAAO,EAAE,sBAAa,CAAC,MAAM,EAAE;IAC7F,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;IAC7B,YAAY,EAAE,CAAC,iBAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,2CAA2C;IAC/E,QAAQ,EAAE;QACR;YACE,KAAK,EAAE,MAAM;YACb,KAAK,EAAE,CAAC,iBAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,sDAAsD;SACnF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,IAAI,EAAE,iBAAM,CAAC,KAAK,CAAC,KAAK,EAAE;aACnC;SACF;QACD,UAAU,EAAE;YACV,cAAc,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YAChC,iBAAiB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACnC,KAAK,EAAE;gBACL,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;gBACtB,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;aAC1B;YACD,MAAM,EAAE,EAAE,IAAI,EAAE,iBAAM,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;SAClD;KACF,EAAE,kCAAkC;IACrC,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;CAC5B,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;AAEzB,oBAAoB;AACpB,uBAAe,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;AACpD,gBAAgB;AAChB,uBAAe,CAAC,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AAExD,QAAA,cAAc,GAAG,IAAA,gBAAK,EACjC,WAAW,EACX,uBAAe,CAChB,CAAC;AAEF,uBAAe,CAAC,OAAO,CAAC,aAAa,EAAE;IACrC,GAAG,EAAE,kBAAkB;IACvB,UAAU,EAAE,cAAc;IAC1B,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,IAAI;CACd,CAAC,CAAC;AAEH,0DAA0D;AAC1D,wCAAwC;AACxC,0DAA0D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import mongoose, { Document } from 'mongoose';
|
|
2
|
+
import { Role } from '../../models';
|
|
3
|
+
import { PermissionDocument } from './permission-mongo.schema';
|
|
4
|
+
export interface RoleDocument extends Document, Role {
|
|
5
|
+
id: string;
|
|
6
|
+
_permission_list: PermissionDocument[];
|
|
7
|
+
}
|
|
8
|
+
export declare const RoleSchema: mongoose.Schema<RoleDocument, mongoose.Model<RoleDocument, any, any, any, mongoose.Document<unknown, any, RoleDocument, any, {}> & RoleDocument & Required<{
|
|
9
|
+
_id: mongoose.Types.ObjectId;
|
|
10
|
+
}> & {
|
|
11
|
+
__v: number;
|
|
12
|
+
}, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, RoleDocument, mongoose.Document<unknown, {}, mongoose.FlatRecord<RoleDocument>, {}, mongoose.ResolveSchemaOptions<mongoose.DefaultSchemaOptions>> & mongoose.FlatRecord<RoleDocument> & Required<{
|
|
13
|
+
_id: mongoose.Types.ObjectId;
|
|
14
|
+
}> & {
|
|
15
|
+
__v: number;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const RoleModel: mongoose.Model<RoleDocument, {}, {}, {}, mongoose.Document<unknown, {}, RoleDocument, {}, {}> & RoleDocument & Required<{
|
|
18
|
+
_id: mongoose.Types.ObjectId;
|
|
19
|
+
}> & {
|
|
20
|
+
__v: number;
|
|
21
|
+
}, any>;
|
|
22
|
+
//# sourceMappingURL=role-mongo.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role-mongo.schema.d.ts","sourceRoot":"","sources":["../../../schemas/mongo/role-mongo.schema.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,EAAE,EAAiB,QAAQ,EAAS,MAAM,UAAU,CAAC;AACpE,OAAO,EAAE,IAAI,EAAa,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAQ/D,MAAM,WAAW,YAAa,SAAQ,QAAQ,EAAE,IAAI;IAClD,EAAE,EAAE,MAAM,CAAC;IACX,gBAAgB,EAAE,kBAAkB,EAAE,CAAC;CACxC;AAGD,eAAO,MAAM,UAAU;;;;;;;;EAMC,CAAC;AAkCzB,eAAO,MAAM,SAAS;;;;OAA0C,CAAC"}
|