dl-commons 0.0.2-testing.6 → 0.0.2-testing.8

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dl-commons",
3
3
  "type": "commonjs",
4
- "version": "0.0.2-testing.6",
4
+ "version": "0.0.2-testing.8",
5
5
  "description": "distance learning commons",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -96,7 +96,11 @@ import {
96
96
  S3File,
97
97
  S3FileSchema,
98
98
  S3FileDocument,
99
+ FileEmbedded,
100
+ FileEmbeddedDocument,
101
+ FileEmbeddedSchema,
99
102
  } from './models/schemas/embedded/s3.schema';
103
+ import { IUserMeta } from './models/interfaces/user-meta.interface';
100
104
 
101
105
  export {
102
106
  /**
@@ -185,7 +189,8 @@ export {
185
189
  IFileRecord,
186
190
  IFileMeta,
187
191
  IFileLog,
188
-
192
+ IUserMeta,
193
+
189
194
  /**
190
195
  * Schemas & Documents
191
196
  */
@@ -252,6 +257,10 @@ export {
252
257
  S3File,
253
258
  S3FileSchema,
254
259
  S3FileDocument,
260
+ FileEmbedded,
261
+ FileEmbeddedSchema,
262
+ FileEmbeddedDocument,
263
+
255
264
 
256
265
  /**
257
266
  * Filters
@@ -43,3 +43,13 @@ export interface IFileLog {
43
43
  value: S3FileState;
44
44
  initiator: ILogInitiator;
45
45
  }
46
+
47
+ export interface IFileEmbedded {
48
+ id: string;
49
+ name: string;
50
+ size: number;
51
+ mimeType: string;
52
+ s3: IS3;
53
+ state: S3FileState;
54
+ createdAt: Date;
55
+ }
@@ -0,0 +1,4 @@
1
+ export interface IUserMeta {
2
+ userId?: string;
3
+ fullName: string;
4
+ }
@@ -1,6 +1,6 @@
1
1
  import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
2
  import { HydratedDocument, mongo, SchemaTypes } from 'mongoose';
3
- import { IFileLog, IFileMeta, IFileRecord, IFileState, ILogInitiator, IS3, IS3File } from '../../interfaces/s3.interface';
3
+ import { IFileEmbedded, IFileLog, IFileMeta, IFileRecord, IFileState, ILogInitiator, IS3, IS3File } from '../../interfaces/s3.interface';
4
4
  import { FileLogInitType, S3FileState } from '../../enums/s3.enum';
5
5
 
6
6
  @Schema({ _id: false })
@@ -90,6 +90,30 @@ export class S3File implements IS3File {
90
90
  owner: string;
91
91
  }
92
92
 
93
+ @Schema({ _id: false })
94
+ export class FileEmbedded implements IFileEmbedded {
95
+ @Prop({ type: String, required: true })
96
+ id: string;
97
+
98
+ @Prop({ type: String, required: false })
99
+ name: string;
100
+
101
+ @Prop({ type: Number, required: true })
102
+ size: number;
103
+
104
+ @Prop({ type: String, required: true })
105
+ mimeType: string;
106
+
107
+ @Prop({ type: S3, required: true, default: null })
108
+ s3: S3;
109
+
110
+ @Prop({ type: String, enum: S3FileState, required: true })
111
+ state: S3FileState;
112
+
113
+ @Prop({ type: Date, required: true })
114
+ createdAt: Date;
115
+ }
116
+
93
117
  export const S3Schema = SchemaFactory.createForClass(S3);
94
118
  export const LogInitiatorSchema = SchemaFactory.createForClass(LogInitiator);
95
119
  export const FileLogSchema = SchemaFactory.createForClass(FileLog);
@@ -97,6 +121,7 @@ export const FileMetaSchema = SchemaFactory.createForClass(FileMeta);
97
121
  export const FileStateSchema = SchemaFactory.createForClass(FileState);
98
122
  export const FileRecordSchema = SchemaFactory.createForClass(FileRecord);
99
123
  export const S3FileSchema = SchemaFactory.createForClass(S3File);
124
+ export const FileEmbeddedSchema = SchemaFactory.createForClass(FileEmbedded);
100
125
 
101
126
  export type S3Document = HydratedDocument<S3>;
102
127
  export type LogInitiatorDocument = HydratedDocument<LogInitiator>;
@@ -105,3 +130,4 @@ export type FileMetaDocument = HydratedDocument<FileMeta>;
105
130
  export type FileStateDocument = HydratedDocument<FileState>;
106
131
  export type FileRecordDocument = HydratedDocument<FileRecord>;
107
132
  export type S3FileDocument = HydratedDocument<S3File>;
133
+ export type FileEmbeddedDocument = HydratedDocument<FileEmbedded>;