easywork-common-lib 1.0.8 → 1.0.10
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/entities/drive/file.entity.d.ts +13 -0
- package/dist/entities/drive/file.entity.js +72 -0
- package/dist/entities/drive/file.entity.js.map +1 -0
- package/dist/entities/drive/folder.entity.d.ts +2 -1
- package/dist/entities/drive/folder.entity.js +17 -4
- package/dist/entities/drive/folder.entity.js.map +1 -1
- package/dist/entities/helpers/entity_file.entity.d.ts +10 -0
- package/dist/entities/helpers/entity_file.entity.js +54 -0
- package/dist/entities/helpers/entity_file.entity.js.map +1 -0
- package/package.json +1 -1
- package/src/entities/drive/file.entity.ts +2 -2
- package/src/entities/drive/folder.entity.ts +8 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseEntity } from "../../common/database";
|
|
2
|
+
import { Folder } from "./folder.entity";
|
|
3
|
+
import { EntityFile } from "../helpers/entity_file.entity";
|
|
4
|
+
export declare class File extends BaseEntity {
|
|
5
|
+
name: string;
|
|
6
|
+
folder: Folder;
|
|
7
|
+
url: string;
|
|
8
|
+
size: number;
|
|
9
|
+
mimeType: string;
|
|
10
|
+
s3Key: string;
|
|
11
|
+
isDefault: boolean;
|
|
12
|
+
owners?: EntityFile[];
|
|
13
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
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.File = void 0;
|
|
13
|
+
const database_1 = require("../../common/database");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const typeorm_1 = require("typeorm");
|
|
16
|
+
const folder_entity_1 = require("./folder.entity");
|
|
17
|
+
const entity_file_entity_1 = require("../helpers/entity_file.entity");
|
|
18
|
+
let File = class File extends database_1.BaseEntity {
|
|
19
|
+
name;
|
|
20
|
+
folder;
|
|
21
|
+
url;
|
|
22
|
+
size;
|
|
23
|
+
mimeType;
|
|
24
|
+
s3Key;
|
|
25
|
+
isDefault;
|
|
26
|
+
owners;
|
|
27
|
+
};
|
|
28
|
+
exports.File = File;
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, class_validator_1.MinLength)(1),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], File.prototype, "name", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typeorm_1.OneToMany)(() => folder_entity_1.Folder, (Folder) => Folder.files, {
|
|
35
|
+
onDelete: "CASCADE",
|
|
36
|
+
onUpdate: "CASCADE",
|
|
37
|
+
}),
|
|
38
|
+
(0, typeorm_1.JoinColumn)(),
|
|
39
|
+
__metadata("design:type", folder_entity_1.Folder)
|
|
40
|
+
], File.prototype, "folder", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], File.prototype, "url", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
47
|
+
__metadata("design:type", Number)
|
|
48
|
+
], File.prototype, "size", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, typeorm_1.Column)({ type: "bigint", nullable: true }),
|
|
51
|
+
__metadata("design:type", String)
|
|
52
|
+
], File.prototype, "mimeType", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
55
|
+
__metadata("design:type", String)
|
|
56
|
+
], File.prototype, "s3Key", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, typeorm_1.Column)({ default: false }),
|
|
59
|
+
__metadata("design:type", Boolean)
|
|
60
|
+
], File.prototype, "isDefault", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, typeorm_1.OneToMany)(() => entity_file_entity_1.EntityFile, (EntityFile) => EntityFile.file, {
|
|
63
|
+
onDelete: "CASCADE",
|
|
64
|
+
onUpdate: "CASCADE",
|
|
65
|
+
eager: true,
|
|
66
|
+
}),
|
|
67
|
+
__metadata("design:type", Array)
|
|
68
|
+
], File.prototype, "owners", void 0);
|
|
69
|
+
exports.File = File = __decorate([
|
|
70
|
+
(0, typeorm_1.Entity)()
|
|
71
|
+
], File);
|
|
72
|
+
//# sourceMappingURL=file.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.entity.js","sourceRoot":"","sources":["../../../src/entities/drive/file.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAmD;AACnD,qDAA4C;AAC5C,qCAAgE;AAChE,mDAAyC;AACzC,sEAA2D;AAGpD,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,qBAAU;IAEhC,IAAI,CAAS;IAOb,MAAM,CAAS;IAGf,GAAG,CAAS;IAGZ,IAAI,CAAS;IAGb,QAAQ,CAAS;IAGjB,KAAK,CAAS;IAGd,SAAS,CAAU;IAOnB,MAAM,CAAgB;CACzB,CAAA;AAhCY,oBAAI;AAEb;IADC,IAAA,2BAAS,EAAC,CAAC,CAAC;;kCACA;AAOb;IALC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,sBAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE;QAC/C,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,SAAS;KACtB,CAAC;IACD,IAAA,oBAAU,GAAE;8BACL,sBAAM;oCAAC;AAGf;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iCACf;AAGZ;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kCACd;AAGb;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sCAC1B;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mCACb;AAGd;IADC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;uCACR;AAOnB;IALC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,+BAAU,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE;QAC1D,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,SAAS;QACnB,KAAK,EAAE,IAAI;KACd,CAAC;;oCACoB;eA/Bb,IAAI;IADhB,IAAA,gBAAM,GAAE;GACI,IAAI,CAgChB"}
|
|
@@ -15,7 +15,8 @@ const class_validator_1 = require("class-validator");
|
|
|
15
15
|
const typeorm_1 = require("typeorm");
|
|
16
16
|
let Folder = class Folder extends database_1.BaseEntity {
|
|
17
17
|
name;
|
|
18
|
-
|
|
18
|
+
parent;
|
|
19
|
+
files;
|
|
19
20
|
};
|
|
20
21
|
exports.Folder = Folder;
|
|
21
22
|
__decorate([
|
|
@@ -24,9 +25,21 @@ __decorate([
|
|
|
24
25
|
__metadata("design:type", String)
|
|
25
26
|
], Folder.prototype, "name", void 0);
|
|
26
27
|
__decorate([
|
|
27
|
-
(0, typeorm_1.
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
(0, typeorm_1.OneToOne)(() => Folder, {
|
|
29
|
+
onDelete: "CASCADE",
|
|
30
|
+
onUpdate: "CASCADE",
|
|
31
|
+
}),
|
|
32
|
+
(0, typeorm_1.JoinColumn)(),
|
|
33
|
+
__metadata("design:type", Folder)
|
|
34
|
+
], Folder.prototype, "parent", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.ManyToOne)(() => Folder, {
|
|
37
|
+
onDelete: "CASCADE",
|
|
38
|
+
onUpdate: "CASCADE",
|
|
39
|
+
}),
|
|
40
|
+
(0, typeorm_1.JoinColumn)(),
|
|
41
|
+
__metadata("design:type", Array)
|
|
42
|
+
], Folder.prototype, "files", void 0);
|
|
30
43
|
exports.Folder = Folder = __decorate([
|
|
31
44
|
(0, typeorm_1.Entity)()
|
|
32
45
|
], Folder);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"folder.entity.js","sourceRoot":"","sources":["../../../src/entities/drive/folder.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAmD;AACnD,qDAA4C;AAC5C,
|
|
1
|
+
{"version":3,"file":"folder.entity.js","sourceRoot":"","sources":["../../../src/entities/drive/folder.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAmD;AACnD,qDAA4C;AAC5C,qCAA0E;AAGnE,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,qBAAU;IAGlC,IAAI,CAAS;IAOb,MAAM,CAAS;IAOf,KAAK,CAAW;CACnB,CAAA;AAlBY,wBAAM;AAGf;IAFC,IAAA,2BAAS,EAAC,CAAC,CAAC;IACZ,IAAA,gBAAM,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;oCACZ;AAOb;IALC,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE;QACpB,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,SAAS;KACtB,CAAC;IACD,IAAA,oBAAU,GAAE;8BACL,MAAM;sCAAC;AAOf;IALC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,MAAM,EAAE;QACrB,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,SAAS;KACtB,CAAC;IACD,IAAA,oBAAU,GAAE;;qCACG;iBAjBP,MAAM;IADlB,IAAA,gBAAM,GAAE;GACI,MAAM,CAkBlB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
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.EntityFile = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const file_entity_1 = require("../drive/file.entity");
|
|
15
|
+
let EntityFile = class EntityFile extends typeorm_1.BaseEntity {
|
|
16
|
+
id;
|
|
17
|
+
entityId;
|
|
18
|
+
entityType;
|
|
19
|
+
fileId;
|
|
20
|
+
relation;
|
|
21
|
+
file;
|
|
22
|
+
};
|
|
23
|
+
exports.EntityFile = EntityFile;
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typeorm_1.PrimaryGeneratedColumn)("uuid"),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], EntityFile.prototype, "id", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, typeorm_1.Column)("uuid"),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], EntityFile.prototype, "entityId", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, typeorm_1.Column)(),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], EntityFile.prototype, "entityType", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typeorm_1.Column)(),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], EntityFile.prototype, "fileId", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], EntityFile.prototype, "relation", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typeorm_1.ManyToOne)(() => file_entity_1.File, file => file.owners, {
|
|
46
|
+
onDelete: "CASCADE",
|
|
47
|
+
onUpdate: "CASCADE",
|
|
48
|
+
}),
|
|
49
|
+
__metadata("design:type", file_entity_1.File)
|
|
50
|
+
], EntityFile.prototype, "file", void 0);
|
|
51
|
+
exports.EntityFile = EntityFile = __decorate([
|
|
52
|
+
(0, typeorm_1.Entity)()
|
|
53
|
+
], EntityFile);
|
|
54
|
+
//# sourceMappingURL=entity_file.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity_file.entity.js","sourceRoot":"","sources":["../../../src/entities/helpers/entity_file.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAwF;AACxF,sDAA4C;AAGrC,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,oBAAU;IAExC,EAAE,CAAS;IAGX,QAAQ,CAAS;IAGjB,UAAU,CAAS;IAGnB,MAAM,CAAS;IAGf,QAAQ,CAAS;IAMV,IAAI,CAAO;CACnB,CAAA;AArBY,gCAAU;AAErB;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;sCACpB;AAGX;IADC,IAAA,gBAAM,EAAC,MAAM,CAAC;;4CACE;AAGjB;IADC,IAAA,gBAAM,GAAE;;8CACU;AAGnB;IADC,IAAA,gBAAM,GAAE;;0CACM;AAGf;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACV;AAMV;IAJN,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,kBAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE;QAC1C,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,SAAS;KACpB,CAAC;8BACW,kBAAI;wCAAC;qBApBP,UAAU;IADtB,IAAA,gBAAM,GAAE;GACI,UAAU,CAqBtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseEntity } from "../../common/database";
|
|
2
2
|
import { MinLength } from "class-validator";
|
|
3
|
-
import { Column, Entity, JoinColumn, OneToMany
|
|
3
|
+
import { Column, Entity, JoinColumn, OneToMany } from "typeorm";
|
|
4
4
|
import { Folder } from "./folder.entity";
|
|
5
5
|
import { EntityFile } from "../helpers/entity_file.entity";
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ export class File extends BaseEntity {
|
|
|
9
9
|
@MinLength(1)
|
|
10
10
|
name: string;
|
|
11
11
|
|
|
12
|
-
@
|
|
12
|
+
@OneToMany(() => Folder, (Folder) => Folder.files, {
|
|
13
13
|
onDelete: "CASCADE",
|
|
14
14
|
onUpdate: "CASCADE",
|
|
15
15
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseEntity } from "../../common/database";
|
|
2
2
|
import { MinLength } from "class-validator";
|
|
3
|
-
import { Column, Entity, JoinColumn, OneToOne } from "typeorm";
|
|
3
|
+
import { Column, Entity, JoinColumn, ManyToOne, OneToOne } from "typeorm";
|
|
4
4
|
|
|
5
5
|
@Entity()
|
|
6
6
|
export class Folder extends BaseEntity {
|
|
@@ -14,4 +14,11 @@ export class Folder extends BaseEntity {
|
|
|
14
14
|
})
|
|
15
15
|
@JoinColumn()
|
|
16
16
|
parent: Folder;
|
|
17
|
+
|
|
18
|
+
@ManyToOne(() => Folder, {
|
|
19
|
+
onDelete: "CASCADE",
|
|
20
|
+
onUpdate: "CASCADE",
|
|
21
|
+
})
|
|
22
|
+
@JoinColumn()
|
|
23
|
+
files: Folder[];
|
|
17
24
|
}
|