dl-commons 0.0.2-testing.3 → 0.0.2-testing.5
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/index.d.ts +4 -1
- package/dist/index.js +20 -2
- package/dist/index.js.map +1 -1
- package/dist/models/enums/s3.enum.d.ts +11 -0
- package/dist/models/enums/s3.enum.js +17 -0
- package/dist/models/enums/s3.enum.js.map +1 -0
- package/dist/models/interfaces/s3.interface.d.ts +38 -0
- package/dist/models/interfaces/s3.interface.js +3 -0
- package/dist/models/interfaces/s3.interface.js.map +1 -0
- package/dist/models/schemas/embedded/group-session.schema.js +1 -1
- package/dist/models/schemas/embedded/s3.schema.d.ts +109 -0
- package/dist/models/schemas/embedded/s3.schema.js +153 -0
- package/dist/models/schemas/embedded/s3.schema.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/index.ts +55 -0
- package/src/models/enums/s3.enum.ts +12 -0
- package/src/models/interfaces/s3.interface.ts +45 -0
- package/src/models/schemas/embedded/group-session.schema.ts +1 -1
- package/src/models/schemas/embedded/s3.schema.ts +107 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -72,6 +72,31 @@ import { TeacherSchema, TeacherDocument, Teacher } from './models/schemas/embedd
|
|
|
72
72
|
import { ISMTPAPIConfig } from './models/interfaces/smtp-api-config.interface';
|
|
73
73
|
import { SMTPService } from './services/smtp.service';
|
|
74
74
|
import { Time, TimeDocument, TimeSchema } from './models/schemas/embedded/time.schema';
|
|
75
|
+
import { FileLogInitType, S3FileState } from './models/enums/s3.enum';
|
|
76
|
+
import { IS3, ILogInitiator, IS3File, IFileState, IFileRecord, IFileMeta, IFileLog } from './models/interfaces/s3.interface';
|
|
77
|
+
import {
|
|
78
|
+
S3,
|
|
79
|
+
S3Schema,
|
|
80
|
+
S3Document,
|
|
81
|
+
LogInitiatorDocument,
|
|
82
|
+
LogInitiatorSchema,
|
|
83
|
+
LogInitiator,
|
|
84
|
+
FileLog,
|
|
85
|
+
FileLogSchema,
|
|
86
|
+
FileLogDocument,
|
|
87
|
+
FileMetaDocument,
|
|
88
|
+
FileMetaSchema,
|
|
89
|
+
FileMeta,
|
|
90
|
+
FileState,
|
|
91
|
+
FileStateSchema,
|
|
92
|
+
FileStateDocument,
|
|
93
|
+
FileRecord,
|
|
94
|
+
FileRecordSchema,
|
|
95
|
+
FileRecordDocument,
|
|
96
|
+
S3File,
|
|
97
|
+
S3FileSchema,
|
|
98
|
+
S3FileDocument,
|
|
99
|
+
} from './models/schemas/embedded/s3.schema';
|
|
75
100
|
|
|
76
101
|
export {
|
|
77
102
|
/**
|
|
@@ -122,6 +147,8 @@ export {
|
|
|
122
147
|
UserVerificationLevel,
|
|
123
148
|
WeekDay,
|
|
124
149
|
GroupState,
|
|
150
|
+
S3FileState,
|
|
151
|
+
FileLogInitType,
|
|
125
152
|
|
|
126
153
|
/**
|
|
127
154
|
* DTOs
|
|
@@ -151,6 +178,13 @@ export {
|
|
|
151
178
|
IGroupSession,
|
|
152
179
|
ITime,
|
|
153
180
|
ISMTPAPIConfig,
|
|
181
|
+
IS3,
|
|
182
|
+
ILogInitiator,
|
|
183
|
+
IS3File,
|
|
184
|
+
IFileState,
|
|
185
|
+
IFileRecord,
|
|
186
|
+
IFileMeta,
|
|
187
|
+
IFileLog,
|
|
154
188
|
|
|
155
189
|
/**
|
|
156
190
|
* Schemas & Documents
|
|
@@ -197,6 +231,27 @@ export {
|
|
|
197
231
|
TimeSchema,
|
|
198
232
|
TimeDocument,
|
|
199
233
|
Time,
|
|
234
|
+
S3,
|
|
235
|
+
S3Schema,
|
|
236
|
+
S3Document,
|
|
237
|
+
LogInitiator,
|
|
238
|
+
LogInitiatorSchema,
|
|
239
|
+
LogInitiatorDocument,
|
|
240
|
+
FileLog,
|
|
241
|
+
FileLogSchema,
|
|
242
|
+
FileLogDocument,
|
|
243
|
+
FileMeta,
|
|
244
|
+
FileMetaSchema,
|
|
245
|
+
FileMetaDocument,
|
|
246
|
+
FileState,
|
|
247
|
+
FileStateSchema,
|
|
248
|
+
FileStateDocument,
|
|
249
|
+
FileRecord,
|
|
250
|
+
FileRecordSchema,
|
|
251
|
+
FileRecordDocument,
|
|
252
|
+
S3File,
|
|
253
|
+
S3FileSchema,
|
|
254
|
+
S3FileDocument,
|
|
200
255
|
|
|
201
256
|
/**
|
|
202
257
|
* Filters
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { mongo } from 'mongoose';
|
|
2
|
+
import { FileLogInitType, S3FileState } from '../enums/s3.enum';
|
|
3
|
+
|
|
4
|
+
export interface IS3 {
|
|
5
|
+
key: string;
|
|
6
|
+
bucket: string;
|
|
7
|
+
etag: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface ILogInitiator {
|
|
11
|
+
type: FileLogInitType;
|
|
12
|
+
name: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface IS3File {
|
|
16
|
+
id: mongo.ObjectId;
|
|
17
|
+
fileMeta: IFileMeta;
|
|
18
|
+
state: IFileState;
|
|
19
|
+
s3: IS3;
|
|
20
|
+
record: IFileRecord;
|
|
21
|
+
owner: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface IFileState {
|
|
25
|
+
value: S3FileState;
|
|
26
|
+
log: IFileLog[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface IFileRecord {
|
|
30
|
+
createdAt: Date;
|
|
31
|
+
updatedAt: Date;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface IFileMeta {
|
|
35
|
+
name: string;
|
|
36
|
+
size: number;
|
|
37
|
+
mimeType: string;
|
|
38
|
+
extension: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface IFileLog {
|
|
42
|
+
createdAt: Date;
|
|
43
|
+
value: S3FileState;
|
|
44
|
+
initiator: ILogInitiator;
|
|
45
|
+
}
|
|
@@ -12,7 +12,7 @@ export class GroupSession extends Identifable implements IGroupSession {
|
|
|
12
12
|
@Prop({ type: I18nSchema, required: false })
|
|
13
13
|
description: II18n;
|
|
14
14
|
|
|
15
|
-
@Prop({ type:
|
|
15
|
+
@Prop({ type: Number, enum: WeekDay, required: true })
|
|
16
16
|
day: WeekDay;
|
|
17
17
|
|
|
18
18
|
@Prop({ type: Time, required: true })
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
|
2
|
+
import { HydratedDocument, mongo, SchemaTypes } from 'mongoose';
|
|
3
|
+
import { IFileLog, IFileMeta, IFileRecord, IFileState, ILogInitiator, IS3, IS3File } from '../../interfaces/s3.interface';
|
|
4
|
+
import { FileLogInitType, S3FileState } from '../../enums/s3.enum';
|
|
5
|
+
|
|
6
|
+
@Schema({ _id: false })
|
|
7
|
+
export class S3 implements IS3 {
|
|
8
|
+
@Prop({ type: String, required: false })
|
|
9
|
+
key: string;
|
|
10
|
+
|
|
11
|
+
@Prop({ type: String, required: false })
|
|
12
|
+
bucket: string;
|
|
13
|
+
|
|
14
|
+
@Prop({ type: String, required: false })
|
|
15
|
+
etag: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@Schema({ _id: false })
|
|
19
|
+
export class LogInitiator implements ILogInitiator {
|
|
20
|
+
@Prop({ type: String, enum: FileLogInitType, required: false })
|
|
21
|
+
type: FileLogInitType;
|
|
22
|
+
|
|
23
|
+
@Prop({ type: String, required: false })
|
|
24
|
+
name: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@Schema({ _id: false })
|
|
28
|
+
export class FileLog implements IFileLog {
|
|
29
|
+
@Prop({ type: Date, required: false })
|
|
30
|
+
createdAt: Date;
|
|
31
|
+
|
|
32
|
+
@Prop({ type: String, enum: S3FileState, required: false })
|
|
33
|
+
value: S3FileState;
|
|
34
|
+
|
|
35
|
+
@Prop({ type: LogInitiator, required: false })
|
|
36
|
+
initiator: LogInitiator;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@Schema({ _id: false })
|
|
40
|
+
export class FileMeta implements IFileMeta {
|
|
41
|
+
@Prop({ type: String, required: false })
|
|
42
|
+
name: string;
|
|
43
|
+
|
|
44
|
+
@Prop({ type: Number, required: true })
|
|
45
|
+
size: number;
|
|
46
|
+
|
|
47
|
+
@Prop({ type: String, required: true })
|
|
48
|
+
mimeType: string;
|
|
49
|
+
|
|
50
|
+
@Prop({ type: String, required: true })
|
|
51
|
+
extension: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@Schema({ _id: false })
|
|
55
|
+
export class FileState implements IFileState {
|
|
56
|
+
@Prop({ type: String, enum: S3FileState, required: false })
|
|
57
|
+
value: S3FileState;
|
|
58
|
+
|
|
59
|
+
@Prop({ type: [FileLog], required: false })
|
|
60
|
+
log: FileLog[];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@Schema({ _id: false })
|
|
64
|
+
export class FileRecord implements IFileRecord {
|
|
65
|
+
@Prop({ type: Date, required: false })
|
|
66
|
+
createdAt: Date;
|
|
67
|
+
|
|
68
|
+
@Prop({ type: Date, required: false })
|
|
69
|
+
updatedAt: Date;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@Schema({ _id: false })
|
|
73
|
+
export class S3File implements IS3File {
|
|
74
|
+
@Prop({ type: SchemaTypes.ObjectId, required: true })
|
|
75
|
+
id: mongo.ObjectId;
|
|
76
|
+
|
|
77
|
+
@Prop({ type: FileMeta, required: false })
|
|
78
|
+
fileMeta: FileMeta;
|
|
79
|
+
|
|
80
|
+
@Prop({ type: FileState, required: false })
|
|
81
|
+
state: FileState;
|
|
82
|
+
|
|
83
|
+
@Prop({ type: S3, required: false })
|
|
84
|
+
s3: S3;
|
|
85
|
+
|
|
86
|
+
@Prop({ type: FileRecord, required: false })
|
|
87
|
+
record: FileRecord;
|
|
88
|
+
|
|
89
|
+
@Prop({ required: false, type: String })
|
|
90
|
+
owner: string;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export const S3Schema = SchemaFactory.createForClass(S3);
|
|
94
|
+
export const LogInitiatorSchema = SchemaFactory.createForClass(LogInitiator);
|
|
95
|
+
export const FileLogSchema = SchemaFactory.createForClass(FileLog);
|
|
96
|
+
export const FileMetaSchema = SchemaFactory.createForClass(FileMeta);
|
|
97
|
+
export const FileStateSchema = SchemaFactory.createForClass(FileState);
|
|
98
|
+
export const FileRecordSchema = SchemaFactory.createForClass(FileRecord);
|
|
99
|
+
export const S3FileSchema = SchemaFactory.createForClass(S3File);
|
|
100
|
+
|
|
101
|
+
export type S3Document = HydratedDocument<S3>;
|
|
102
|
+
export type LogInitiatorDocument = HydratedDocument<LogInitiator>;
|
|
103
|
+
export type FileLogDocument = HydratedDocument<FileLog>;
|
|
104
|
+
export type FileMetaDocument = HydratedDocument<FileMeta>;
|
|
105
|
+
export type FileStateDocument = HydratedDocument<FileState>;
|
|
106
|
+
export type FileRecordDocument = HydratedDocument<FileRecord>;
|
|
107
|
+
export type S3FileDocument = HydratedDocument<S3File>;
|