streamby-core 0.16.2 → 0.17.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.
|
@@ -9,12 +9,10 @@ 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");
|
|
13
12
|
function isProjectMember(project, userId) {
|
|
14
13
|
return project.members?.some((m) => m.userId?.toString() === userId?.toString());
|
|
15
14
|
}
|
|
16
15
|
function createStreamByRouter(config) {
|
|
17
|
-
(0, pushPrismaSchema_1.pushPrismaSchema)();
|
|
18
16
|
const router = express_1.default.Router();
|
|
19
17
|
const adapter = config.adapter || (0, createStorageProvider_1.createStorageProvider)(config.storageProviders);
|
|
20
18
|
const projectProviders = {};
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "streamby-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "StreamBy middleware framework for media storage management",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
|
-
"dist"
|
|
9
|
-
"prisma"
|
|
8
|
+
"dist"
|
|
10
9
|
],
|
|
11
10
|
"scripts": {
|
|
12
11
|
"build": "tsc",
|
|
@@ -1,90 +0,0 @@
|
|
|
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;
|
package/prisma/schema.prisma
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
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
|
-
}
|