jp.db.schemas 2.0.2 → 2.0.3

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 (56) hide show
  1. package/dist/index.d.ts +4 -6
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +1 -5
  4. package/dist/index.js.map +1 -1
  5. package/dist/models/tournament-participant.interface.d.ts +6 -0
  6. package/dist/models/tournament-participant.interface.d.ts.map +1 -0
  7. package/dist/models/tournament-participant.interface.js +3 -0
  8. package/dist/models/tournament-participant.interface.js.map +1 -0
  9. package/dist/models/tournament-status.enum.d.ts +7 -0
  10. package/dist/models/tournament-status.enum.d.ts.map +1 -0
  11. package/dist/models/tournament-status.enum.js +11 -0
  12. package/dist/models/tournament-status.enum.js.map +1 -0
  13. package/dist/models/tournament-winner.interface.d.ts +8 -0
  14. package/dist/models/tournament-winner.interface.d.ts.map +1 -0
  15. package/dist/models/tournament-winner.interface.js +3 -0
  16. package/dist/models/tournament-winner.interface.js.map +1 -0
  17. package/dist/repositories/index.d.ts +1 -2
  18. package/dist/repositories/index.d.ts.map +1 -1
  19. package/dist/repositories/index.js +1 -3
  20. package/dist/repositories/index.js.map +1 -1
  21. package/dist/repositories/tournament-many-tables-rooms.repository.d.ts +14 -4
  22. package/dist/repositories/tournament-many-tables-rooms.repository.d.ts.map +1 -1
  23. package/dist/repositories/tournament-many-tables-rooms.repository.js +53 -5
  24. package/dist/repositories/tournament-many-tables-rooms.repository.js.map +1 -1
  25. package/dist/repositories/tournament-one-table-rooms.repository.d.ts +12 -4
  26. package/dist/repositories/tournament-one-table-rooms.repository.d.ts.map +1 -1
  27. package/dist/repositories/tournament-one-table-rooms.repository.js +45 -5
  28. package/dist/repositories/tournament-one-table-rooms.repository.js.map +1 -1
  29. package/dist/schemas/tournament_many_tables_rooms.schema.d.ts +52 -15
  30. package/dist/schemas/tournament_many_tables_rooms.schema.d.ts.map +1 -1
  31. package/dist/schemas/tournament_many_tables_rooms.schema.js +23 -7
  32. package/dist/schemas/tournament_many_tables_rooms.schema.js.map +1 -1
  33. package/dist/schemas/tournament_one_table_rooms.schema.d.ts +114 -2
  34. package/dist/schemas/tournament_one_table_rooms.schema.d.ts.map +1 -1
  35. package/dist/schemas/tournament_one_table_rooms.schema.js +45 -1
  36. package/dist/schemas/tournament_one_table_rooms.schema.js.map +1 -1
  37. package/package.json +1 -1
  38. package/src/index.ts +0 -7
  39. package/src/models/tournament-participant.interface.ts +5 -0
  40. package/src/models/tournament-status.enum.ts +6 -0
  41. package/src/models/tournament-winner.interface.ts +7 -0
  42. package/src/repositories/index.ts +0 -2
  43. package/src/repositories/tournament-many-tables-rooms.repository.ts +77 -5
  44. package/src/repositories/tournament-one-table-rooms.repository.ts +58 -4
  45. package/src/schemas/tournament_many_tables_rooms.schema.ts +22 -11
  46. package/src/schemas/tournament_one_table_rooms.schema.ts +39 -1
  47. package/dist/repositories/tournament-result.repository.d.ts +0 -9
  48. package/dist/repositories/tournament-result.repository.d.ts.map +0 -1
  49. package/dist/repositories/tournament-result.repository.js +0 -39
  50. package/dist/repositories/tournament-result.repository.js.map +0 -1
  51. package/dist/schemas/tournament_result.schema.d.ts +0 -82
  52. package/dist/schemas/tournament_result.schema.d.ts.map +0 -1
  53. package/dist/schemas/tournament_result.schema.js +0 -45
  54. package/dist/schemas/tournament_result.schema.js.map +0 -1
  55. package/src/repositories/tournament-result.repository.ts +0 -21
  56. package/src/schemas/tournament_result.schema.ts +0 -36
@@ -21,7 +21,7 @@ __decorate([
21
21
  },
22
22
  }),
23
23
  __metadata("design:type", String)
24
- ], TournamentManyTablesRoom.prototype, "roomId", void 0);
24
+ ], TournamentManyTablesRoom.prototype, "tournamentId", void 0);
25
25
  __decorate([
26
26
  (0, mongoose_1.Prop)({ type: Object }),
27
27
  __metadata("design:type", Object)
@@ -60,12 +60,16 @@ __decorate([
60
60
  ], TournamentManyTablesRoom.prototype, "deckType", void 0);
61
61
  __decorate([
62
62
  (0, mongoose_1.Prop)(),
63
- __metadata("design:type", Date)
64
- ], TournamentManyTablesRoom.prototype, "createDate", void 0);
63
+ __metadata("design:type", Boolean)
64
+ ], TournamentManyTablesRoom.prototype, "isTemplate", void 0);
65
65
  __decorate([
66
66
  (0, mongoose_1.Prop)(),
67
- __metadata("design:type", Date)
68
- ], TournamentManyTablesRoom.prototype, "startDate", void 0);
67
+ __metadata("design:type", String)
68
+ ], TournamentManyTablesRoom.prototype, "templateId", void 0);
69
+ __decorate([
70
+ (0, mongoose_1.Prop)(),
71
+ __metadata("design:type", String)
72
+ ], TournamentManyTablesRoom.prototype, "type", void 0);
69
73
  __decorate([
70
74
  (0, mongoose_1.Prop)({ type: Object }),
71
75
  __metadata("design:type", Object)
@@ -84,8 +88,20 @@ __decorate([
84
88
  ], TournamentManyTablesRoom.prototype, "status", void 0);
85
89
  __decorate([
86
90
  (0, mongoose_1.Prop)(),
87
- __metadata("design:type", String)
88
- ], TournamentManyTablesRoom.prototype, "type", void 0);
91
+ __metadata("design:type", Array)
92
+ ], TournamentManyTablesRoom.prototype, "winners", void 0);
93
+ __decorate([
94
+ (0, mongoose_1.Prop)(),
95
+ __metadata("design:type", Date)
96
+ ], TournamentManyTablesRoom.prototype, "createDate", void 0);
97
+ __decorate([
98
+ (0, mongoose_1.Prop)(),
99
+ __metadata("design:type", Date)
100
+ ], TournamentManyTablesRoom.prototype, "startDate", void 0);
101
+ __decorate([
102
+ (0, mongoose_1.Prop)(),
103
+ __metadata("design:type", Date)
104
+ ], TournamentManyTablesRoom.prototype, "finishDate", void 0);
89
105
  exports.TournamentManyTablesRoom = TournamentManyTablesRoom = __decorate([
90
106
  (0, mongoose_1.Schema)({ collection: 'tournament_many_tables_rooms' })
91
107
  ], TournamentManyTablesRoom);
@@ -1 +1 @@
1
- {"version":3,"file":"tournament_many_tables_rooms.schema.js","sourceRoot":"","sources":["../../src/schemas/tournament_many_tables_rooms.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAwE;AAYjE,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;CAuDpC,CAAA;AAvDY,4DAAwB;AAMxB;IALR,IAAA,kBAAO,EAAC;QACL,GAAG,EAAE;YACD,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC/B,CAAC;KACJ,CAAC;;wDACsB;AAGxB;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;uDACO;AAG9B;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0DACU;AAGjC;IADC,IAAA,eAAI,GAAE;;2DACW;AAGlB;IADC,IAAA,eAAI,GAAE;;qDACK;AAGZ;IADC,IAAA,eAAI,GAAE;;6DACa;AAGpB;IADC,IAAA,eAAI,GAAE;;0DACU;AAGjB;IADC,IAAA,eAAI,GAAE;;0DACU;AAGjB;IADC,IAAA,eAAI,GAAE;;2DACW;AAGlB;IADC,IAAA,eAAI,GAAE;;0DACW;AAGlB;IADC,IAAA,eAAI,GAAE;8BACK,IAAI;4DAAC;AAGjB;IADC,IAAA,eAAI,GAAE;8BACI,IAAI;2DAAC;AAGhB;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6DACa;AAGpC;IADC,IAAA,eAAI,GAAE;8BACO,KAAK;8DAAe;AAGlC;IADC,IAAA,eAAI,GAAE;;iEACiB;AAGxB;IADC,IAAA,eAAI,GAAE;;wDACQ;AAGf;IADC,IAAA,eAAI,GAAE;;sDACM;mCAtDJ,wBAAwB;IADpC,IAAA,iBAAM,EAAC,EAAE,UAAU,EAAE,8BAA8B,EAAE,CAAC;GAC1C,wBAAwB,CAuDpC;AAEY,QAAA,8BAA8B,GAAG,wBAAa,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAAC"}
1
+ {"version":3,"file":"tournament_many_tables_rooms.schema.js","sourceRoot":"","sources":["../../src/schemas/tournament_many_tables_rooms.schema.ts"],"names":[],"mappings":";;;;;;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wBAAwB,CAqEpC;AAEY,QAAA,8BAA8B,GAAG,wBAAa,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAAC"}
@@ -1,7 +1,9 @@
1
1
  import { Document, HydratedDocument } from 'mongoose';
2
+ import { ITournamentWinner } from '../models/tournament-winner.interface';
3
+ import { ITournamentParticipant } from '../models/tournament-participant.interface';
2
4
  export type TournamentOneTableRoomDocument = HydratedDocument<TournamentOneTableRoom>;
3
5
  export declare class TournamentOneTableRoom {
4
- readonly roomId: string;
6
+ readonly tournamentId: string;
5
7
  title: Record<string, string>;
6
8
  subtitle: Record<string, string>;
7
9
  tableSize: number;
@@ -11,6 +13,17 @@ export declare class TournamentOneTableRoom {
11
13
  gameType: string;
12
14
  rulesType: string;
13
15
  deckType?: string;
16
+ isTemplate: boolean;
17
+ templateId?: string;
18
+ type: string;
19
+ description: Record<string, string>;
20
+ maxParticipants: number;
21
+ participants: Array<ITournamentParticipant>;
22
+ status: string;
23
+ winners: Array<ITournamentWinner>;
24
+ createDate: Date;
25
+ startDate: Date;
26
+ finishDate: Date;
14
27
  }
15
28
  export declare const TournamentOneTableRoomSchema: import("mongoose").Schema<TournamentOneTableRoom, import("mongoose").Model<TournamentOneTableRoom, any, any, any, (Document<unknown, any, TournamentOneTableRoom, any, import("mongoose").DefaultSchemaOptions> & TournamentOneTableRoom & {
16
29
  _id: import("mongoose").Types.ObjectId;
@@ -31,7 +44,7 @@ export declare const TournamentOneTableRoomSchema: import("mongoose").Schema<Tou
31
44
  }, "id"> & {
32
45
  id: string;
33
46
  }, {
34
- readonly roomId?: import("mongoose").SchemaDefinitionProperty<string, TournamentOneTableRoom, Document<unknown, {}, TournamentOneTableRoom, {
47
+ readonly tournamentId?: import("mongoose").SchemaDefinitionProperty<string, TournamentOneTableRoom, Document<unknown, {}, TournamentOneTableRoom, {
35
48
  id: string;
36
49
  }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TournamentOneTableRoom & {
37
50
  _id: import("mongoose").Types.ObjectId;
@@ -121,5 +134,104 @@ export declare const TournamentOneTableRoomSchema: import("mongoose").Schema<Tou
121
134
  }, "id"> & {
122
135
  id: string;
123
136
  }>;
137
+ isTemplate?: import("mongoose").SchemaDefinitionProperty<boolean, TournamentOneTableRoom, Document<unknown, {}, TournamentOneTableRoom, {
138
+ id: string;
139
+ }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TournamentOneTableRoom & {
140
+ _id: import("mongoose").Types.ObjectId;
141
+ } & {
142
+ __v: number;
143
+ }, "id"> & {
144
+ id: string;
145
+ }>;
146
+ templateId?: import("mongoose").SchemaDefinitionProperty<string, TournamentOneTableRoom, Document<unknown, {}, TournamentOneTableRoom, {
147
+ id: string;
148
+ }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TournamentOneTableRoom & {
149
+ _id: import("mongoose").Types.ObjectId;
150
+ } & {
151
+ __v: number;
152
+ }, "id"> & {
153
+ id: string;
154
+ }>;
155
+ type?: import("mongoose").SchemaDefinitionProperty<string, TournamentOneTableRoom, Document<unknown, {}, TournamentOneTableRoom, {
156
+ id: string;
157
+ }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TournamentOneTableRoom & {
158
+ _id: import("mongoose").Types.ObjectId;
159
+ } & {
160
+ __v: number;
161
+ }, "id"> & {
162
+ id: string;
163
+ }>;
164
+ description?: import("mongoose").SchemaDefinitionProperty<Record<string, string>, TournamentOneTableRoom, Document<unknown, {}, TournamentOneTableRoom, {
165
+ id: string;
166
+ }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TournamentOneTableRoom & {
167
+ _id: import("mongoose").Types.ObjectId;
168
+ } & {
169
+ __v: number;
170
+ }, "id"> & {
171
+ id: string;
172
+ }>;
173
+ maxParticipants?: import("mongoose").SchemaDefinitionProperty<number, TournamentOneTableRoom, Document<unknown, {}, TournamentOneTableRoom, {
174
+ id: string;
175
+ }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TournamentOneTableRoom & {
176
+ _id: import("mongoose").Types.ObjectId;
177
+ } & {
178
+ __v: number;
179
+ }, "id"> & {
180
+ id: string;
181
+ }>;
182
+ participants?: import("mongoose").SchemaDefinitionProperty<ITournamentParticipant[], TournamentOneTableRoom, Document<unknown, {}, TournamentOneTableRoom, {
183
+ id: string;
184
+ }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TournamentOneTableRoom & {
185
+ _id: import("mongoose").Types.ObjectId;
186
+ } & {
187
+ __v: number;
188
+ }, "id"> & {
189
+ id: string;
190
+ }>;
191
+ status?: import("mongoose").SchemaDefinitionProperty<string, TournamentOneTableRoom, Document<unknown, {}, TournamentOneTableRoom, {
192
+ id: string;
193
+ }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TournamentOneTableRoom & {
194
+ _id: import("mongoose").Types.ObjectId;
195
+ } & {
196
+ __v: number;
197
+ }, "id"> & {
198
+ id: string;
199
+ }>;
200
+ winners?: import("mongoose").SchemaDefinitionProperty<ITournamentWinner[], TournamentOneTableRoom, Document<unknown, {}, TournamentOneTableRoom, {
201
+ id: string;
202
+ }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TournamentOneTableRoom & {
203
+ _id: import("mongoose").Types.ObjectId;
204
+ } & {
205
+ __v: number;
206
+ }, "id"> & {
207
+ id: string;
208
+ }>;
209
+ createDate?: import("mongoose").SchemaDefinitionProperty<Date, TournamentOneTableRoom, Document<unknown, {}, TournamentOneTableRoom, {
210
+ id: string;
211
+ }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TournamentOneTableRoom & {
212
+ _id: import("mongoose").Types.ObjectId;
213
+ } & {
214
+ __v: number;
215
+ }, "id"> & {
216
+ id: string;
217
+ }>;
218
+ startDate?: import("mongoose").SchemaDefinitionProperty<Date, TournamentOneTableRoom, Document<unknown, {}, TournamentOneTableRoom, {
219
+ id: string;
220
+ }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TournamentOneTableRoom & {
221
+ _id: import("mongoose").Types.ObjectId;
222
+ } & {
223
+ __v: number;
224
+ }, "id"> & {
225
+ id: string;
226
+ }>;
227
+ finishDate?: import("mongoose").SchemaDefinitionProperty<Date, TournamentOneTableRoom, Document<unknown, {}, TournamentOneTableRoom, {
228
+ id: string;
229
+ }, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & Omit<TournamentOneTableRoom & {
230
+ _id: import("mongoose").Types.ObjectId;
231
+ } & {
232
+ __v: number;
233
+ }, "id"> & {
234
+ id: string;
235
+ }>;
124
236
  }, TournamentOneTableRoom>;
125
237
  //# sourceMappingURL=tournament_one_table_rooms.schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tournament_one_table_rooms.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/tournament_one_table_rooms.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEtD,MAAM,MAAM,8BAA8B,GAAG,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;AAEtF,qBACa,sBAAsB;IAM/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAGxB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAG9B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAGjC,SAAS,EAAE,MAAM,CAAC;IAGlB,GAAG,EAAE,MAAM,CAAC;IAGZ,WAAW,EAAE,MAAM,CAAC;IAGpB,QAAQ,EAAE,MAAM,CAAC;IAGjB,QAAQ,EAAE,MAAM,CAAC;IAGjB,SAAS,EAAE,MAAM,CAAC;IAGlB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB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CAAC,iBAAiB,CAAC,CAAC;IAGlC,UAAU,EAAE,IAAI,CAAC;IAGjB,SAAS,EAAE,IAAI,CAAC;IAGhB,UAAU,EAAE,IAAI,CAAC;CACpB;AAED,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAAuD,CAAC"}
@@ -21,7 +21,7 @@ __decorate([
21
21
  },
22
22
  }),
23
23
  __metadata("design:type", String)
24
- ], TournamentOneTableRoom.prototype, "roomId", void 0);
24
+ ], TournamentOneTableRoom.prototype, "tournamentId", void 0);
25
25
  __decorate([
26
26
  (0, mongoose_1.Prop)({ type: Object }),
27
27
  __metadata("design:type", Object)
@@ -58,6 +58,50 @@ __decorate([
58
58
  (0, mongoose_1.Prop)(),
59
59
  __metadata("design:type", String)
60
60
  ], TournamentOneTableRoom.prototype, "deckType", void 0);
61
+ __decorate([
62
+ (0, mongoose_1.Prop)(),
63
+ __metadata("design:type", Boolean)
64
+ ], TournamentOneTableRoom.prototype, "isTemplate", void 0);
65
+ __decorate([
66
+ (0, mongoose_1.Prop)(),
67
+ __metadata("design:type", String)
68
+ ], TournamentOneTableRoom.prototype, "templateId", void 0);
69
+ __decorate([
70
+ (0, mongoose_1.Prop)(),
71
+ __metadata("design:type", String)
72
+ ], TournamentOneTableRoom.prototype, "type", void 0);
73
+ __decorate([
74
+ (0, mongoose_1.Prop)({ type: Object }),
75
+ __metadata("design:type", Object)
76
+ ], TournamentOneTableRoom.prototype, "description", void 0);
77
+ __decorate([
78
+ (0, mongoose_1.Prop)(),
79
+ __metadata("design:type", Number)
80
+ ], TournamentOneTableRoom.prototype, "maxParticipants", void 0);
81
+ __decorate([
82
+ (0, mongoose_1.Prop)(),
83
+ __metadata("design:type", Array)
84
+ ], TournamentOneTableRoom.prototype, "participants", void 0);
85
+ __decorate([
86
+ (0, mongoose_1.Prop)(),
87
+ __metadata("design:type", String)
88
+ ], TournamentOneTableRoom.prototype, "status", void 0);
89
+ __decorate([
90
+ (0, mongoose_1.Prop)(),
91
+ __metadata("design:type", Array)
92
+ ], TournamentOneTableRoom.prototype, "winners", void 0);
93
+ __decorate([
94
+ (0, mongoose_1.Prop)(),
95
+ __metadata("design:type", Date)
96
+ ], TournamentOneTableRoom.prototype, "createDate", void 0);
97
+ __decorate([
98
+ (0, mongoose_1.Prop)(),
99
+ __metadata("design:type", Date)
100
+ ], TournamentOneTableRoom.prototype, "startDate", void 0);
101
+ __decorate([
102
+ (0, mongoose_1.Prop)(),
103
+ __metadata("design:type", Date)
104
+ ], TournamentOneTableRoom.prototype, "finishDate", void 0);
61
105
  exports.TournamentOneTableRoom = TournamentOneTableRoom = __decorate([
62
106
  (0, mongoose_1.Schema)({ collection: 'tournament_one_table_rooms' })
63
107
  ], TournamentOneTableRoom);
@@ -1 +1 @@
1
- {"version":3,"file":"tournament_one_table_rooms.schema.js","sourceRoot":"","sources":["../../src/schemas/tournament_one_table_rooms.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAwE;AAMjE,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;CAkClC,CAAA;AAlCY,wDAAsB;AAMtB;IALR,IAAA,kBAAO,EAAC;QACL,GAAG,EAAE;YACD,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC/B,CAAC;KACJ,CAAC;;sDACsB;AAGxB;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDACO;AAG9B;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wDACU;AAGjC;IADC,IAAA,eAAI,GAAE;;yDACW;AAGlB;IADC,IAAA,eAAI,GAAE;;mDACK;AAGZ;IADC,IAAA,eAAI,GAAE;;2DACa;AAGpB;IADC,IAAA,eAAI,GAAE;;wDACU;AAGjB;IADC,IAAA,eAAI,GAAE;;wDACU;AAGjB;IADC,IAAA,eAAI,GAAE;;yDACW;AAGlB;IADC,IAAA,eAAI,GAAE;;wDACW;iCAjCT,sBAAsB;IADlC,IAAA,iBAAM,EAAC,EAAE,UAAU,EAAE,4BAA4B,EAAE,CAAC;GACxC,sBAAsB,CAkClC;AAEY,QAAA,4BAA4B,GAAG,wBAAa,CAAC,cAAc,CAAC,sBAAsB,CAAC,CAAC"}
1
+ {"version":3,"file":"tournament_one_table_rooms.schema.js","sourceRoot":"","sources":["../../src/schemas/tournament_one_table_rooms.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAwE;AASjE,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;CAqElC,CAAA;AArEY,wDAAsB;AAMtB;IALR,IAAA,kBAAO,EAAC;QACL,GAAG,EAAE;YACD,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC/B,CAAC;KACJ,CAAC;;4DAC4B;AAG9B;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDACO;AAG9B;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wDACU;AAGjC;IADC,IAAA,eAAI,GAAE;;yDACW;AAGlB;IADC,IAAA,eAAI,GAAE;;mDACK;AAGZ;IADC,IAAA,eAAI,GAAE;;2DACa;AAGpB;IADC,IAAA,eAAI,GAAE;;wDACU;AAGjB;IADC,IAAA,eAAI,GAAE;;wDACU;AAGjB;IADC,IAAA,eAAI,GAAE;;yDACW;AAGlB;IADC,IAAA,eAAI,GAAE;;wDACW;AAKlB;IADC,IAAA,eAAI,GAAE;;0DACa;AAGpB;IADC,IAAA,eAAI,GAAE;;0DACa;AAGpB;IADC,IAAA,eAAI,GAAE;;oDACM;AAGb;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2DACa;AAGpC;IADC,IAAA,eAAI,GAAE;;+DACiB;AAGxB;IADC,IAAA,eAAI,GAAE;8BACO,KAAK;4DAAyB;AAG5C;IADC,IAAA,eAAI,GAAE;;sDACQ;AAGf;IADC,IAAA,eAAI,GAAE;8BACE,KAAK;uDAAoB;AAGlC;IADC,IAAA,eAAI,GAAE;8BACK,IAAI;0DAAC;AAGjB;IADC,IAAA,eAAI,GAAE;8BACI,IAAI;yDAAC;AAGhB;IADC,IAAA,eAAI,GAAE;8BACK,IAAI;0DAAC;iCApER,sBAAsB;IADlC,IAAA,iBAAM,EAAC,EAAE,UAAU,EAAE,4BAA4B,EAAE,CAAC;GACxC,sBAAsB,CAqElC;AAEY,QAAA,4BAA4B,GAAG,wBAAa,CAAC,cAAc,CAAC,sBAAsB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jp.db.schemas",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -56,8 +56,6 @@ import { TournamentOneTableRoom, TournamentOneTableRoomSchema, } from './schemas
56
56
  import type { TournamentOneTableRoomDocument } from './schemas/tournament_one_table_rooms.schema';
57
57
  import { TournamentManyTablesRoom, TournamentManyTablesRoomSchema } from './schemas/tournament_many_tables_rooms.schema';
58
58
  import type { TournamentManyTablesRoomDocument } from './schemas/tournament_many_tables_rooms.schema';
59
- import { TournamentResult, TournamentResultSchema } from './schemas/tournament_result.schema';
60
- import type { TournamentResultDocument } from './schemas/tournament_result.schema';
61
59
 
62
60
  import {
63
61
  AdminRepository,
@@ -76,7 +74,6 @@ import {
76
74
  SimpleRoomsRepository,
77
75
  TournamentOneTableRoomsRepository,
78
76
  TournamentManyTablesRoomsRepository,
79
- TournamentResultRepository,
80
77
  } from './repositories'
81
78
 
82
79
  export type {
@@ -109,7 +106,6 @@ export type {
109
106
  SimpleRoomDocument,
110
107
  TournamentOneTableRoomDocument,
111
108
  TournamentManyTablesRoomDocument,
112
- TournamentResultDocument,
113
109
  }
114
110
 
115
111
  export {
@@ -171,8 +167,6 @@ export {
171
167
  TournamentOneTableRoomSchema,
172
168
  TournamentManyTablesRoom,
173
169
  TournamentManyTablesRoomSchema,
174
- TournamentResult,
175
- TournamentResultSchema,
176
170
  }
177
171
 
178
172
  export {
@@ -192,5 +186,4 @@ export {
192
186
  SimpleRoomsRepository,
193
187
  TournamentOneTableRoomsRepository,
194
188
  TournamentManyTablesRoomsRepository,
195
- TournamentResultRepository,
196
189
  }
@@ -0,0 +1,5 @@
1
+ export interface ITournamentParticipant {
2
+ userId: string;
3
+ userName: string;
4
+ userAvatarUrl: string;
5
+ }
@@ -0,0 +1,6 @@
1
+ export enum TournamentStatusEnum {
2
+ STATE_WAITING_FOR_START = 'STATE_WAITING_FOR_START',
3
+ STATE_IN_PROGRESS = 'STATE_IN_PROGRESS',
4
+ STATE_FINISHED = 'STATE_FINISHED',
5
+ STATE_CANCELLED = 'STATE_CANCELLED',
6
+ }
@@ -0,0 +1,7 @@
1
+ export interface ITournamentWinner {
2
+ userId: string;
3
+ userName: string;
4
+ userAvatarUrl: string;
5
+ profit: number;
6
+ rank: number;
7
+ }
@@ -14,7 +14,6 @@ import { BalanceHistoryRepository } from './balance-history.repository';
14
14
  import { SimpleRoomsRepository } from './simple-rooms.repository';
15
15
  import { TournamentOneTableRoomsRepository } from './tournament-one-table-rooms.repository';
16
16
  import { TournamentManyTablesRoomsRepository } from './tournament-many-tables-rooms.repository';
17
- import { TournamentResultRepository } from './tournament-result.repository';
18
17
 
19
18
  export {
20
19
  AdminRepository,
@@ -33,5 +32,4 @@ export {
33
32
  SimpleRoomsRepository,
34
33
  TournamentOneTableRoomsRepository,
35
34
  TournamentManyTablesRoomsRepository,
36
- TournamentResultRepository,
37
35
  }
@@ -2,16 +2,88 @@ import { Injectable } from '@nestjs/common';
2
2
  import { InjectModel } from '@nestjs/mongoose';
3
3
  import { Model } from 'mongoose';
4
4
 
5
- import { TournamentManyTablesRoom, TournamentManyTablesRoomDocument } from '../';
5
+ import {
6
+ Notification,
7
+ TournamentManyTablesRoom,
8
+ TournamentManyTablesRoomDocument, TournamentOneTableRoomDocument,
9
+ } from '../';
10
+ import { ITournamentParticipant } from '../models/tournament-participant.interface';
11
+ import { TournamentStatusEnum } from '../models/tournament-status.enum';
12
+ import { ITournamentWinner } from '../models/tournament-winner.interface';
6
13
 
7
14
  @Injectable()
8
15
  export class TournamentManyTablesRoomsRepository {
9
- constructor (@InjectModel(TournamentManyTablesRoom.name) private roomModel: Model<TournamentManyTablesRoomDocument>) {
16
+ constructor (@InjectModel(TournamentManyTablesRoom.name) private tournamentModel: Model<TournamentManyTablesRoomDocument>) {
10
17
  }
11
18
 
12
- async findRooms (gameType: string): Promise<Array<TournamentManyTablesRoomDocument>> {
13
- return this.roomModel
14
- .find({ gameType })
19
+ async findTemplateById (templateId: string, gameType: string): Promise<TournamentOneTableRoomDocument | null> {
20
+ return this.tournamentModel
21
+ .findOne({ templateId, gameType })
15
22
  .exec();
16
23
  }
24
+
25
+ async findTournamentById (tournamentId: string): Promise<TournamentManyTablesRoomDocument | null> {
26
+ return this.tournamentModel
27
+ .findById(tournamentId)
28
+ .exec();
29
+ }
30
+
31
+ async findTournaments (gameType: string): Promise<Array<TournamentManyTablesRoomDocument>> {
32
+ return this.tournamentModel
33
+ .find({ gameType, isTemplate: false })
34
+ .exec();
35
+ }
36
+
37
+ async createTournament (tournament: Partial<TournamentManyTablesRoom>): Promise<TournamentManyTablesRoomDocument> {
38
+ return this.tournamentModel.create(tournament)
39
+ }
40
+
41
+ async updateTournament (tournamentId: string, tournament: Partial<TournamentManyTablesRoom>): Promise<void> {
42
+ await this.tournamentModel.findByIdAndUpdate(
43
+ tournamentId,
44
+ {
45
+ $set: {
46
+ ...tournament,
47
+ },
48
+ }).exec();
49
+ }
50
+
51
+ public async removeTournament (tournamentId: string): Promise<void> {
52
+ await this.tournamentModel.findByIdAndDelete(tournamentId);
53
+ }
54
+
55
+ async startTournament (tournamentId: string, participants: Array<ITournamentParticipant>): Promise<void> {
56
+ await this.tournamentModel.findByIdAndUpdate(
57
+ tournamentId,
58
+ {
59
+ $set: {
60
+ startDate: new Date(),
61
+ status: TournamentStatusEnum.STATE_IN_PROGRESS,
62
+ participants,
63
+ },
64
+ }).exec();
65
+ }
66
+
67
+ async cancelTournament (tournamentId: string): Promise<void> {
68
+ await this.tournamentModel.findByIdAndUpdate(
69
+ tournamentId,
70
+ {
71
+ $set: {
72
+ finishDate: new Date(),
73
+ status: TournamentStatusEnum.STATE_CANCELLED,
74
+ },
75
+ }).exec();
76
+ }
77
+
78
+ async finishTournament (tournamentId: string, winners: Array<ITournamentWinner>): Promise<void> {
79
+ await this.tournamentModel.findByIdAndUpdate(
80
+ tournamentId,
81
+ {
82
+ $set: {
83
+ finishDate: new Date(),
84
+ status: TournamentStatusEnum.STATE_FINISHED,
85
+ winners,
86
+ },
87
+ }).exec();
88
+ }
17
89
  }
@@ -3,15 +3,69 @@ import { InjectModel } from '@nestjs/mongoose';
3
3
  import { Model } from 'mongoose';
4
4
 
5
5
  import { TournamentOneTableRoom, TournamentOneTableRoomDocument } from '../';
6
+ import { ITournamentParticipant } from '../models/tournament-participant.interface';
7
+ import { TournamentStatusEnum } from '../models/tournament-status.enum';
8
+ import { ITournamentWinner } from '../models/tournament-winner.interface';
6
9
 
7
10
  @Injectable()
8
11
  export class TournamentOneTableRoomsRepository {
9
- constructor (@InjectModel(TournamentOneTableRoom.name) private roomModel: Model<TournamentOneTableRoomDocument>) {
12
+ constructor (@InjectModel(TournamentOneTableRoom.name) private tournamentModel: Model<TournamentOneTableRoomDocument>) {
10
13
  }
11
14
 
12
- async findRooms (gameType: string): Promise<Array<TournamentOneTableRoomDocument>> {
13
- return this.roomModel
14
- .find({ gameType })
15
+ async findTemplateById (templateId: string, gameType: string): Promise<TournamentOneTableRoomDocument | null> {
16
+ return this.tournamentModel
17
+ .findOne({ templateId, gameType })
15
18
  .exec();
16
19
  }
20
+
21
+ async findTournamentById (tournamentId: string): Promise<TournamentOneTableRoomDocument | null> {
22
+ return this.tournamentModel
23
+ .findById(tournamentId)
24
+ .exec();
25
+ }
26
+
27
+ async findTournaments (gameType: string): Promise<Array<TournamentOneTableRoomDocument>> {
28
+ return this.tournamentModel
29
+ .find({ gameType, isTemplate: false })
30
+ .exec();
31
+ }
32
+
33
+ async createTournament (tournament: Partial<TournamentOneTableRoom>): Promise<TournamentOneTableRoomDocument> {
34
+ return this.tournamentModel.create(tournament)
35
+ }
36
+
37
+ async startTournament (tournamentId: string, participants: Array<ITournamentParticipant>): Promise<void> {
38
+ await this.tournamentModel.findByIdAndUpdate(
39
+ tournamentId,
40
+ {
41
+ $set: {
42
+ startDate: new Date(),
43
+ status: TournamentStatusEnum.STATE_IN_PROGRESS,
44
+ participants,
45
+ },
46
+ }).exec();
47
+ }
48
+
49
+ async cancelTournament (tournamentId: string): Promise<void> {
50
+ await this.tournamentModel.findByIdAndUpdate(
51
+ tournamentId,
52
+ {
53
+ $set: {
54
+ finishDate: new Date(),
55
+ status: TournamentStatusEnum.STATE_CANCELLED,
56
+ },
57
+ }).exec();
58
+ }
59
+
60
+ async finishTournament (tournamentId: string, winners: Array<ITournamentWinner>): Promise<void> {
61
+ await this.tournamentModel.findByIdAndUpdate(
62
+ tournamentId,
63
+ {
64
+ $set: {
65
+ finishDate: new Date(),
66
+ status: TournamentStatusEnum.STATE_FINISHED,
67
+ winners,
68
+ },
69
+ }).exec();
70
+ }
17
71
  }
@@ -1,13 +1,10 @@
1
1
  import { Prop, Schema, SchemaFactory, Virtual } from '@nestjs/mongoose';
2
2
  import { Document, HydratedDocument } from 'mongoose';
3
3
 
4
- export type TournamentManyTablesRoomDocument = HydratedDocument<TournamentManyTablesRoom>;
4
+ import { ITournamentParticipant } from '../models/tournament-participant.interface';
5
+ import { ITournamentWinner } from '../models/tournament-winner.interface';
5
6
 
6
- export interface IParticipant {
7
- userId: string;
8
- userName: string;
9
- userAvatarUrl: string;
10
- }
7
+ export type TournamentManyTablesRoomDocument = HydratedDocument<TournamentManyTablesRoom>;
11
8
 
12
9
  @Schema({ collection: 'tournament_many_tables_rooms' })
13
10
  export class TournamentManyTablesRoom {
@@ -16,7 +13,7 @@ export class TournamentManyTablesRoom {
16
13
  return this._id.toString();
17
14
  },
18
15
  })
19
- readonly roomId: string;
16
+ readonly tournamentId: string;
20
17
 
21
18
  @Prop({ type: Object })
22
19
  title: Record<string, string>;
@@ -45,17 +42,22 @@ export class TournamentManyTablesRoom {
45
42
  @Prop()
46
43
  deckType?: string;
47
44
 
45
+ // tournament props
46
+
48
47
  @Prop()
49
- createDate: Date;
48
+ isTemplate: boolean;
50
49
 
51
50
  @Prop()
52
- startDate: Date;
51
+ templateId?: string;
52
+
53
+ @Prop()
54
+ type: string;
53
55
 
54
56
  @Prop({ type: Object })
55
57
  description: Record<string, string>;
56
58
 
57
59
  @Prop()
58
- participants: Array<IParticipant>;
60
+ participants: Array<ITournamentParticipant>;
59
61
 
60
62
  @Prop()
61
63
  maxParticipants: number;
@@ -64,7 +66,16 @@ export class TournamentManyTablesRoom {
64
66
  status: string;
65
67
 
66
68
  @Prop()
67
- type: string;
69
+ winners: Array<ITournamentWinner>;
70
+
71
+ @Prop()
72
+ createDate: Date;
73
+
74
+ @Prop()
75
+ startDate: Date;
76
+
77
+ @Prop()
78
+ finishDate: Date;
68
79
  }
69
80
 
70
81
  export const TournamentManyTablesRoomSchema = SchemaFactory.createForClass(TournamentManyTablesRoom);
@@ -1,6 +1,9 @@
1
1
  import { Prop, Schema, SchemaFactory, Virtual } from '@nestjs/mongoose';
2
2
  import { Document, HydratedDocument } from 'mongoose';
3
3
 
4
+ import { ITournamentWinner } from '../models/tournament-winner.interface';
5
+ import { ITournamentParticipant } from '../models/tournament-participant.interface';
6
+
4
7
  export type TournamentOneTableRoomDocument = HydratedDocument<TournamentOneTableRoom>;
5
8
 
6
9
  @Schema({ collection: 'tournament_one_table_rooms' })
@@ -10,7 +13,7 @@ export class TournamentOneTableRoom {
10
13
  return this._id.toString();
11
14
  },
12
15
  })
13
- readonly roomId: string;
16
+ readonly tournamentId: string;
14
17
 
15
18
  @Prop({ type: Object })
16
19
  title: Record<string, string>;
@@ -38,6 +41,41 @@ export class TournamentOneTableRoom {
38
41
 
39
42
  @Prop()
40
43
  deckType?: string;
44
+
45
+ // tournament props
46
+
47
+ @Prop()
48
+ isTemplate: boolean;
49
+
50
+ @Prop()
51
+ templateId?: string;
52
+
53
+ @Prop()
54
+ type: string;
55
+
56
+ @Prop({ type: Object })
57
+ description: Record<string, string>;
58
+
59
+ @Prop()
60
+ maxParticipants: number;
61
+
62
+ @Prop()
63
+ participants: Array<ITournamentParticipant>;
64
+
65
+ @Prop()
66
+ status: string;
67
+
68
+ @Prop()
69
+ winners: Array<ITournamentWinner>;
70
+
71
+ @Prop()
72
+ createDate: Date;
73
+
74
+ @Prop()
75
+ startDate: Date;
76
+
77
+ @Prop()
78
+ finishDate: Date;
41
79
  }
42
80
 
43
81
  export const TournamentOneTableRoomSchema = SchemaFactory.createForClass(TournamentOneTableRoom);