@ntalmagor/3drise-common 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/build/database.d.ts +3 -0
- package/build/database.js +33 -0
- package/build/errors/bad-request-error.d.ts +9 -0
- package/build/errors/bad-request-error.js +16 -0
- package/build/errors/custom-error.d.ts +8 -0
- package/build/errors/custom-error.js +10 -0
- package/build/errors/database-connection-error.d.ts +9 -0
- package/build/errors/database-connection-error.js +16 -0
- package/build/errors/not-authorized-error.d.ts +8 -0
- package/build/errors/not-authorized-error.js +15 -0
- package/build/errors/not-found-error.d.ts +8 -0
- package/build/errors/not-found-error.js +15 -0
- package/build/errors/request-validation-error.d.ts +14 -0
- package/build/errors/request-validation-error.js +22 -0
- package/build/events/base-listener.d.ts +18 -0
- package/build/events/base-listener.js +32 -0
- package/build/events/base-publisher.d.ts +13 -0
- package/build/events/base-publisher.js +20 -0
- package/build/events/subjects.d.ts +9 -0
- package/build/events/subjects.js +13 -0
- package/build/events/types/order-status.d.ts +6 -0
- package/build/events/types/order-status.js +18 -0
- package/build/events/types/upload-status.d.ts +18 -0
- package/build/events/types/upload-status.js +22 -0
- package/build/events/upload-complete-event.d.ts +9 -0
- package/build/events/upload-complete-event.js +2 -0
- package/build/index.d.ts +24 -0
- package/build/index.js +48 -0
- package/build/middlewares/current-user.d.ts +16 -0
- package/build/middlewares/current-user.js +26 -0
- package/build/middlewares/error-handler.d.ts +2 -0
- package/build/middlewares/error-handler.js +14 -0
- package/build/middlewares/require-auth.d.ts +2 -0
- package/build/middlewares/require-auth.js +11 -0
- package/build/middlewares/validate-request.d.ts +2 -0
- package/build/middlewares/validate-request.js +13 -0
- package/build/models/Asset.d.ts +52 -0
- package/build/models/Asset.js +133 -0
- package/build/models/Project.d.ts +27 -0
- package/build/models/Project.js +106 -0
- package/build/models/ProjectAsset.d.ts +12 -0
- package/build/models/ProjectAsset.js +58 -0
- package/build/models/ProjectDependency.d.ts +11 -0
- package/build/models/ProjectDependency.js +57 -0
- package/build/models/Transaction.d.ts +22 -0
- package/build/models/Transaction.js +92 -0
- package/build/models/User.d.ts +17 -0
- package/build/models/User.js +79 -0
- package/build/models/UserAsset.d.ts +13 -0
- package/build/models/UserAsset.js +62 -0
- package/build/models/index.d.ts +15 -0
- package/build/models/index.js +54 -0
- package/build/utils/redis.d.ts +0 -0
- package/build/utils/redis.js +1 -0
- package/build/utils/redisClient.d.ts +4 -0
- package/build/utils/redisClient.js +22 -0
- package/build/utils/storage.d.ts +16 -0
- package/build/utils/storage.js +102 -0
- package/build/utils/types.d.ts +10 -0
- package/build/utils/types.js +2 -0
- package/package.json +45 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Asset = exports.AssetPrivacy = exports.AssetType = void 0;
|
|
13
|
+
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
14
|
+
const User_1 = require("./User");
|
|
15
|
+
const Project_1 = require("./Project");
|
|
16
|
+
const UserAsset_1 = require("./UserAsset");
|
|
17
|
+
const ProjectAsset_1 = require("./ProjectAsset");
|
|
18
|
+
var AssetType;
|
|
19
|
+
(function (AssetType) {
|
|
20
|
+
AssetType["MODEL"] = "model";
|
|
21
|
+
AssetType["TEXTURE"] = "texture";
|
|
22
|
+
AssetType["AUDIO"] = "audio";
|
|
23
|
+
AssetType["MATERIAL"] = "material";
|
|
24
|
+
AssetType["IMAGE"] = "image";
|
|
25
|
+
AssetType["UI_TEMPLATE"] = "ui_template";
|
|
26
|
+
AssetType["GALLERY"] = "gallery";
|
|
27
|
+
AssetType["HDR"] = "hdr";
|
|
28
|
+
AssetType["ANIMATION"] = "animation";
|
|
29
|
+
})(AssetType || (exports.AssetType = AssetType = {}));
|
|
30
|
+
var AssetPrivacy;
|
|
31
|
+
(function (AssetPrivacy) {
|
|
32
|
+
AssetPrivacy["PUBLIC"] = "public";
|
|
33
|
+
AssetPrivacy["PRIVATE"] = "private";
|
|
34
|
+
})(AssetPrivacy || (exports.AssetPrivacy = AssetPrivacy = {}));
|
|
35
|
+
let Asset = class Asset extends sequelize_typescript_1.Model {
|
|
36
|
+
};
|
|
37
|
+
exports.Asset = Asset;
|
|
38
|
+
__decorate([
|
|
39
|
+
sequelize_typescript_1.PrimaryKey,
|
|
40
|
+
(0, sequelize_typescript_1.Default)(sequelize_typescript_1.DataType.UUIDV4),
|
|
41
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.UUID),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], Asset.prototype, "id", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, sequelize_typescript_1.AllowNull)(false),
|
|
46
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.STRING(255)),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], Asset.prototype, "name", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, sequelize_typescript_1.AllowNull)(false),
|
|
51
|
+
(0, sequelize_typescript_1.Column)({
|
|
52
|
+
type: sequelize_typescript_1.DataType.ENUM(...Object.values(AssetType)),
|
|
53
|
+
}),
|
|
54
|
+
__metadata("design:type", String)
|
|
55
|
+
], Asset.prototype, "type", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, sequelize_typescript_1.AllowNull)(true),
|
|
58
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.TEXT),
|
|
59
|
+
__metadata("design:type", String)
|
|
60
|
+
], Asset.prototype, "url", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, sequelize_typescript_1.ForeignKey)(() => User_1.User),
|
|
63
|
+
(0, sequelize_typescript_1.AllowNull)(false),
|
|
64
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.UUID),
|
|
65
|
+
__metadata("design:type", String)
|
|
66
|
+
], Asset.prototype, "creatorId", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.DECIMAL(10, 2)),
|
|
69
|
+
__metadata("design:type", Number)
|
|
70
|
+
], Asset.prototype, "price", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, sequelize_typescript_1.Column)({
|
|
73
|
+
type: sequelize_typescript_1.DataType.ENUM(...Object.values(AssetPrivacy)),
|
|
74
|
+
defaultValue: AssetPrivacy.PUBLIC,
|
|
75
|
+
}),
|
|
76
|
+
__metadata("design:type", String)
|
|
77
|
+
], Asset.prototype, "privacy", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.TEXT),
|
|
80
|
+
__metadata("design:type", String)
|
|
81
|
+
], Asset.prototype, "description", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, sequelize_typescript_1.AllowNull)(true),
|
|
84
|
+
(0, sequelize_typescript_1.Default)(null),
|
|
85
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.TEXT),
|
|
86
|
+
__metadata("design:type", String)
|
|
87
|
+
], Asset.prototype, "vertex", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, sequelize_typescript_1.AllowNull)(true),
|
|
90
|
+
(0, sequelize_typescript_1.Default)(null),
|
|
91
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.TEXT),
|
|
92
|
+
__metadata("design:type", String)
|
|
93
|
+
], Asset.prototype, "fragment", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
(0, sequelize_typescript_1.AllowNull)(true),
|
|
96
|
+
(0, sequelize_typescript_1.Default)(null),
|
|
97
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.JSON),
|
|
98
|
+
__metadata("design:type", Object)
|
|
99
|
+
], Asset.prototype, "uniforms", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
(0, sequelize_typescript_1.AllowNull)(true),
|
|
102
|
+
(0, sequelize_typescript_1.Default)(null),
|
|
103
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.JSON),
|
|
104
|
+
__metadata("design:type", Array)
|
|
105
|
+
], Asset.prototype, "settings", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
sequelize_typescript_1.CreatedAt,
|
|
108
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.DATE),
|
|
109
|
+
__metadata("design:type", Date)
|
|
110
|
+
], Asset.prototype, "createdAt", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
sequelize_typescript_1.UpdatedAt,
|
|
113
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.DATE),
|
|
114
|
+
__metadata("design:type", Date)
|
|
115
|
+
], Asset.prototype, "updatedAt", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
(0, sequelize_typescript_1.BelongsTo)(() => User_1.User, 'creatorId'),
|
|
118
|
+
__metadata("design:type", User_1.User)
|
|
119
|
+
], Asset.prototype, "creator", void 0);
|
|
120
|
+
__decorate([
|
|
121
|
+
(0, sequelize_typescript_1.BelongsToMany)(() => User_1.User, () => UserAsset_1.UserAsset),
|
|
122
|
+
__metadata("design:type", Array)
|
|
123
|
+
], Asset.prototype, "owners", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
(0, sequelize_typescript_1.BelongsToMany)(() => Project_1.Project, () => ProjectAsset_1.ProjectAsset),
|
|
126
|
+
__metadata("design:type", Array)
|
|
127
|
+
], Asset.prototype, "projects", void 0);
|
|
128
|
+
exports.Asset = Asset = __decorate([
|
|
129
|
+
(0, sequelize_typescript_1.Table)({
|
|
130
|
+
tableName: 'assets',
|
|
131
|
+
timestamps: true,
|
|
132
|
+
})
|
|
133
|
+
], Asset);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Model } from 'sequelize-typescript';
|
|
2
|
+
import { User } from './User';
|
|
3
|
+
import { ProjectDependency } from './ProjectDependency';
|
|
4
|
+
import { Transaction } from './Transaction';
|
|
5
|
+
import { Asset } from './Asset';
|
|
6
|
+
export declare enum ProjectStatus {
|
|
7
|
+
ACTIVE = "active",
|
|
8
|
+
INACTIVE = "inactive"
|
|
9
|
+
}
|
|
10
|
+
export declare class Project extends Model {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
settings?: object;
|
|
15
|
+
sceneSettings?: object;
|
|
16
|
+
uiSettings?: object;
|
|
17
|
+
userId: string;
|
|
18
|
+
price?: number;
|
|
19
|
+
status: ProjectStatus;
|
|
20
|
+
createdAt: Date;
|
|
21
|
+
updatedAt: Date;
|
|
22
|
+
owner: User;
|
|
23
|
+
dependencies: ProjectDependency[];
|
|
24
|
+
dependentProjects: ProjectDependency[];
|
|
25
|
+
transactions: Transaction[];
|
|
26
|
+
assets: Asset[];
|
|
27
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Project = exports.ProjectStatus = void 0;
|
|
13
|
+
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
14
|
+
const User_1 = require("./User");
|
|
15
|
+
const ProjectDependency_1 = require("./ProjectDependency");
|
|
16
|
+
const Transaction_1 = require("./Transaction");
|
|
17
|
+
const Asset_1 = require("./Asset");
|
|
18
|
+
const ProjectAsset_1 = require("./ProjectAsset");
|
|
19
|
+
var ProjectStatus;
|
|
20
|
+
(function (ProjectStatus) {
|
|
21
|
+
ProjectStatus["ACTIVE"] = "active";
|
|
22
|
+
ProjectStatus["INACTIVE"] = "inactive";
|
|
23
|
+
})(ProjectStatus || (exports.ProjectStatus = ProjectStatus = {}));
|
|
24
|
+
let Project = class Project extends sequelize_typescript_1.Model {
|
|
25
|
+
};
|
|
26
|
+
exports.Project = Project;
|
|
27
|
+
__decorate([
|
|
28
|
+
sequelize_typescript_1.PrimaryKey,
|
|
29
|
+
(0, sequelize_typescript_1.Default)(sequelize_typescript_1.DataType.UUIDV4),
|
|
30
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.UUID),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], Project.prototype, "id", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, sequelize_typescript_1.AllowNull)(false),
|
|
35
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.STRING(255)),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], Project.prototype, "name", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.TEXT),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], Project.prototype, "description", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.JSON),
|
|
44
|
+
__metadata("design:type", Object)
|
|
45
|
+
], Project.prototype, "settings", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.JSON),
|
|
48
|
+
__metadata("design:type", Object)
|
|
49
|
+
], Project.prototype, "sceneSettings", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.JSON),
|
|
52
|
+
__metadata("design:type", Object)
|
|
53
|
+
], Project.prototype, "uiSettings", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, sequelize_typescript_1.ForeignKey)(() => User_1.User),
|
|
56
|
+
(0, sequelize_typescript_1.AllowNull)(false),
|
|
57
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.UUID),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], Project.prototype, "userId", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.DECIMAL(10, 2)),
|
|
62
|
+
__metadata("design:type", Number)
|
|
63
|
+
], Project.prototype, "price", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, sequelize_typescript_1.Column)({
|
|
66
|
+
type: sequelize_typescript_1.DataType.ENUM(...Object.values(ProjectStatus)),
|
|
67
|
+
defaultValue: ProjectStatus.ACTIVE,
|
|
68
|
+
}),
|
|
69
|
+
__metadata("design:type", String)
|
|
70
|
+
], Project.prototype, "status", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
sequelize_typescript_1.CreatedAt,
|
|
73
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.DATE),
|
|
74
|
+
__metadata("design:type", Date)
|
|
75
|
+
], Project.prototype, "createdAt", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
sequelize_typescript_1.UpdatedAt,
|
|
78
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.DATE),
|
|
79
|
+
__metadata("design:type", Date)
|
|
80
|
+
], Project.prototype, "updatedAt", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
(0, sequelize_typescript_1.BelongsTo)(() => User_1.User),
|
|
83
|
+
__metadata("design:type", User_1.User)
|
|
84
|
+
], Project.prototype, "owner", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
(0, sequelize_typescript_1.HasMany)(() => ProjectDependency_1.ProjectDependency, 'projectId'),
|
|
87
|
+
__metadata("design:type", Array)
|
|
88
|
+
], Project.prototype, "dependencies", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
(0, sequelize_typescript_1.HasMany)(() => ProjectDependency_1.ProjectDependency, 'dependentProjectId'),
|
|
91
|
+
__metadata("design:type", Array)
|
|
92
|
+
], Project.prototype, "dependentProjects", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, sequelize_typescript_1.HasMany)(() => Transaction_1.Transaction),
|
|
95
|
+
__metadata("design:type", Array)
|
|
96
|
+
], Project.prototype, "transactions", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
(0, sequelize_typescript_1.BelongsToMany)(() => Asset_1.Asset, () => ProjectAsset_1.ProjectAsset),
|
|
99
|
+
__metadata("design:type", Array)
|
|
100
|
+
], Project.prototype, "assets", void 0);
|
|
101
|
+
exports.Project = Project = __decorate([
|
|
102
|
+
(0, sequelize_typescript_1.Table)({
|
|
103
|
+
tableName: 'projects',
|
|
104
|
+
timestamps: true,
|
|
105
|
+
})
|
|
106
|
+
], Project);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Model } from 'sequelize-typescript';
|
|
2
|
+
import { Project } from './Project';
|
|
3
|
+
import { Asset } from './Asset';
|
|
4
|
+
export declare class ProjectAsset extends Model {
|
|
5
|
+
id: string;
|
|
6
|
+
projectId: string;
|
|
7
|
+
assetId: string;
|
|
8
|
+
createdAt: Date;
|
|
9
|
+
updatedAt: Date;
|
|
10
|
+
project: Project;
|
|
11
|
+
asset: Asset;
|
|
12
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ProjectAsset = void 0;
|
|
13
|
+
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
14
|
+
const Project_1 = require("./Project");
|
|
15
|
+
const Asset_1 = require("./Asset");
|
|
16
|
+
let ProjectAsset = class ProjectAsset extends sequelize_typescript_1.Model {
|
|
17
|
+
};
|
|
18
|
+
exports.ProjectAsset = ProjectAsset;
|
|
19
|
+
__decorate([
|
|
20
|
+
sequelize_typescript_1.PrimaryKey,
|
|
21
|
+
(0, sequelize_typescript_1.Default)(sequelize_typescript_1.DataType.UUIDV4),
|
|
22
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.UUID),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], ProjectAsset.prototype, "id", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, sequelize_typescript_1.ForeignKey)(() => Project_1.Project),
|
|
27
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.UUID),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], ProjectAsset.prototype, "projectId", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, sequelize_typescript_1.ForeignKey)(() => Asset_1.Asset),
|
|
32
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.UUID),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], ProjectAsset.prototype, "assetId", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
sequelize_typescript_1.CreatedAt,
|
|
37
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.DATE),
|
|
38
|
+
__metadata("design:type", Date)
|
|
39
|
+
], ProjectAsset.prototype, "createdAt", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
sequelize_typescript_1.UpdatedAt,
|
|
42
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.DATE),
|
|
43
|
+
__metadata("design:type", Date)
|
|
44
|
+
], ProjectAsset.prototype, "updatedAt", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, sequelize_typescript_1.BelongsTo)(() => Project_1.Project),
|
|
47
|
+
__metadata("design:type", Project_1.Project)
|
|
48
|
+
], ProjectAsset.prototype, "project", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, sequelize_typescript_1.BelongsTo)(() => Asset_1.Asset),
|
|
51
|
+
__metadata("design:type", Asset_1.Asset)
|
|
52
|
+
], ProjectAsset.prototype, "asset", void 0);
|
|
53
|
+
exports.ProjectAsset = ProjectAsset = __decorate([
|
|
54
|
+
(0, sequelize_typescript_1.Table)({
|
|
55
|
+
tableName: 'project_assets',
|
|
56
|
+
timestamps: true,
|
|
57
|
+
})
|
|
58
|
+
], ProjectAsset);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Model } from 'sequelize-typescript';
|
|
2
|
+
import { Project } from './Project';
|
|
3
|
+
export declare class ProjectDependency extends Model {
|
|
4
|
+
id: string;
|
|
5
|
+
projectId: string;
|
|
6
|
+
dependentProjectId: string;
|
|
7
|
+
createdAt: Date;
|
|
8
|
+
updatedAt: Date;
|
|
9
|
+
project: Project;
|
|
10
|
+
dependentProject: Project;
|
|
11
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ProjectDependency = void 0;
|
|
13
|
+
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
14
|
+
const Project_1 = require("./Project");
|
|
15
|
+
let ProjectDependency = class ProjectDependency extends sequelize_typescript_1.Model {
|
|
16
|
+
};
|
|
17
|
+
exports.ProjectDependency = ProjectDependency;
|
|
18
|
+
__decorate([
|
|
19
|
+
sequelize_typescript_1.PrimaryKey,
|
|
20
|
+
(0, sequelize_typescript_1.Default)(sequelize_typescript_1.DataType.UUIDV4),
|
|
21
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.UUID),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], ProjectDependency.prototype, "id", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, sequelize_typescript_1.ForeignKey)(() => Project_1.Project),
|
|
26
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.UUID),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], ProjectDependency.prototype, "projectId", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, sequelize_typescript_1.ForeignKey)(() => Project_1.Project),
|
|
31
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.UUID),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], ProjectDependency.prototype, "dependentProjectId", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
sequelize_typescript_1.CreatedAt,
|
|
36
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.DATE),
|
|
37
|
+
__metadata("design:type", Date)
|
|
38
|
+
], ProjectDependency.prototype, "createdAt", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
sequelize_typescript_1.UpdatedAt,
|
|
41
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.DATE),
|
|
42
|
+
__metadata("design:type", Date)
|
|
43
|
+
], ProjectDependency.prototype, "updatedAt", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, sequelize_typescript_1.BelongsTo)(() => Project_1.Project, 'projectId'),
|
|
46
|
+
__metadata("design:type", Project_1.Project)
|
|
47
|
+
], ProjectDependency.prototype, "project", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, sequelize_typescript_1.BelongsTo)(() => Project_1.Project, 'dependentProjectId'),
|
|
50
|
+
__metadata("design:type", Project_1.Project)
|
|
51
|
+
], ProjectDependency.prototype, "dependentProject", void 0);
|
|
52
|
+
exports.ProjectDependency = ProjectDependency = __decorate([
|
|
53
|
+
(0, sequelize_typescript_1.Table)({
|
|
54
|
+
tableName: 'project_dependencies',
|
|
55
|
+
timestamps: true,
|
|
56
|
+
})
|
|
57
|
+
], ProjectDependency);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Model } from 'sequelize-typescript';
|
|
2
|
+
import { User } from './User';
|
|
3
|
+
import { Project } from './Project';
|
|
4
|
+
export declare enum TransactionStatus {
|
|
5
|
+
PENDING = "pending",
|
|
6
|
+
COMPLETED = "completed",
|
|
7
|
+
FAILED = "failed"
|
|
8
|
+
}
|
|
9
|
+
export declare class Transaction extends Model {
|
|
10
|
+
id: string;
|
|
11
|
+
projectId: string;
|
|
12
|
+
buyerId: string;
|
|
13
|
+
sellerId: string;
|
|
14
|
+
price: number;
|
|
15
|
+
status: TransactionStatus;
|
|
16
|
+
transactionDate?: Date;
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
updatedAt: Date;
|
|
19
|
+
project: Project;
|
|
20
|
+
buyer: User;
|
|
21
|
+
seller: User;
|
|
22
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Transaction = exports.TransactionStatus = void 0;
|
|
13
|
+
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
14
|
+
const User_1 = require("./User");
|
|
15
|
+
const Project_1 = require("./Project");
|
|
16
|
+
var TransactionStatus;
|
|
17
|
+
(function (TransactionStatus) {
|
|
18
|
+
TransactionStatus["PENDING"] = "pending";
|
|
19
|
+
TransactionStatus["COMPLETED"] = "completed";
|
|
20
|
+
TransactionStatus["FAILED"] = "failed";
|
|
21
|
+
})(TransactionStatus || (exports.TransactionStatus = TransactionStatus = {}));
|
|
22
|
+
let Transaction = class Transaction extends sequelize_typescript_1.Model {
|
|
23
|
+
};
|
|
24
|
+
exports.Transaction = Transaction;
|
|
25
|
+
__decorate([
|
|
26
|
+
sequelize_typescript_1.PrimaryKey,
|
|
27
|
+
(0, sequelize_typescript_1.Default)(sequelize_typescript_1.DataType.UUIDV4),
|
|
28
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.UUID),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], Transaction.prototype, "id", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, sequelize_typescript_1.ForeignKey)(() => Project_1.Project),
|
|
33
|
+
(0, sequelize_typescript_1.AllowNull)(false),
|
|
34
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.UUID),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], Transaction.prototype, "projectId", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, sequelize_typescript_1.ForeignKey)(() => User_1.User),
|
|
39
|
+
(0, sequelize_typescript_1.AllowNull)(false),
|
|
40
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.UUID),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], Transaction.prototype, "buyerId", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, sequelize_typescript_1.ForeignKey)(() => User_1.User),
|
|
45
|
+
(0, sequelize_typescript_1.AllowNull)(false),
|
|
46
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.UUID),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], Transaction.prototype, "sellerId", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, sequelize_typescript_1.AllowNull)(false),
|
|
51
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.DECIMAL(10, 2)),
|
|
52
|
+
__metadata("design:type", Number)
|
|
53
|
+
], Transaction.prototype, "price", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, sequelize_typescript_1.Column)({
|
|
56
|
+
type: sequelize_typescript_1.DataType.ENUM(...Object.values(TransactionStatus)),
|
|
57
|
+
defaultValue: TransactionStatus.PENDING,
|
|
58
|
+
}),
|
|
59
|
+
__metadata("design:type", String)
|
|
60
|
+
], Transaction.prototype, "status", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.DATE),
|
|
63
|
+
__metadata("design:type", Date)
|
|
64
|
+
], Transaction.prototype, "transactionDate", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
sequelize_typescript_1.CreatedAt,
|
|
67
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.DATE),
|
|
68
|
+
__metadata("design:type", Date)
|
|
69
|
+
], Transaction.prototype, "createdAt", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
sequelize_typescript_1.UpdatedAt,
|
|
72
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.DATE),
|
|
73
|
+
__metadata("design:type", Date)
|
|
74
|
+
], Transaction.prototype, "updatedAt", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, sequelize_typescript_1.BelongsTo)(() => Project_1.Project),
|
|
77
|
+
__metadata("design:type", Project_1.Project)
|
|
78
|
+
], Transaction.prototype, "project", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, sequelize_typescript_1.BelongsTo)(() => User_1.User, 'buyerId'),
|
|
81
|
+
__metadata("design:type", User_1.User)
|
|
82
|
+
], Transaction.prototype, "buyer", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, sequelize_typescript_1.BelongsTo)(() => User_1.User, 'sellerId'),
|
|
85
|
+
__metadata("design:type", User_1.User)
|
|
86
|
+
], Transaction.prototype, "seller", void 0);
|
|
87
|
+
exports.Transaction = Transaction = __decorate([
|
|
88
|
+
(0, sequelize_typescript_1.Table)({
|
|
89
|
+
tableName: 'transactions',
|
|
90
|
+
timestamps: true,
|
|
91
|
+
})
|
|
92
|
+
], Transaction);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Model } from 'sequelize-typescript';
|
|
2
|
+
import { Project } from './Project';
|
|
3
|
+
import { Transaction } from './Transaction';
|
|
4
|
+
import { Asset } from './Asset';
|
|
5
|
+
export declare class User extends Model {
|
|
6
|
+
id: string;
|
|
7
|
+
userName: string;
|
|
8
|
+
email: string;
|
|
9
|
+
password: string;
|
|
10
|
+
createdAt: Date;
|
|
11
|
+
updatedAt: Date;
|
|
12
|
+
projects: Project[];
|
|
13
|
+
purchasedTransactions: Transaction[];
|
|
14
|
+
soldTransactions: Transaction[];
|
|
15
|
+
createdAssets: Asset[];
|
|
16
|
+
ownedAssets: Asset[];
|
|
17
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.User = void 0;
|
|
13
|
+
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
14
|
+
const Project_1 = require("./Project");
|
|
15
|
+
const Transaction_1 = require("./Transaction");
|
|
16
|
+
const Asset_1 = require("./Asset");
|
|
17
|
+
const UserAsset_1 = require("./UserAsset");
|
|
18
|
+
let User = class User extends sequelize_typescript_1.Model {
|
|
19
|
+
};
|
|
20
|
+
exports.User = User;
|
|
21
|
+
__decorate([
|
|
22
|
+
sequelize_typescript_1.PrimaryKey,
|
|
23
|
+
(0, sequelize_typescript_1.Default)(sequelize_typescript_1.DataType.UUIDV4),
|
|
24
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.UUID),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], User.prototype, "id", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
sequelize_typescript_1.Unique,
|
|
29
|
+
(0, sequelize_typescript_1.AllowNull)(false),
|
|
30
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.STRING(100)),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], User.prototype, "userName", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
sequelize_typescript_1.Unique,
|
|
35
|
+
(0, sequelize_typescript_1.AllowNull)(false),
|
|
36
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.STRING(255)),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], User.prototype, "email", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, sequelize_typescript_1.AllowNull)(false),
|
|
41
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.STRING(255)),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], User.prototype, "password", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
sequelize_typescript_1.CreatedAt,
|
|
46
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.DATE),
|
|
47
|
+
__metadata("design:type", Date)
|
|
48
|
+
], User.prototype, "createdAt", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
sequelize_typescript_1.UpdatedAt,
|
|
51
|
+
(0, sequelize_typescript_1.Column)(sequelize_typescript_1.DataType.DATE),
|
|
52
|
+
__metadata("design:type", Date)
|
|
53
|
+
], User.prototype, "updatedAt", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, sequelize_typescript_1.HasMany)(() => Project_1.Project),
|
|
56
|
+
__metadata("design:type", Array)
|
|
57
|
+
], User.prototype, "projects", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, sequelize_typescript_1.HasMany)(() => Transaction_1.Transaction, 'buyerId'),
|
|
60
|
+
__metadata("design:type", Array)
|
|
61
|
+
], User.prototype, "purchasedTransactions", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, sequelize_typescript_1.HasMany)(() => Transaction_1.Transaction, 'sellerId'),
|
|
64
|
+
__metadata("design:type", Array)
|
|
65
|
+
], User.prototype, "soldTransactions", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, sequelize_typescript_1.HasMany)(() => Asset_1.Asset, 'creatorId'),
|
|
68
|
+
__metadata("design:type", Array)
|
|
69
|
+
], User.prototype, "createdAssets", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, sequelize_typescript_1.BelongsToMany)(() => Asset_1.Asset, () => UserAsset_1.UserAsset),
|
|
72
|
+
__metadata("design:type", Array)
|
|
73
|
+
], User.prototype, "ownedAssets", void 0);
|
|
74
|
+
exports.User = User = __decorate([
|
|
75
|
+
(0, sequelize_typescript_1.Table)({
|
|
76
|
+
tableName: 'users',
|
|
77
|
+
timestamps: true,
|
|
78
|
+
})
|
|
79
|
+
], User);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Model } from 'sequelize-typescript';
|
|
2
|
+
import { User } from './User';
|
|
3
|
+
import { Asset } from './Asset';
|
|
4
|
+
export declare class UserAsset extends Model {
|
|
5
|
+
id: string;
|
|
6
|
+
userId: string;
|
|
7
|
+
assetId: string;
|
|
8
|
+
acquiredAt: Date;
|
|
9
|
+
createdAt: Date;
|
|
10
|
+
updatedAt: Date;
|
|
11
|
+
user: User;
|
|
12
|
+
asset: Asset;
|
|
13
|
+
}
|