streamby-core 0.13.0 → 0.15.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/config.d.ts +18 -0
- package/dist/config.js +25 -0
- package/dist/db/initExportModel.d.ts +60 -0
- package/dist/db/initExportModel.js +18 -0
- package/dist/db/initProjectModel.d.ts +72 -60
- package/dist/db/initProjectModel.js +3 -1
- package/dist/db/initUserModel.d.ts +48 -0
- package/dist/db/initUserModel.js +19 -0
- package/dist/middleware/createRouter.js +217 -47
- package/dist/models/ExportCollection.d.ts +54 -0
- package/dist/models/ExportCollection.js +19 -0
- package/dist/providers/createDatabaseProvider.d.ts +69 -9
- package/dist/providers/createDatabaseProvider.js +44 -12
- package/dist/providers/createPrismaProvider.d.ts +8 -0
- package/dist/providers/createPrismaProvider.js +18 -0
- package/dist/providers/mongoExportProvider.d.ts +3 -0
- package/dist/providers/mongoExportProvider.js +13 -0
- package/dist/providers/mongoProjectProvider.d.ts +1 -1
- package/dist/providers/mongoProjectProvider.js +55 -33
- package/dist/providers/prismaExportCollectionProvider.d.ts +61 -0
- package/dist/providers/prismaExportCollectionProvider.js +45 -0
- package/dist/providers/prismaExportProvider.d.ts +3 -0
- package/dist/providers/prismaExportProvider.js +13 -0
- package/dist/providers/prismaProjectProvider.d.ts +3 -0
- package/dist/providers/prismaProjectProvider.js +147 -0
- package/dist/types/index.d.ts +69 -12
- package/package.json +4 -2
- package/dist/dev/server.d.ts +0 -4
- package/dist/dev/server.js +0 -14
package/dist/config.d.ts
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const config: {
|
|
2
|
+
mongoUri: string;
|
|
3
|
+
s3: {
|
|
4
|
+
accessKeyId: string;
|
|
5
|
+
secretAccessKey: string;
|
|
6
|
+
region: string;
|
|
7
|
+
bucketName: string;
|
|
8
|
+
};
|
|
9
|
+
gcs: {
|
|
10
|
+
projectId: string;
|
|
11
|
+
keyFilename: string;
|
|
12
|
+
bucketName: string;
|
|
13
|
+
};
|
|
14
|
+
local: {
|
|
15
|
+
storagePath: string;
|
|
16
|
+
};
|
|
17
|
+
supabaseString: string;
|
|
18
|
+
};
|
package/dist/config.js
CHANGED
|
@@ -1 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.config = void 0;
|
|
7
|
+
const dotenv_1 = __importDefault(require("dotenv"));
|
|
8
|
+
dotenv_1.default.config();
|
|
9
|
+
exports.config = {
|
|
10
|
+
mongoUri: process.env.MONGO_URI || '',
|
|
11
|
+
s3: {
|
|
12
|
+
accessKeyId: process.env.AWS_ACCESS_KEY_ID || '',
|
|
13
|
+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || '',
|
|
14
|
+
region: process.env.AWS_REGION || 'us-east-1',
|
|
15
|
+
bucketName: process.env.AWS_BUCKET_NAME || 'streamby-dev',
|
|
16
|
+
},
|
|
17
|
+
gcs: {
|
|
18
|
+
projectId: process.env.GCS_PROJECT_ID || '',
|
|
19
|
+
keyFilename: process.env.GCS_KEY_FILENAME || '',
|
|
20
|
+
bucketName: process.env.GCS_BUCKET_NAME || 'streamby-dev',
|
|
21
|
+
},
|
|
22
|
+
local: {
|
|
23
|
+
storagePath: process.env.LOCAL_STORAGE_PATH || './uploads',
|
|
24
|
+
},
|
|
25
|
+
supabaseString: process.env.SUPABASE_STRING || '',
|
|
26
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
export declare function initExportModel(connection: mongoose.Connection): mongoose.Model<{
|
|
3
|
+
createdAt: NativeDate;
|
|
4
|
+
updatedAt: NativeDate;
|
|
5
|
+
} & {
|
|
6
|
+
name: string;
|
|
7
|
+
collectionName: string;
|
|
8
|
+
projectId: mongoose.Types.ObjectId;
|
|
9
|
+
description?: string | null | undefined;
|
|
10
|
+
}, {}, {}, {}, mongoose.Document<unknown, {}, {
|
|
11
|
+
createdAt: NativeDate;
|
|
12
|
+
updatedAt: NativeDate;
|
|
13
|
+
} & {
|
|
14
|
+
name: string;
|
|
15
|
+
collectionName: string;
|
|
16
|
+
projectId: mongoose.Types.ObjectId;
|
|
17
|
+
description?: string | null | undefined;
|
|
18
|
+
}, {}> & {
|
|
19
|
+
createdAt: NativeDate;
|
|
20
|
+
updatedAt: NativeDate;
|
|
21
|
+
} & {
|
|
22
|
+
name: string;
|
|
23
|
+
collectionName: string;
|
|
24
|
+
projectId: mongoose.Types.ObjectId;
|
|
25
|
+
description?: string | null | undefined;
|
|
26
|
+
} & {
|
|
27
|
+
_id: mongoose.Types.ObjectId;
|
|
28
|
+
} & {
|
|
29
|
+
__v: number;
|
|
30
|
+
}, mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
31
|
+
timestamps: true;
|
|
32
|
+
}, {
|
|
33
|
+
createdAt: NativeDate;
|
|
34
|
+
updatedAt: NativeDate;
|
|
35
|
+
} & {
|
|
36
|
+
name: string;
|
|
37
|
+
collectionName: string;
|
|
38
|
+
projectId: mongoose.Types.ObjectId;
|
|
39
|
+
description?: string | null | undefined;
|
|
40
|
+
}, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
|
|
41
|
+
createdAt: NativeDate;
|
|
42
|
+
updatedAt: NativeDate;
|
|
43
|
+
} & {
|
|
44
|
+
name: string;
|
|
45
|
+
collectionName: string;
|
|
46
|
+
projectId: mongoose.Types.ObjectId;
|
|
47
|
+
description?: string | null | undefined;
|
|
48
|
+
}>, {}> & mongoose.FlatRecord<{
|
|
49
|
+
createdAt: NativeDate;
|
|
50
|
+
updatedAt: NativeDate;
|
|
51
|
+
} & {
|
|
52
|
+
name: string;
|
|
53
|
+
collectionName: string;
|
|
54
|
+
projectId: mongoose.Types.ObjectId;
|
|
55
|
+
description?: string | null | undefined;
|
|
56
|
+
}> & {
|
|
57
|
+
_id: mongoose.Types.ObjectId;
|
|
58
|
+
} & {
|
|
59
|
+
__v: number;
|
|
60
|
+
}>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.initExportModel = initExportModel;
|
|
7
|
+
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
|
+
function initExportModel(connection) {
|
|
9
|
+
const exportSchema = new mongoose_1.default.Schema({
|
|
10
|
+
name: { type: String, required: true },
|
|
11
|
+
description: { type: String },
|
|
12
|
+
collectionName: { type: String, required: true },
|
|
13
|
+
projectId: { type: mongoose_1.default.Schema.Types.ObjectId, ref: 'Project', required: true },
|
|
14
|
+
}, {
|
|
15
|
+
timestamps: true
|
|
16
|
+
});
|
|
17
|
+
return connection.model('Export', exportSchema);
|
|
18
|
+
}
|
|
@@ -3,6 +3,22 @@ export declare function initProjectModel(connection: mongoose.Connection): mongo
|
|
|
3
3
|
createdAt: NativeDate;
|
|
4
4
|
updatedAt: NativeDate;
|
|
5
5
|
} & {
|
|
6
|
+
dbType: string;
|
|
7
|
+
name: string;
|
|
8
|
+
members: mongoose.Types.DocumentArray<{
|
|
9
|
+
userId: mongoose.Types.ObjectId;
|
|
10
|
+
role: "viewer" | "editor" | "admin";
|
|
11
|
+
archived: boolean;
|
|
12
|
+
}, mongoose.Types.Subdocument<mongoose.Types.ObjectId, any, {
|
|
13
|
+
userId: mongoose.Types.ObjectId;
|
|
14
|
+
role: "viewer" | "editor" | "admin";
|
|
15
|
+
archived: boolean;
|
|
16
|
+
}> & {
|
|
17
|
+
userId: mongoose.Types.ObjectId;
|
|
18
|
+
role: "viewer" | "editor" | "admin";
|
|
19
|
+
archived: boolean;
|
|
20
|
+
}>;
|
|
21
|
+
exports: mongoose.Types.ObjectId[];
|
|
6
22
|
rootFolders: mongoose.Types.DocumentArray<{
|
|
7
23
|
children: mongoose.Types.DocumentArray<{
|
|
8
24
|
entries?: {} | null | undefined;
|
|
@@ -394,6 +410,15 @@ export declare function initProjectModel(connection: mongoose.Connection): mongo
|
|
|
394
410
|
id?: string | null | undefined;
|
|
395
411
|
name?: string | null | undefined;
|
|
396
412
|
}>;
|
|
413
|
+
allowUpload: boolean;
|
|
414
|
+
allowSharing: boolean;
|
|
415
|
+
image?: string | null | undefined;
|
|
416
|
+
description?: string | null | undefined;
|
|
417
|
+
}, {}, {}, {}, mongoose.Document<unknown, {}, {
|
|
418
|
+
createdAt: NativeDate;
|
|
419
|
+
updatedAt: NativeDate;
|
|
420
|
+
} & {
|
|
421
|
+
dbType: string;
|
|
397
422
|
name: string;
|
|
398
423
|
members: mongoose.Types.DocumentArray<{
|
|
399
424
|
userId: mongoose.Types.ObjectId;
|
|
@@ -408,14 +433,7 @@ export declare function initProjectModel(connection: mongoose.Connection): mongo
|
|
|
408
433
|
role: "viewer" | "editor" | "admin";
|
|
409
434
|
archived: boolean;
|
|
410
435
|
}>;
|
|
411
|
-
|
|
412
|
-
allowSharing: boolean;
|
|
413
|
-
image?: string | null | undefined;
|
|
414
|
-
description?: string | null | undefined;
|
|
415
|
-
}, {}, {}, {}, mongoose.Document<unknown, {}, {
|
|
416
|
-
createdAt: NativeDate;
|
|
417
|
-
updatedAt: NativeDate;
|
|
418
|
-
} & {
|
|
436
|
+
exports: mongoose.Types.ObjectId[];
|
|
419
437
|
rootFolders: mongoose.Types.DocumentArray<{
|
|
420
438
|
children: mongoose.Types.DocumentArray<{
|
|
421
439
|
entries?: {} | null | undefined;
|
|
@@ -807,6 +825,15 @@ export declare function initProjectModel(connection: mongoose.Connection): mongo
|
|
|
807
825
|
id?: string | null | undefined;
|
|
808
826
|
name?: string | null | undefined;
|
|
809
827
|
}>;
|
|
828
|
+
allowUpload: boolean;
|
|
829
|
+
allowSharing: boolean;
|
|
830
|
+
image?: string | null | undefined;
|
|
831
|
+
description?: string | null | undefined;
|
|
832
|
+
}, {}> & {
|
|
833
|
+
createdAt: NativeDate;
|
|
834
|
+
updatedAt: NativeDate;
|
|
835
|
+
} & {
|
|
836
|
+
dbType: string;
|
|
810
837
|
name: string;
|
|
811
838
|
members: mongoose.Types.DocumentArray<{
|
|
812
839
|
userId: mongoose.Types.ObjectId;
|
|
@@ -821,14 +848,7 @@ export declare function initProjectModel(connection: mongoose.Connection): mongo
|
|
|
821
848
|
role: "viewer" | "editor" | "admin";
|
|
822
849
|
archived: boolean;
|
|
823
850
|
}>;
|
|
824
|
-
|
|
825
|
-
allowSharing: boolean;
|
|
826
|
-
image?: string | null | undefined;
|
|
827
|
-
description?: string | null | undefined;
|
|
828
|
-
}> & {
|
|
829
|
-
createdAt: NativeDate;
|
|
830
|
-
updatedAt: NativeDate;
|
|
831
|
-
} & {
|
|
851
|
+
exports: mongoose.Types.ObjectId[];
|
|
832
852
|
rootFolders: mongoose.Types.DocumentArray<{
|
|
833
853
|
children: mongoose.Types.DocumentArray<{
|
|
834
854
|
entries?: {} | null | undefined;
|
|
@@ -1220,20 +1240,6 @@ export declare function initProjectModel(connection: mongoose.Connection): mongo
|
|
|
1220
1240
|
id?: string | null | undefined;
|
|
1221
1241
|
name?: string | null | undefined;
|
|
1222
1242
|
}>;
|
|
1223
|
-
name: string;
|
|
1224
|
-
members: mongoose.Types.DocumentArray<{
|
|
1225
|
-
userId: mongoose.Types.ObjectId;
|
|
1226
|
-
role: "viewer" | "editor" | "admin";
|
|
1227
|
-
archived: boolean;
|
|
1228
|
-
}, mongoose.Types.Subdocument<mongoose.Types.ObjectId, any, {
|
|
1229
|
-
userId: mongoose.Types.ObjectId;
|
|
1230
|
-
role: "viewer" | "editor" | "admin";
|
|
1231
|
-
archived: boolean;
|
|
1232
|
-
}> & {
|
|
1233
|
-
userId: mongoose.Types.ObjectId;
|
|
1234
|
-
role: "viewer" | "editor" | "admin";
|
|
1235
|
-
archived: boolean;
|
|
1236
|
-
}>;
|
|
1237
1243
|
allowUpload: boolean;
|
|
1238
1244
|
allowSharing: boolean;
|
|
1239
1245
|
image?: string | null | undefined;
|
|
@@ -1248,6 +1254,22 @@ export declare function initProjectModel(connection: mongoose.Connection): mongo
|
|
|
1248
1254
|
createdAt: NativeDate;
|
|
1249
1255
|
updatedAt: NativeDate;
|
|
1250
1256
|
} & {
|
|
1257
|
+
dbType: string;
|
|
1258
|
+
name: string;
|
|
1259
|
+
members: mongoose.Types.DocumentArray<{
|
|
1260
|
+
userId: mongoose.Types.ObjectId;
|
|
1261
|
+
role: "viewer" | "editor" | "admin";
|
|
1262
|
+
archived: boolean;
|
|
1263
|
+
}, mongoose.Types.Subdocument<mongoose.Types.ObjectId, any, {
|
|
1264
|
+
userId: mongoose.Types.ObjectId;
|
|
1265
|
+
role: "viewer" | "editor" | "admin";
|
|
1266
|
+
archived: boolean;
|
|
1267
|
+
}> & {
|
|
1268
|
+
userId: mongoose.Types.ObjectId;
|
|
1269
|
+
role: "viewer" | "editor" | "admin";
|
|
1270
|
+
archived: boolean;
|
|
1271
|
+
}>;
|
|
1272
|
+
exports: mongoose.Types.ObjectId[];
|
|
1251
1273
|
rootFolders: mongoose.Types.DocumentArray<{
|
|
1252
1274
|
children: mongoose.Types.DocumentArray<{
|
|
1253
1275
|
entries?: {} | null | undefined;
|
|
@@ -1639,6 +1661,15 @@ export declare function initProjectModel(connection: mongoose.Connection): mongo
|
|
|
1639
1661
|
id?: string | null | undefined;
|
|
1640
1662
|
name?: string | null | undefined;
|
|
1641
1663
|
}>;
|
|
1664
|
+
allowUpload: boolean;
|
|
1665
|
+
allowSharing: boolean;
|
|
1666
|
+
image?: string | null | undefined;
|
|
1667
|
+
description?: string | null | undefined;
|
|
1668
|
+
}, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
|
|
1669
|
+
createdAt: NativeDate;
|
|
1670
|
+
updatedAt: NativeDate;
|
|
1671
|
+
} & {
|
|
1672
|
+
dbType: string;
|
|
1642
1673
|
name: string;
|
|
1643
1674
|
members: mongoose.Types.DocumentArray<{
|
|
1644
1675
|
userId: mongoose.Types.ObjectId;
|
|
@@ -1653,14 +1684,7 @@ export declare function initProjectModel(connection: mongoose.Connection): mongo
|
|
|
1653
1684
|
role: "viewer" | "editor" | "admin";
|
|
1654
1685
|
archived: boolean;
|
|
1655
1686
|
}>;
|
|
1656
|
-
|
|
1657
|
-
allowSharing: boolean;
|
|
1658
|
-
image?: string | null | undefined;
|
|
1659
|
-
description?: string | null | undefined;
|
|
1660
|
-
}, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
|
|
1661
|
-
createdAt: NativeDate;
|
|
1662
|
-
updatedAt: NativeDate;
|
|
1663
|
-
} & {
|
|
1687
|
+
exports: mongoose.Types.ObjectId[];
|
|
1664
1688
|
rootFolders: mongoose.Types.DocumentArray<{
|
|
1665
1689
|
children: mongoose.Types.DocumentArray<{
|
|
1666
1690
|
entries?: {} | null | undefined;
|
|
@@ -2052,6 +2076,15 @@ export declare function initProjectModel(connection: mongoose.Connection): mongo
|
|
|
2052
2076
|
id?: string | null | undefined;
|
|
2053
2077
|
name?: string | null | undefined;
|
|
2054
2078
|
}>;
|
|
2079
|
+
allowUpload: boolean;
|
|
2080
|
+
allowSharing: boolean;
|
|
2081
|
+
image?: string | null | undefined;
|
|
2082
|
+
description?: string | null | undefined;
|
|
2083
|
+
}>, {}> & mongoose.FlatRecord<{
|
|
2084
|
+
createdAt: NativeDate;
|
|
2085
|
+
updatedAt: NativeDate;
|
|
2086
|
+
} & {
|
|
2087
|
+
dbType: string;
|
|
2055
2088
|
name: string;
|
|
2056
2089
|
members: mongoose.Types.DocumentArray<{
|
|
2057
2090
|
userId: mongoose.Types.ObjectId;
|
|
@@ -2066,14 +2099,7 @@ export declare function initProjectModel(connection: mongoose.Connection): mongo
|
|
|
2066
2099
|
role: "viewer" | "editor" | "admin";
|
|
2067
2100
|
archived: boolean;
|
|
2068
2101
|
}>;
|
|
2069
|
-
|
|
2070
|
-
allowSharing: boolean;
|
|
2071
|
-
image?: string | null | undefined;
|
|
2072
|
-
description?: string | null | undefined;
|
|
2073
|
-
}>> & mongoose.FlatRecord<{
|
|
2074
|
-
createdAt: NativeDate;
|
|
2075
|
-
updatedAt: NativeDate;
|
|
2076
|
-
} & {
|
|
2102
|
+
exports: mongoose.Types.ObjectId[];
|
|
2077
2103
|
rootFolders: mongoose.Types.DocumentArray<{
|
|
2078
2104
|
children: mongoose.Types.DocumentArray<{
|
|
2079
2105
|
entries?: {} | null | undefined;
|
|
@@ -2465,20 +2491,6 @@ export declare function initProjectModel(connection: mongoose.Connection): mongo
|
|
|
2465
2491
|
id?: string | null | undefined;
|
|
2466
2492
|
name?: string | null | undefined;
|
|
2467
2493
|
}>;
|
|
2468
|
-
name: string;
|
|
2469
|
-
members: mongoose.Types.DocumentArray<{
|
|
2470
|
-
userId: mongoose.Types.ObjectId;
|
|
2471
|
-
role: "viewer" | "editor" | "admin";
|
|
2472
|
-
archived: boolean;
|
|
2473
|
-
}, mongoose.Types.Subdocument<mongoose.Types.ObjectId, any, {
|
|
2474
|
-
userId: mongoose.Types.ObjectId;
|
|
2475
|
-
role: "viewer" | "editor" | "admin";
|
|
2476
|
-
archived: boolean;
|
|
2477
|
-
}> & {
|
|
2478
|
-
userId: mongoose.Types.ObjectId;
|
|
2479
|
-
role: "viewer" | "editor" | "admin";
|
|
2480
|
-
archived: boolean;
|
|
2481
|
-
}>;
|
|
2482
2494
|
allowUpload: boolean;
|
|
2483
2495
|
allowSharing: boolean;
|
|
2484
2496
|
image?: string | null | undefined;
|
|
@@ -17,13 +17,15 @@ function initProjectModel(connection) {
|
|
|
17
17
|
archived: { type: Boolean, default: false }
|
|
18
18
|
}, { _id: false });
|
|
19
19
|
const projectSchema = new mongoose_1.default.Schema({
|
|
20
|
+
dbType: { type: String, required: true },
|
|
20
21
|
name: { type: String, required: true },
|
|
21
22
|
description: { type: String },
|
|
22
23
|
image: { type: String },
|
|
23
24
|
rootFolders: [folderNodeSchema],
|
|
24
25
|
allowUpload: { type: Boolean, default: true },
|
|
25
26
|
allowSharing: { type: Boolean, default: false },
|
|
26
|
-
members: [memberSchema]
|
|
27
|
+
members: [memberSchema],
|
|
28
|
+
exports: [{ type: mongoose_1.default.Schema.Types.ObjectId, ref: 'Export' }]
|
|
27
29
|
}, {
|
|
28
30
|
timestamps: true
|
|
29
31
|
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
export declare function initUserModel(connection: mongoose.Connection): mongoose.Model<any, {}, {}, {}, any, any> | mongoose.Model<{
|
|
3
|
+
createdAt: NativeDate;
|
|
4
|
+
updatedAt: NativeDate;
|
|
5
|
+
} & {
|
|
6
|
+
username: string;
|
|
7
|
+
email: string;
|
|
8
|
+
}, {}, {}, {}, mongoose.Document<unknown, {}, {
|
|
9
|
+
createdAt: NativeDate;
|
|
10
|
+
updatedAt: NativeDate;
|
|
11
|
+
} & {
|
|
12
|
+
username: string;
|
|
13
|
+
email: string;
|
|
14
|
+
}, {}> & {
|
|
15
|
+
createdAt: NativeDate;
|
|
16
|
+
updatedAt: NativeDate;
|
|
17
|
+
} & {
|
|
18
|
+
username: string;
|
|
19
|
+
email: string;
|
|
20
|
+
} & {
|
|
21
|
+
_id: mongoose.Types.ObjectId;
|
|
22
|
+
} & {
|
|
23
|
+
__v: number;
|
|
24
|
+
}, mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
25
|
+
timestamps: true;
|
|
26
|
+
}, {
|
|
27
|
+
createdAt: NativeDate;
|
|
28
|
+
updatedAt: NativeDate;
|
|
29
|
+
} & {
|
|
30
|
+
username: string;
|
|
31
|
+
email: string;
|
|
32
|
+
}, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
|
|
33
|
+
createdAt: NativeDate;
|
|
34
|
+
updatedAt: NativeDate;
|
|
35
|
+
} & {
|
|
36
|
+
username: string;
|
|
37
|
+
email: string;
|
|
38
|
+
}>, {}> & mongoose.FlatRecord<{
|
|
39
|
+
createdAt: NativeDate;
|
|
40
|
+
updatedAt: NativeDate;
|
|
41
|
+
} & {
|
|
42
|
+
username: string;
|
|
43
|
+
email: string;
|
|
44
|
+
}> & {
|
|
45
|
+
_id: mongoose.Types.ObjectId;
|
|
46
|
+
} & {
|
|
47
|
+
__v: number;
|
|
48
|
+
}>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.initUserModel = initUserModel;
|
|
7
|
+
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
|
+
function initUserModel(connection) {
|
|
9
|
+
const userSchema = new mongoose_1.default.Schema({
|
|
10
|
+
username: { type: String, required: true, unique: true },
|
|
11
|
+
email: { type: String, required: true, unique: true },
|
|
12
|
+
}, {
|
|
13
|
+
timestamps: true
|
|
14
|
+
});
|
|
15
|
+
if (connection.models.User) {
|
|
16
|
+
return connection.models.User;
|
|
17
|
+
}
|
|
18
|
+
return connection.model('User', userSchema);
|
|
19
|
+
}
|