streamby-core 0.16.0 → 0.16.2
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/middleware/createRouter.js +2 -0
- package/dist/mongoose_models/initProjectModel.d.ts +18 -18
- package/dist/mongoose_models/initProjectModel.js +1 -1
- package/dist/providers/prismaProjectProvider.js +2 -1
- package/dist/services/auth.js +1 -1
- package/dist/utils/pushPrismaSchema.d.ts +5 -0
- package/dist/utils/pushPrismaSchema.js +35 -0
- package/package.json +57 -56
- package/prisma/migrations/20250720184616_init_with_cascade/migration.sql +90 -0
- package/prisma/migrations/migration_lock.toml +3 -0
- package/prisma/schema.prisma +87 -0
|
@@ -9,10 +9,12 @@ const file_1 = require("../services/file");
|
|
|
9
9
|
const presign_1 = require("../services/presign");
|
|
10
10
|
const createStorageProvider_1 = require("../providers/createStorageProvider");
|
|
11
11
|
const createDatabaseProvider_1 = require("../providers/createDatabaseProvider");
|
|
12
|
+
const pushPrismaSchema_1 = require("../utils/pushPrismaSchema");
|
|
12
13
|
function isProjectMember(project, userId) {
|
|
13
14
|
return project.members?.some((m) => m.userId?.toString() === userId?.toString());
|
|
14
15
|
}
|
|
15
16
|
function createStreamByRouter(config) {
|
|
17
|
+
(0, pushPrismaSchema_1.pushPrismaSchema)();
|
|
16
18
|
const router = express_1.default.Router();
|
|
17
19
|
const adapter = config.adapter || (0, createStorageProvider_1.createStorageProvider)(config.storageProviders);
|
|
18
20
|
const projectProviders = {};
|
|
@@ -397,15 +397,15 @@ export declare function initProjectModel(connection: mongoose.Connection): mongo
|
|
|
397
397
|
dbType: string;
|
|
398
398
|
name: string;
|
|
399
399
|
members: mongoose.Types.DocumentArray<{
|
|
400
|
-
userId:
|
|
400
|
+
userId: string;
|
|
401
401
|
role: "viewer" | "editor" | "admin";
|
|
402
402
|
archived: boolean;
|
|
403
403
|
}, mongoose.Types.Subdocument<mongoose.Types.ObjectId, any, {
|
|
404
|
-
userId:
|
|
404
|
+
userId: string;
|
|
405
405
|
role: "viewer" | "editor" | "admin";
|
|
406
406
|
archived: boolean;
|
|
407
407
|
}> & {
|
|
408
|
-
userId:
|
|
408
|
+
userId: string;
|
|
409
409
|
role: "viewer" | "editor" | "admin";
|
|
410
410
|
archived: boolean;
|
|
411
411
|
}>;
|
|
@@ -812,15 +812,15 @@ export declare function initProjectModel(connection: mongoose.Connection): mongo
|
|
|
812
812
|
dbType: string;
|
|
813
813
|
name: string;
|
|
814
814
|
members: mongoose.Types.DocumentArray<{
|
|
815
|
-
userId:
|
|
815
|
+
userId: string;
|
|
816
816
|
role: "viewer" | "editor" | "admin";
|
|
817
817
|
archived: boolean;
|
|
818
818
|
}, mongoose.Types.Subdocument<mongoose.Types.ObjectId, any, {
|
|
819
|
-
userId:
|
|
819
|
+
userId: string;
|
|
820
820
|
role: "viewer" | "editor" | "admin";
|
|
821
821
|
archived: boolean;
|
|
822
822
|
}> & {
|
|
823
|
-
userId:
|
|
823
|
+
userId: string;
|
|
824
824
|
role: "viewer" | "editor" | "admin";
|
|
825
825
|
archived: boolean;
|
|
826
826
|
}>;
|
|
@@ -1227,15 +1227,15 @@ export declare function initProjectModel(connection: mongoose.Connection): mongo
|
|
|
1227
1227
|
dbType: string;
|
|
1228
1228
|
name: string;
|
|
1229
1229
|
members: mongoose.Types.DocumentArray<{
|
|
1230
|
-
userId:
|
|
1230
|
+
userId: string;
|
|
1231
1231
|
role: "viewer" | "editor" | "admin";
|
|
1232
1232
|
archived: boolean;
|
|
1233
1233
|
}, mongoose.Types.Subdocument<mongoose.Types.ObjectId, any, {
|
|
1234
|
-
userId:
|
|
1234
|
+
userId: string;
|
|
1235
1235
|
role: "viewer" | "editor" | "admin";
|
|
1236
1236
|
archived: boolean;
|
|
1237
1237
|
}> & {
|
|
1238
|
-
userId:
|
|
1238
|
+
userId: string;
|
|
1239
1239
|
role: "viewer" | "editor" | "admin";
|
|
1240
1240
|
archived: boolean;
|
|
1241
1241
|
}>;
|
|
@@ -1649,15 +1649,15 @@ export declare function initProjectModel(connection: mongoose.Connection): mongo
|
|
|
1649
1649
|
dbType: string;
|
|
1650
1650
|
name: string;
|
|
1651
1651
|
members: mongoose.Types.DocumentArray<{
|
|
1652
|
-
userId:
|
|
1652
|
+
userId: string;
|
|
1653
1653
|
role: "viewer" | "editor" | "admin";
|
|
1654
1654
|
archived: boolean;
|
|
1655
1655
|
}, mongoose.Types.Subdocument<mongoose.Types.ObjectId, any, {
|
|
1656
|
-
userId:
|
|
1656
|
+
userId: string;
|
|
1657
1657
|
role: "viewer" | "editor" | "admin";
|
|
1658
1658
|
archived: boolean;
|
|
1659
1659
|
}> & {
|
|
1660
|
-
userId:
|
|
1660
|
+
userId: string;
|
|
1661
1661
|
role: "viewer" | "editor" | "admin";
|
|
1662
1662
|
archived: boolean;
|
|
1663
1663
|
}>;
|
|
@@ -2064,15 +2064,15 @@ export declare function initProjectModel(connection: mongoose.Connection): mongo
|
|
|
2064
2064
|
dbType: string;
|
|
2065
2065
|
name: string;
|
|
2066
2066
|
members: mongoose.Types.DocumentArray<{
|
|
2067
|
-
userId:
|
|
2067
|
+
userId: string;
|
|
2068
2068
|
role: "viewer" | "editor" | "admin";
|
|
2069
2069
|
archived: boolean;
|
|
2070
2070
|
}, mongoose.Types.Subdocument<mongoose.Types.ObjectId, any, {
|
|
2071
|
-
userId:
|
|
2071
|
+
userId: string;
|
|
2072
2072
|
role: "viewer" | "editor" | "admin";
|
|
2073
2073
|
archived: boolean;
|
|
2074
2074
|
}> & {
|
|
2075
|
-
userId:
|
|
2075
|
+
userId: string;
|
|
2076
2076
|
role: "viewer" | "editor" | "admin";
|
|
2077
2077
|
archived: boolean;
|
|
2078
2078
|
}>;
|
|
@@ -2479,15 +2479,15 @@ export declare function initProjectModel(connection: mongoose.Connection): mongo
|
|
|
2479
2479
|
dbType: string;
|
|
2480
2480
|
name: string;
|
|
2481
2481
|
members: mongoose.Types.DocumentArray<{
|
|
2482
|
-
userId:
|
|
2482
|
+
userId: string;
|
|
2483
2483
|
role: "viewer" | "editor" | "admin";
|
|
2484
2484
|
archived: boolean;
|
|
2485
2485
|
}, mongoose.Types.Subdocument<mongoose.Types.ObjectId, any, {
|
|
2486
|
-
userId:
|
|
2486
|
+
userId: string;
|
|
2487
2487
|
role: "viewer" | "editor" | "admin";
|
|
2488
2488
|
archived: boolean;
|
|
2489
2489
|
}> & {
|
|
2490
|
-
userId:
|
|
2490
|
+
userId: string;
|
|
2491
2491
|
role: "viewer" | "editor" | "admin";
|
|
2492
2492
|
archived: boolean;
|
|
2493
2493
|
}>;
|
|
@@ -12,7 +12,7 @@ function initProjectModel(connection) {
|
|
|
12
12
|
children: [Object],
|
|
13
13
|
}, { _id: false });
|
|
14
14
|
const memberSchema = new mongoose_1.default.Schema({
|
|
15
|
-
userId: { type:
|
|
15
|
+
userId: { type: String, required: true },
|
|
16
16
|
role: { type: String, enum: ['viewer', 'editor', 'admin'], default: 'viewer' },
|
|
17
17
|
archived: { type: Boolean, default: false }
|
|
18
18
|
}, { _id: false });
|
|
@@ -74,7 +74,8 @@ function createPrismaProjectProvider(prisma, adapter) {
|
|
|
74
74
|
return { success: true };
|
|
75
75
|
}
|
|
76
76
|
catch (error) {
|
|
77
|
-
|
|
77
|
+
console.error('Error deleting project:', error);
|
|
78
|
+
throw new Error(`Failed to delete project: ${error.message || error}`);
|
|
78
79
|
}
|
|
79
80
|
},
|
|
80
81
|
async archive(projectId, userId) {
|
package/dist/services/auth.js
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
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.pushPrismaSchema = pushPrismaSchema;
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
let schemaPushed = false;
|
|
10
|
+
/**
|
|
11
|
+
* Executes `prisma db push` programmatically to sync the schema with the database.
|
|
12
|
+
* Ensures the command is only run once per application lifecycle.
|
|
13
|
+
*/
|
|
14
|
+
function pushPrismaSchema() {
|
|
15
|
+
if (schemaPushed) {
|
|
16
|
+
console.log('[StreamBy] Prisma schema has already been pushed. Skipping.');
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
// Resolve the path to the schema.prisma file relative to the compiled JS file.
|
|
21
|
+
// __dirname will be /path/to/your/project/node_modules/streamby-core/dist/utils
|
|
22
|
+
const schemaPath = path_1.default.resolve(__dirname, '..', '..', 'prisma', 'schema.prisma');
|
|
23
|
+
console.log(`[StreamBy] Locating Prisma schema at: ${schemaPath}`);
|
|
24
|
+
console.log('[StreamBy] Pushing Prisma schema to the database...');
|
|
25
|
+
const command = `npx prisma db push --schema="${schemaPath}"`;
|
|
26
|
+
(0, child_process_1.execSync)(command, { stdio: 'inherit' });
|
|
27
|
+
console.log('[StreamBy] Prisma schema pushed successfully.');
|
|
28
|
+
schemaPushed = true;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
console.error('[StreamBy] Failed to push Prisma schema:', error);
|
|
32
|
+
// Optional: decide if the application should exit on failure
|
|
33
|
+
// process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
}
|
package/package.json
CHANGED
|
@@ -1,56 +1,57 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "streamby-core",
|
|
3
|
-
"version": "0.16.
|
|
4
|
-
"description": "StreamBy middleware framework for media storage management",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"dist"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
"@aws-sdk/s3
|
|
34
|
-
"@
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"@types/
|
|
44
|
-
"@types/
|
|
45
|
-
"@types/
|
|
46
|
-
"@types/
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "streamby-core",
|
|
3
|
+
"version": "0.16.2",
|
|
4
|
+
"description": "StreamBy middleware framework for media storage management",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"prisma"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"test": "vitest",
|
|
14
|
+
"dev": "ts-node-dev --respawn --clear dev.ts",
|
|
15
|
+
"prepublishOnly": "npm run build"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/GwerhDev/StreamBy-Package.git"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"streamby",
|
|
23
|
+
"middleware",
|
|
24
|
+
"upload",
|
|
25
|
+
"storage",
|
|
26
|
+
"s3",
|
|
27
|
+
"express",
|
|
28
|
+
"typescript"
|
|
29
|
+
],
|
|
30
|
+
"author": "TerminalCore Labs",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@aws-sdk/client-s3": "^3.528.0",
|
|
34
|
+
"@aws-sdk/s3-request-presigner": "^3.787.0",
|
|
35
|
+
"@prisma/client": "^6.12.0",
|
|
36
|
+
"bcrypt": "^5.1.1",
|
|
37
|
+
"dotenv": "^16.5.0",
|
|
38
|
+
"express": "^4.0.0",
|
|
39
|
+
"mongoose": "^8.13.2",
|
|
40
|
+
"prisma": "^6.12.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/bcrypt": "^5.0.2",
|
|
44
|
+
"@types/cors": "^2.8.18",
|
|
45
|
+
"@types/express": "^4.17.17",
|
|
46
|
+
"@types/node": "^22.15.21",
|
|
47
|
+
"@types/supertest": "^6.0.3",
|
|
48
|
+
"cors": "^2.8.5",
|
|
49
|
+
"supertest": "^7.1.0",
|
|
50
|
+
"ts-node-dev": "^2.0.0",
|
|
51
|
+
"typescript": "^5.8.3",
|
|
52
|
+
"vitest": "^3.1.1"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"express": "^4.0.0"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "streamby"."Project" (
|
|
3
|
+
"id" TEXT NOT NULL,
|
|
4
|
+
"dbType" TEXT NOT NULL,
|
|
5
|
+
"name" TEXT NOT NULL,
|
|
6
|
+
"description" TEXT,
|
|
7
|
+
"image" TEXT,
|
|
8
|
+
"allowUpload" BOOLEAN NOT NULL DEFAULT true,
|
|
9
|
+
"allowSharing" BOOLEAN NOT NULL DEFAULT false,
|
|
10
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
11
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
12
|
+
|
|
13
|
+
CONSTRAINT "Project_pkey" PRIMARY KEY ("id")
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
-- CreateTable
|
|
17
|
+
CREATE TABLE "streamby"."FolderNode" (
|
|
18
|
+
"id" TEXT NOT NULL,
|
|
19
|
+
"name" TEXT NOT NULL,
|
|
20
|
+
"projectId" TEXT NOT NULL,
|
|
21
|
+
"parentId" TEXT,
|
|
22
|
+
|
|
23
|
+
CONSTRAINT "FolderNode_pkey" PRIMARY KEY ("id")
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
-- CreateTable
|
|
27
|
+
CREATE TABLE "streamby"."Member" (
|
|
28
|
+
"id" TEXT NOT NULL,
|
|
29
|
+
"userId" TEXT NOT NULL,
|
|
30
|
+
"role" TEXT NOT NULL,
|
|
31
|
+
"archived" BOOLEAN NOT NULL DEFAULT false,
|
|
32
|
+
"projectId" TEXT NOT NULL,
|
|
33
|
+
|
|
34
|
+
CONSTRAINT "Member_pkey" PRIMARY KEY ("id")
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
-- CreateTable
|
|
38
|
+
CREATE TABLE "streamby"."Export" (
|
|
39
|
+
"id" TEXT NOT NULL,
|
|
40
|
+
"name" TEXT NOT NULL,
|
|
41
|
+
"description" TEXT,
|
|
42
|
+
"collectionName" TEXT NOT NULL,
|
|
43
|
+
"projectId" TEXT NOT NULL,
|
|
44
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
45
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
46
|
+
|
|
47
|
+
CONSTRAINT "Export_pkey" PRIMARY KEY ("id")
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
-- CreateTable
|
|
51
|
+
CREATE TABLE "streamby"."ExportCollection" (
|
|
52
|
+
"id" TEXT NOT NULL,
|
|
53
|
+
"projectId" TEXT NOT NULL,
|
|
54
|
+
"name" TEXT NOT NULL,
|
|
55
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
56
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
57
|
+
|
|
58
|
+
CONSTRAINT "ExportCollection_pkey" PRIMARY KEY ("id")
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
-- CreateTable
|
|
62
|
+
CREATE TABLE "streamby"."ExportEntry" (
|
|
63
|
+
"id" TEXT NOT NULL,
|
|
64
|
+
"key" TEXT NOT NULL,
|
|
65
|
+
"value" TEXT NOT NULL,
|
|
66
|
+
"exportCollectionId" TEXT NOT NULL,
|
|
67
|
+
|
|
68
|
+
CONSTRAINT "ExportEntry_pkey" PRIMARY KEY ("id")
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
-- CreateIndex
|
|
72
|
+
CREATE UNIQUE INDEX "ExportCollection_projectId_name_key" ON "streamby"."ExportCollection"("projectId", "name");
|
|
73
|
+
|
|
74
|
+
-- AddForeignKey
|
|
75
|
+
ALTER TABLE "streamby"."FolderNode" ADD CONSTRAINT "FolderNode_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "streamby"."Project"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
76
|
+
|
|
77
|
+
-- AddForeignKey
|
|
78
|
+
ALTER TABLE "streamby"."FolderNode" ADD CONSTRAINT "FolderNode_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES "streamby"."FolderNode"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
79
|
+
|
|
80
|
+
-- AddForeignKey
|
|
81
|
+
ALTER TABLE "streamby"."Member" ADD CONSTRAINT "Member_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "streamby"."Project"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
82
|
+
|
|
83
|
+
-- AddForeignKey
|
|
84
|
+
ALTER TABLE "streamby"."Export" ADD CONSTRAINT "Export_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "streamby"."Project"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
85
|
+
|
|
86
|
+
-- AddForeignKey
|
|
87
|
+
ALTER TABLE "streamby"."ExportCollection" ADD CONSTRAINT "ExportCollection_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "streamby"."Project"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
88
|
+
|
|
89
|
+
-- AddForeignKey
|
|
90
|
+
ALTER TABLE "streamby"."ExportEntry" ADD CONSTRAINT "ExportEntry_exportCollectionId_fkey" FOREIGN KEY ("exportCollectionId") REFERENCES "streamby"."ExportCollection"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
datasource db {
|
|
2
|
+
provider = "postgresql"
|
|
3
|
+
url = env("PRISMA_STRING")
|
|
4
|
+
schemas = ["streamby"]
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
generator client {
|
|
8
|
+
provider = "prisma-client-js"
|
|
9
|
+
previewFeatures = ["multiSchema"]
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
model Project {
|
|
13
|
+
id String @id @default(uuid())
|
|
14
|
+
dbType String
|
|
15
|
+
name String
|
|
16
|
+
description String?
|
|
17
|
+
image String?
|
|
18
|
+
allowUpload Boolean @default(true)
|
|
19
|
+
allowSharing Boolean @default(false)
|
|
20
|
+
createdAt DateTime @default(now())
|
|
21
|
+
updatedAt DateTime @updatedAt
|
|
22
|
+
folders FolderNode[]
|
|
23
|
+
members Member[]
|
|
24
|
+
exports Export[]
|
|
25
|
+
exportCollections ExportCollection[]
|
|
26
|
+
|
|
27
|
+
@@schema("streamby")
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
model FolderNode {
|
|
31
|
+
id String @id @default(uuid())
|
|
32
|
+
name String
|
|
33
|
+
projectId String
|
|
34
|
+
parentId String?
|
|
35
|
+
project Project @relation(fields: [projectId], references: [id])
|
|
36
|
+
parent FolderNode? @relation("FolderChildren", fields: [parentId], references: [id])
|
|
37
|
+
children FolderNode[] @relation("FolderChildren")
|
|
38
|
+
|
|
39
|
+
@@schema("streamby")
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
model Member {
|
|
43
|
+
id String @id @default(uuid())
|
|
44
|
+
userId String
|
|
45
|
+
role String
|
|
46
|
+
archived Boolean @default(false)
|
|
47
|
+
projectId String
|
|
48
|
+
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
|
|
49
|
+
|
|
50
|
+
@@schema("streamby")
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
model Export {
|
|
54
|
+
id String @id @default(uuid())
|
|
55
|
+
name String
|
|
56
|
+
description String?
|
|
57
|
+
collectionName String
|
|
58
|
+
projectId String
|
|
59
|
+
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
|
|
60
|
+
createdAt DateTime @default(now())
|
|
61
|
+
updatedAt DateTime @updatedAt
|
|
62
|
+
|
|
63
|
+
@@schema("streamby")
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
model ExportCollection {
|
|
67
|
+
id String @id @default(uuid())
|
|
68
|
+
projectId String
|
|
69
|
+
name String
|
|
70
|
+
createdAt DateTime @default(now())
|
|
71
|
+
updatedAt DateTime @updatedAt
|
|
72
|
+
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
|
|
73
|
+
entries ExportEntry[]
|
|
74
|
+
|
|
75
|
+
@@unique([projectId, name])
|
|
76
|
+
@@schema("streamby")
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
model ExportEntry {
|
|
80
|
+
id String @id @default(uuid())
|
|
81
|
+
key String
|
|
82
|
+
value String
|
|
83
|
+
exportCollectionId String
|
|
84
|
+
exportCollection ExportCollection @relation(fields: [exportCollectionId], references: [id])
|
|
85
|
+
|
|
86
|
+
@@schema("streamby")
|
|
87
|
+
}
|