dl-commons 0.0.2-testing.27 → 0.0.2-testing.29

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.
Files changed (52) hide show
  1. package/dist/index.d.ts +11 -1
  2. package/dist/index.js +19 -2
  3. package/dist/index.js.map +1 -1
  4. package/dist/models/enums/location-type.enum.d.ts +5 -0
  5. package/dist/models/enums/location-type.enum.js +10 -0
  6. package/dist/models/enums/location-type.enum.js.map +1 -0
  7. package/dist/models/enums/virtual-address-type.enum.d.ts +14 -0
  8. package/dist/models/enums/virtual-address-type.enum.js +19 -0
  9. package/dist/models/enums/virtual-address-type.enum.js.map +1 -0
  10. package/dist/models/interfaces/author.interface.d.ts +2 -1
  11. package/dist/models/interfaces/date-time-range.interface.d.ts +4 -0
  12. package/dist/models/interfaces/date-time-range.interface.js +3 -0
  13. package/dist/models/interfaces/date-time-range.interface.js.map +1 -0
  14. package/dist/models/interfaces/location.interface.d.ts +8 -0
  15. package/dist/models/interfaces/location.interface.js +3 -0
  16. package/dist/models/interfaces/location.interface.js.map +1 -0
  17. package/dist/models/interfaces/physical-address.interface.d.ts +7 -0
  18. package/dist/models/interfaces/physical-address.interface.js +3 -0
  19. package/dist/models/interfaces/physical-address.interface.js.map +1 -0
  20. package/dist/models/interfaces/virtual-address.interface.d.ts +5 -0
  21. package/dist/models/interfaces/virtual-address.interface.js +3 -0
  22. package/dist/models/interfaces/virtual-address.interface.js.map +1 -0
  23. package/dist/models/schemas/embedded/author.schema.d.ts +7 -6
  24. package/dist/models/schemas/embedded/author.schema.js +4 -0
  25. package/dist/models/schemas/embedded/author.schema.js.map +1 -1
  26. package/dist/models/schemas/embedded/date-time-range.schema.d.ts +16 -0
  27. package/dist/models/schemas/embedded/date-time-range.schema.js +29 -0
  28. package/dist/models/schemas/embedded/date-time-range.schema.js.map +1 -0
  29. package/dist/models/schemas/embedded/location.schema.d.ts +20 -0
  30. package/dist/models/schemas/embedded/location.schema.js +36 -0
  31. package/dist/models/schemas/embedded/location.schema.js.map +1 -0
  32. package/dist/models/schemas/embedded/physical-address.schema.d.ts +19 -0
  33. package/dist/models/schemas/embedded/physical-address.schema.js +38 -0
  34. package/dist/models/schemas/embedded/physical-address.schema.js.map +1 -0
  35. package/dist/models/schemas/embedded/virtual-address.schema.d.ts +17 -0
  36. package/dist/models/schemas/embedded/virtual-address.schema.js +30 -0
  37. package/dist/models/schemas/embedded/virtual-address.schema.js.map +1 -0
  38. package/dist/tsconfig.tsbuildinfo +1 -1
  39. package/package.json +1 -1
  40. package/src/index.ts +28 -0
  41. package/src/models/enums/location-type.enum.ts +5 -0
  42. package/src/models/enums/virtual-address-type.enum.ts +14 -0
  43. package/src/models/interfaces/author.interface.ts +2 -1
  44. package/src/models/interfaces/date-time-range.interface.ts +4 -0
  45. package/src/models/interfaces/location.interface.ts +9 -0
  46. package/src/models/interfaces/physical-address.interface.ts +8 -0
  47. package/src/models/interfaces/virtual-address.interface.ts +6 -0
  48. package/src/models/schemas/embedded/author.schema.ts +3 -0
  49. package/src/models/schemas/embedded/date-time-range.schema.ts +15 -0
  50. package/src/models/schemas/embedded/location.schema.ts +23 -0
  51. package/src/models/schemas/embedded/physical-address.schema.ts +23 -0
  52. package/src/models/schemas/embedded/virtual-address.schema.ts +16 -0
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.27",
4
+ "version": "0.0.2-testing.29",
5
5
  "description": "distance learning commons",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -116,6 +116,16 @@ import { IDParams } from './models/dtos/commons/id.param';
116
116
  import { UserType } from './models/enums/user-type.enum';
117
117
  import { IAMService } from './services/iam.service';
118
118
  import { PermissionsScannerService } from './services/permissions-scanner.service';
119
+ import { PhysicalAddress, PhysicalAddressDocument, PhysicalAddressSchema } from './models/schemas/embedded/physical-address.schema';
120
+ import { IPhysicalAddress } from './models/interfaces/physical-address.interface';
121
+ import { VirtualAddressType } from './models/enums/virtual-address-type.enum';
122
+ import { LocationType } from './models/enums/location-type.enum';
123
+ import { IDateTimeRange } from './models/interfaces/date-time-range.interface';
124
+ import { DateTimeRange, DateTimeRangeDocument, DateTimeRangeSchema } from './models/schemas/embedded/date-time-range.schema';
125
+ import { IVirtualAddress } from './models/interfaces/virtual-address.interface';
126
+ import { VirtualAddress, VirtualAddressDocument, VirtualAddressSchema } from './models/schemas/embedded/virtual-address.schema';
127
+ import { Location, LocationDocument, LocationSchema } from './models/schemas/embedded/location.schema';
128
+ import { ILocation } from './models/interfaces/location.interface';
119
129
 
120
130
  export {
121
131
  /**
@@ -173,6 +183,8 @@ export {
173
183
  S3FileState,
174
184
  FileLogInitType,
175
185
  AttachementType,
186
+ VirtualAddressType,
187
+ LocationType,
176
188
 
177
189
  /**
178
190
  * DTOs
@@ -217,6 +229,10 @@ export {
217
229
  IPicture,
218
230
  IAuthor,
219
231
  IFileEmbedded,
232
+ IPhysicalAddress,
233
+ IDateTimeRange,
234
+ IVirtualAddress,
235
+ ILocation,
220
236
 
221
237
  /**
222
238
  * Schemas & Documents
@@ -299,6 +315,18 @@ export {
299
315
  Author,
300
316
  AuthorSchema,
301
317
  AuthorDocument,
318
+ PhysicalAddress,
319
+ PhysicalAddressSchema,
320
+ PhysicalAddressDocument,
321
+ DateTimeRange,
322
+ DateTimeRangeSchema,
323
+ DateTimeRangeDocument,
324
+ VirtualAddress,
325
+ VirtualAddressSchema,
326
+ VirtualAddressDocument,
327
+ Location,
328
+ LocationSchema,
329
+ LocationDocument,
302
330
 
303
331
  /**
304
332
  * Filters
@@ -0,0 +1,5 @@
1
+ export enum LocationType {
2
+ Uncategorized = 'uncategorized',
3
+ PhysicalAddress = 'physical-address',
4
+ VirtualAddress = 'virtual-address',
5
+ }
@@ -0,0 +1,14 @@
1
+ export enum VirtualAddressType {
2
+ GoogleMeet = 'google-meet',
3
+ Zoom = 'zoom',
4
+ MicrosoftTeams = 'microsoft-teams',
5
+ Discord = 'discord',
6
+ Slack = 'slack',
7
+ WhatsApp = 'whatsapp',
8
+ Telegram = 'telegram',
9
+ Signal = 'signal',
10
+ WeChat = 'wechat',
11
+ FacebookMessenger = 'facebook-messenger',
12
+ YouTube = 'youtube',
13
+ Twitch = 'twitch',
14
+ }
@@ -1,6 +1,7 @@
1
1
  import { Types } from 'mongoose';
2
+ import { IIdentifable } from './identifable.interface';
2
3
 
3
- export interface IAuthor {
4
+ export interface IAuthor extends IIdentifable {
4
5
  userId?: Types.ObjectId | string | null | undefined;
5
6
  firstName?: string | null | undefined;
6
7
  lastName?: string | null | undefined;
@@ -0,0 +1,4 @@
1
+ export interface IDateTimeRange {
2
+ startsAt?: Date | null;
3
+ endsAt?: Date | null;
4
+ }
@@ -0,0 +1,9 @@
1
+ import { LocationType } from '../enums/location-type.enum';
2
+ import { IPhysicalAddress } from './physical-address.interface';
3
+ import { IVirtualAddress } from './virtual-address.interface';
4
+
5
+ export interface ILocation {
6
+ type: LocationType;
7
+ physicalAddress?: IPhysicalAddress | null;
8
+ virtualAddress?: IVirtualAddress | null;
9
+ }
@@ -0,0 +1,8 @@
1
+ import { IDictionary } from './dictionary.interface';
2
+
3
+ export interface IPhysicalAddress {
4
+ country?: IDictionary | null | undefined;
5
+ city?: IDictionary | null | undefined;
6
+ address1?: string | null | undefined;
7
+ address2?: string | null | undefined;
8
+ }
@@ -0,0 +1,6 @@
1
+ import { VirtualAddressType } from '../enums/virtual-address-type.enum';
2
+
3
+ export interface IVirtualAddress {
4
+ type: VirtualAddressType;
5
+ link: String;
6
+ }
@@ -4,6 +4,9 @@ import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
4
4
 
5
5
  @Schema({ _id: false })
6
6
  export class Author implements IAuthor {
7
+ @Prop({ type: MongooseSchema.Types.ObjectId, default: new Types.ObjectId() })
8
+ _id: Types.ObjectId | string | null | undefined;
9
+
7
10
  @Prop({ type: MongooseSchema.Types.ObjectId, default: null })
8
11
  userId: Types.ObjectId | string | null | undefined;
9
12
 
@@ -0,0 +1,15 @@
1
+ import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
2
+ import { HydratedDocument } from 'mongoose';
3
+ import { IDateTimeRange } from '../../interfaces/date-time-range.interface';
4
+
5
+ @Schema({ _id: false })
6
+ export class DateTimeRange implements IDateTimeRange {
7
+ @Prop({ type: Date, required: false, default: null })
8
+ startsAt: Date | null | undefined;
9
+
10
+ @Prop({ type: Date, required: false, default: null })
11
+ endsAt: Date | null | undefined;
12
+ }
13
+
14
+ export const DateTimeRangeSchema = SchemaFactory.createForClass(DateTimeRange);
15
+ export type DateTimeRangeDocument = HydratedDocument<DateTimeRange>;
@@ -0,0 +1,23 @@
1
+ import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
2
+ import { HydratedDocument } from 'mongoose';
3
+ import { ILocation } from '../../interfaces/location.interface';
4
+ import { LocationType } from '../../enums/location-type.enum';
5
+ import { IPhysicalAddress } from '../../interfaces/physical-address.interface';
6
+ import { PhysicalAddressSchema } from './physical-address.schema';
7
+ import { IVirtualAddress } from '../../interfaces/virtual-address.interface';
8
+ import { VirtualAddressSchema } from './virtual-address.schema';
9
+
10
+ @Schema({ _id: false })
11
+ export class Location implements ILocation {
12
+ @Prop({ type: String, enum: LocationType, required: true, default: LocationType.Uncategorized })
13
+ type: LocationType;
14
+
15
+ @Prop({ type: PhysicalAddressSchema, required: false, default: null })
16
+ physicalAddress: IPhysicalAddress | null | undefined;
17
+
18
+ @Prop({ type: VirtualAddressSchema, required: false, default: null })
19
+ virtualAddress: IVirtualAddress | null | undefined;
20
+ }
21
+
22
+ export const LocationSchema = SchemaFactory.createForClass(Location);
23
+ export type LocationDocument = HydratedDocument<Location>;
@@ -0,0 +1,23 @@
1
+ import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
2
+ import { HydratedDocument } from 'mongoose';
3
+ import { IDictionary } from '../../interfaces/dictionary.interface';
4
+ import { DictionaryEmbeddedSchema } from './dictionary-embedded.schema';
5
+ import { IPhysicalAddress } from '../../interfaces/physical-address.interface';
6
+
7
+ @Schema({ _id: false })
8
+ export class PhysicalAddress implements IPhysicalAddress {
9
+ @Prop({ type: DictionaryEmbeddedSchema, required: false, default: null })
10
+ country: IDictionary;
11
+
12
+ @Prop({ type: DictionaryEmbeddedSchema, required: false, default: null })
13
+ city: IDictionary;
14
+
15
+ @Prop({ type: String, required: false, default: null })
16
+ address1: string;
17
+
18
+ @Prop({ type: String, required: false, default: null })
19
+ address2: string;
20
+ }
21
+
22
+ export const PhysicalAddressSchema = SchemaFactory.createForClass(PhysicalAddress);
23
+ export type PhysicalAddressDocument = HydratedDocument<PhysicalAddress>;
@@ -0,0 +1,16 @@
1
+ import { Schema, Prop, SchemaFactory } from '@nestjs/mongoose';
2
+ import { HydratedDocument } from 'mongoose';
3
+ import { IVirtualAddress } from '../../interfaces/virtual-address.interface';
4
+ import { VirtualAddressType } from '../../enums/virtual-address-type.enum';
5
+
6
+ @Schema({ _id: false })
7
+ export class VirtualAddress implements IVirtualAddress {
8
+ @Prop({ type: String, enum: VirtualAddressType, required: true, default: null })
9
+ type: VirtualAddressType;
10
+
11
+ @Prop({ type: String, required: true, default: null })
12
+ link: string;
13
+ }
14
+
15
+ export const VirtualAddressSchema = SchemaFactory.createForClass(VirtualAddress);
16
+ export type VirtualAddressDocument = HydratedDocument<VirtualAddress>;