jp.db.schemas 2.2.10 → 2.2.11

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 (83) hide show
  1. package/package.json +37 -37
  2. package/readme.md +3 -3
  3. package/src/index.ts +294 -294
  4. package/src/models/account-type.enum.ts +8 -8
  5. package/src/models/activity-log-user-login.interface.ts +10 -10
  6. package/src/models/activity-log.enum.ts +8 -8
  7. package/src/models/currency.enum.ts +6 -6
  8. package/src/models/rating-add-bulk-item.interface.ts +7 -7
  9. package/src/models/rating-monthly-result.interface.ts +11 -11
  10. package/src/models/tournament-participant.interface.ts +5 -5
  11. package/src/models/tournament-status.enum.ts +6 -6
  12. package/src/models/tournament-template.enum.ts +3 -3
  13. package/src/models/tournament-winner.interface.ts +7 -7
  14. package/src/models/users-balance-reason.enum.ts +8 -8
  15. package/src/repositories/achievement.repository.ts +17 -17
  16. package/src/repositories/activity-log.repository.ts +209 -209
  17. package/src/repositories/admin.repository.ts +20 -20
  18. package/src/repositories/article.repository.ts +24 -24
  19. package/src/repositories/banners.repository.ts +60 -60
  20. package/src/repositories/complains.repository.ts +31 -31
  21. package/src/repositories/daily-bonus.repository.ts +32 -32
  22. package/src/repositories/friend.repository.ts +24 -24
  23. package/src/repositories/game-result.repository.ts +19 -19
  24. package/src/repositories/game-statistic.repository.ts +25 -25
  25. package/src/repositories/index.ts +61 -61
  26. package/src/repositories/menu.repository.ts +19 -19
  27. package/src/repositories/notification.repository.ts +59 -59
  28. package/src/repositories/premium.repository.ts +16 -16
  29. package/src/repositories/products.repository.ts +30 -30
  30. package/src/repositories/purchase.repository.ts +111 -111
  31. package/src/repositories/rating.repository.ts +90 -90
  32. package/src/repositories/rooms.repository.ts +14 -14
  33. package/src/repositories/rule.repository.ts +14 -14
  34. package/src/repositories/scheduled-tournaments.repository.ts +35 -35
  35. package/src/repositories/servers.repository.ts +16 -16
  36. package/src/repositories/setting.repository.ts +24 -24
  37. package/src/repositories/settings-options.repository.ts +17 -17
  38. package/src/repositories/simple-rooms.repository.ts +16 -16
  39. package/src/repositories/tournament-many-tables-rooms.repository.ts +171 -171
  40. package/src/repositories/tournament-one-table-rooms.repository.ts +142 -142
  41. package/src/repositories/users-achievements.repository.ts +46 -46
  42. package/src/repositories/users-balances.repository.ts +65 -65
  43. package/src/repositories/users.repository.ts +153 -153
  44. package/src/repositories/welcome.repository.ts +16 -16
  45. package/src/schemas/achievement.schema.ts +40 -40
  46. package/src/schemas/activity_log.schema.ts +37 -37
  47. package/src/schemas/admin.schema.ts +22 -22
  48. package/src/schemas/article.schema.ts +37 -37
  49. package/src/schemas/banner.schema.ts +40 -40
  50. package/src/schemas/channel_message.schema.ts +32 -32
  51. package/src/schemas/complain.schema.ts +46 -46
  52. package/src/schemas/daily_bonus.schema.ts +49 -49
  53. package/src/schemas/feature.schema.ts +28 -28
  54. package/src/schemas/friend.schema.ts +49 -49
  55. package/src/schemas/game_result.schema.ts +68 -68
  56. package/src/schemas/game_statistic.schema.ts +40 -40
  57. package/src/schemas/menu.schema.ts +37 -37
  58. package/src/schemas/notification.schema.ts +61 -61
  59. package/src/schemas/premium.schema.ts +37 -37
  60. package/src/schemas/product.schema.ts +111 -111
  61. package/src/schemas/purchase.schema.ts +61 -61
  62. package/src/schemas/purchase_channel.schema.ts +32 -32
  63. package/src/schemas/rating.schema.ts +37 -37
  64. package/src/schemas/rooms.schema.ts +63 -63
  65. package/src/schemas/rule.schema.ts +37 -37
  66. package/src/schemas/scheduled_tournament.schema.ts +94 -94
  67. package/src/schemas/server.schema.ts +22 -22
  68. package/src/schemas/setting.schema.ts +49 -49
  69. package/src/schemas/settings_option.schema.ts +41 -41
  70. package/src/schemas/simple_rooms.schema.ts +49 -49
  71. package/src/schemas/tournament_many_tables_rooms.schema.ts +87 -87
  72. package/src/schemas/tournament_one_table_rooms.schema.ts +84 -84
  73. package/src/schemas/user.fb.schema.ts +33 -33
  74. package/src/schemas/user.google.schema.ts +24 -24
  75. package/src/schemas/user.ok.schema.ts +53 -53
  76. package/src/schemas/user.schema.ts +160 -160
  77. package/src/schemas/user.tg.schema.ts +30 -30
  78. package/src/schemas/user.vk.schema.ts +70 -70
  79. package/src/schemas/user.ya.schema.ts +24 -24
  80. package/src/schemas/users_achievement.schema.ts +41 -41
  81. package/src/schemas/users_balance.schema.ts +34 -34
  82. package/src/schemas/welcome.schema.ts +37 -37
  83. package/src/utils.ts +3 -3
@@ -1,59 +1,59 @@
1
- import { Injectable } from '@nestjs/common';
2
- import { InjectModel } from '@nestjs/mongoose';
3
- import { Model } from 'mongoose';
4
-
5
- import { Notification, NotificationDocument } from '../';
6
-
7
- @Injectable()
8
- export class NotificationRepository {
9
- constructor(
10
- @InjectModel(Notification.name)
11
- private notificationModel: Model<NotificationDocument>,
12
- ) {}
13
-
14
- async findById(id: string): Promise<Notification | null> {
15
- return this.notificationModel.findById(id).exec();
16
- }
17
-
18
- async findAndCount(
19
- limit: number,
20
- skip: number,
21
- ): Promise<{
22
- items: Array<Notification>;
23
- total: number;
24
- }> {
25
- const items = await this.notificationModel
26
- .find()
27
- .sort({ createDate: -1 })
28
- .limit(limit)
29
- .skip(skip)
30
- .exec();
31
-
32
- const total = await this.notificationModel.find().countDocuments().exec();
33
-
34
- return { items, total };
35
- }
36
-
37
- public async crateNotification(
38
- notification: Notification,
39
- ): Promise<Notification> {
40
- return this.notificationModel.create(notification);
41
- }
42
-
43
- async updateNotification(
44
- notificationId: string,
45
- notification: Partial<Notification>,
46
- ): Promise<void> {
47
- await this.notificationModel
48
- .findByIdAndUpdate(notificationId, {
49
- $set: {
50
- ...notification,
51
- },
52
- })
53
- .exec();
54
- }
55
-
56
- public async removeNotification(notificationId: string): Promise<void> {
57
- await this.notificationModel.findByIdAndDelete(notificationId);
58
- }
59
- }
1
+ import { Injectable } from '@nestjs/common';
2
+ import { InjectModel } from '@nestjs/mongoose';
3
+ import { Model } from 'mongoose';
4
+
5
+ import { Notification, NotificationDocument } from '../';
6
+
7
+ @Injectable()
8
+ export class NotificationRepository {
9
+ constructor(
10
+ @InjectModel(Notification.name)
11
+ private notificationModel: Model<NotificationDocument>,
12
+ ) {}
13
+
14
+ async findById(id: string): Promise<Notification | null> {
15
+ return this.notificationModel.findById(id).exec();
16
+ }
17
+
18
+ async findAndCount(
19
+ limit: number,
20
+ skip: number,
21
+ ): Promise<{
22
+ items: Array<Notification>;
23
+ total: number;
24
+ }> {
25
+ const items = await this.notificationModel
26
+ .find()
27
+ .sort({ createDate: -1 })
28
+ .limit(limit)
29
+ .skip(skip)
30
+ .exec();
31
+
32
+ const total = await this.notificationModel.find().countDocuments().exec();
33
+
34
+ return { items, total };
35
+ }
36
+
37
+ public async crateNotification(
38
+ notification: Notification,
39
+ ): Promise<Notification> {
40
+ return this.notificationModel.create(notification);
41
+ }
42
+
43
+ async updateNotification(
44
+ notificationId: string,
45
+ notification: Partial<Notification>,
46
+ ): Promise<void> {
47
+ await this.notificationModel
48
+ .findByIdAndUpdate(notificationId, {
49
+ $set: {
50
+ ...notification,
51
+ },
52
+ })
53
+ .exec();
54
+ }
55
+
56
+ public async removeNotification(notificationId: string): Promise<void> {
57
+ await this.notificationModel.findByIdAndDelete(notificationId);
58
+ }
59
+ }
@@ -1,16 +1,16 @@
1
- import { Injectable } from '@nestjs/common';
2
- import { InjectModel } from '@nestjs/mongoose';
3
- import { Model } from 'mongoose';
4
-
5
- import { Premium, PremiumDocument } from '..';
6
-
7
- @Injectable()
8
- export class PremiumRepository {
9
- constructor(
10
- @InjectModel(Premium.name) private premiumModel: Model<PremiumDocument>,
11
- ) {}
12
-
13
- async findPremium(gameType: string): Promise<Premium | null> {
14
- return this.premiumModel.findOne({ gameType }).exec();
15
- }
16
- }
1
+ import { Injectable } from '@nestjs/common';
2
+ import { InjectModel } from '@nestjs/mongoose';
3
+ import { Model } from 'mongoose';
4
+
5
+ import { Premium, PremiumDocument } from '..';
6
+
7
+ @Injectable()
8
+ export class PremiumRepository {
9
+ constructor(
10
+ @InjectModel(Premium.name) private premiumModel: Model<PremiumDocument>,
11
+ ) {}
12
+
13
+ async findPremium(gameType: string): Promise<Premium | null> {
14
+ return this.premiumModel.findOne({ gameType }).exec();
15
+ }
16
+ }
@@ -1,30 +1,30 @@
1
- import { Injectable } from '@nestjs/common';
2
- import { InjectModel } from '@nestjs/mongoose';
3
- import { Model } from 'mongoose';
4
-
5
- import { Product, ProductDocument } from '../';
6
- import { getChannelRegExpFilter } from '../utils';
7
-
8
- @Injectable()
9
- export class ProductsRepository {
10
- constructor(
11
- @InjectModel(Product.name) private productModel: Model<ProductDocument>,
12
- ) {}
13
-
14
- async findByProductId(productId: string): Promise<Product | null> {
15
- return this.productModel.findOne({ productId }).exec();
16
- }
17
-
18
- async findProducts(
19
- parentId: string | null,
20
- channel: string,
21
- ): Promise<Array<Product> | null> {
22
- return this.productModel
23
- .find({
24
- parentId,
25
- active: true,
26
- channels: getChannelRegExpFilter(channel),
27
- })
28
- .exec();
29
- }
30
- }
1
+ import { Injectable } from '@nestjs/common';
2
+ import { InjectModel } from '@nestjs/mongoose';
3
+ import { Model } from 'mongoose';
4
+
5
+ import { Product, ProductDocument } from '../';
6
+ import { getChannelRegExpFilter } from '../utils';
7
+
8
+ @Injectable()
9
+ export class ProductsRepository {
10
+ constructor(
11
+ @InjectModel(Product.name) private productModel: Model<ProductDocument>,
12
+ ) {}
13
+
14
+ async findByProductId(productId: string): Promise<Product | null> {
15
+ return this.productModel.findOne({ productId }).exec();
16
+ }
17
+
18
+ async findProducts(
19
+ parentId: string | null,
20
+ channel: string,
21
+ ): Promise<Array<Product> | null> {
22
+ return this.productModel
23
+ .find({
24
+ parentId,
25
+ active: true,
26
+ channels: getChannelRegExpFilter(channel),
27
+ })
28
+ .exec();
29
+ }
30
+ }
@@ -1,111 +1,111 @@
1
- import { Injectable } from '@nestjs/common';
2
- import { InjectModel } from '@nestjs/mongoose';
3
- import { Model } from 'mongoose';
4
-
5
- import { Purchase, PurchaseDocument } from '..';
6
- import { CurrencyEnum } from '../models/currency.enum';
7
-
8
- @Injectable()
9
- export class PurchaseRepository {
10
- constructor(
11
- @InjectModel(Purchase.name) private purchaseModel: Model<PurchaseDocument>,
12
- ) {}
13
-
14
- async findPurchasesByUserId(userId: string): Promise<Array<Purchase>> {
15
- return this.purchaseModel.find({ userId }).exec();
16
- }
17
-
18
- async findPurchaseByVKOrderId(vkOrderId: number): Promise<Purchase | null> {
19
- return this.purchaseModel.findOne({ vkOrderId }).exec();
20
- }
21
-
22
- async findPurchaseByYaOrderId(yaOrderId: string): Promise<Purchase | null> {
23
- return this.purchaseModel.findOne({ yaOrderId }).exec();
24
- }
25
-
26
- async addVKPurchase(
27
- userId: string,
28
- userName: string,
29
- productId: string,
30
- productCode: string,
31
- productName: string,
32
- price: number,
33
- vkOrderId: number,
34
- token: string,
35
- game: string,
36
- ): Promise<Purchase> {
37
- return this.addPurchase({
38
- userId,
39
- userName,
40
- productId,
41
- productCode,
42
- productName,
43
- price,
44
- currency: CurrencyEnum.VK_VOTES,
45
- vkOrderId,
46
- token,
47
- game,
48
- });
49
- }
50
-
51
- async addYAPUrchase(
52
- userId: string,
53
- userName: string,
54
- productId: string,
55
- productCode: string,
56
- productName: string,
57
- price: number,
58
- yaOrderId: string,
59
- token: string,
60
- game: string,
61
- ): Promise<Purchase> {
62
- return this.addPurchase({
63
- userId,
64
- userName,
65
- productId,
66
- productCode,
67
- productName,
68
- price,
69
- currency: CurrencyEnum.YAN,
70
- yaOrderId,
71
- token,
72
- game,
73
- });
74
- }
75
-
76
- async addManyTablesTournamentTicketPurchase(
77
- userId: string,
78
- userName: string,
79
- tournamentId: string,
80
- price: number,
81
- game: string,
82
- ): Promise<Purchase> {
83
- return this.addPurchase({
84
- userId,
85
- userName,
86
- productId: '6a192b118e596305dc9d0484',
87
- productCode: 'tournament_ticket__evening',
88
- productName: 'Ticket on evenint tournament',
89
- tournamentId,
90
- price,
91
- currency: CurrencyEnum.JP,
92
- game,
93
- });
94
- }
95
-
96
- async addPurchase(purchase: Partial<Purchase>): Promise<Purchase> {
97
- return this.purchaseModel.create(purchase);
98
- }
99
-
100
- async removeByVKOkderId(vkOrderId: number): Promise<Purchase | null> {
101
- return this.purchaseModel
102
- .findOneAndUpdate(
103
- { vkOrderId },
104
- {
105
- removed: true,
106
- },
107
- { new: true },
108
- )
109
- .exec();
110
- }
111
- }
1
+ import { Injectable } from '@nestjs/common';
2
+ import { InjectModel } from '@nestjs/mongoose';
3
+ import { Model } from 'mongoose';
4
+
5
+ import { Purchase, PurchaseDocument } from '..';
6
+ import { CurrencyEnum } from '../models/currency.enum';
7
+
8
+ @Injectable()
9
+ export class PurchaseRepository {
10
+ constructor(
11
+ @InjectModel(Purchase.name) private purchaseModel: Model<PurchaseDocument>,
12
+ ) {}
13
+
14
+ async findPurchasesByUserId(userId: string): Promise<Array<Purchase>> {
15
+ return this.purchaseModel.find({ userId }).exec();
16
+ }
17
+
18
+ async findPurchaseByVKOrderId(vkOrderId: number): Promise<Purchase | null> {
19
+ return this.purchaseModel.findOne({ vkOrderId }).exec();
20
+ }
21
+
22
+ async findPurchaseByYaOrderId(yaOrderId: string): Promise<Purchase | null> {
23
+ return this.purchaseModel.findOne({ yaOrderId }).exec();
24
+ }
25
+
26
+ async addVKPurchase(
27
+ userId: string,
28
+ userName: string,
29
+ productId: string,
30
+ productCode: string,
31
+ productName: string,
32
+ price: number,
33
+ vkOrderId: number,
34
+ token: string,
35
+ game: string,
36
+ ): Promise<Purchase> {
37
+ return this.addPurchase({
38
+ userId,
39
+ userName,
40
+ productId,
41
+ productCode,
42
+ productName,
43
+ price,
44
+ currency: CurrencyEnum.VK_VOTES,
45
+ vkOrderId,
46
+ token,
47
+ game,
48
+ });
49
+ }
50
+
51
+ async addYAPUrchase(
52
+ userId: string,
53
+ userName: string,
54
+ productId: string,
55
+ productCode: string,
56
+ productName: string,
57
+ price: number,
58
+ yaOrderId: string,
59
+ token: string,
60
+ game: string,
61
+ ): Promise<Purchase> {
62
+ return this.addPurchase({
63
+ userId,
64
+ userName,
65
+ productId,
66
+ productCode,
67
+ productName,
68
+ price,
69
+ currency: CurrencyEnum.YAN,
70
+ yaOrderId,
71
+ token,
72
+ game,
73
+ });
74
+ }
75
+
76
+ async addManyTablesTournamentTicketPurchase(
77
+ userId: string,
78
+ userName: string,
79
+ tournamentId: string,
80
+ price: number,
81
+ game: string,
82
+ ): Promise<Purchase> {
83
+ return this.addPurchase({
84
+ userId,
85
+ userName,
86
+ productId: '6a192b118e596305dc9d0484',
87
+ productCode: 'tournament_ticket__evening',
88
+ productName: 'Ticket on evenint tournament',
89
+ tournamentId,
90
+ price,
91
+ currency: CurrencyEnum.JP,
92
+ game,
93
+ });
94
+ }
95
+
96
+ async addPurchase(purchase: Partial<Purchase>): Promise<Purchase> {
97
+ return this.purchaseModel.create(purchase);
98
+ }
99
+
100
+ async removeByVKOkderId(vkOrderId: number): Promise<Purchase | null> {
101
+ return this.purchaseModel
102
+ .findOneAndUpdate(
103
+ { vkOrderId },
104
+ {
105
+ removed: true,
106
+ },
107
+ { new: true },
108
+ )
109
+ .exec();
110
+ }
111
+ }
@@ -1,90 +1,90 @@
1
- import { Injectable } from '@nestjs/common';
2
- import { InjectModel } from '@nestjs/mongoose';
3
- import { Model } from 'mongoose';
4
-
5
- import { Rating, RatingDocument } from '..';
6
- import { getChannelRegExpFilter } from '../utils';
7
- import { IRatingMonthlyResult } from '../models/rating-monthly-result.interface';
8
-
9
- @Injectable()
10
- export class RatingRepository {
11
- constructor(
12
- @InjectModel(Rating.name) private ratingModel: Model<RatingDocument>,
13
- ) {}
14
-
15
- async findRating(
16
- channel: string,
17
- game: string,
18
- ): Promise<Array<Rating> | null> {
19
- return this.ratingModel
20
- .find({
21
- channels: getChannelRegExpFilter(channel),
22
- })
23
- .exec();
24
- }
25
-
26
- async addBulkPlayerRating(items: Array<Rating>): Promise<void> {
27
- await this.ratingModel.insertMany(items);
28
- }
29
-
30
- async getMonthlyRatingList(
31
- game: string,
32
- startDate: Date,
33
- endDate: Date,
34
- ): Promise<Array<IRatingMonthlyResult>> {
35
- return this.ratingModel.aggregate([
36
- {
37
- $match: {
38
- game,
39
- date: {
40
- $gte: startDate,
41
- $lte: endDate,
42
- },
43
- },
44
- },
45
- {
46
- $group: {
47
- _id: {
48
- userId: '$userId',
49
- date: {
50
- $dateToString: {
51
- format: '%Y-%m',
52
- date: '$date',
53
- },
54
- },
55
- },
56
- userId: { $first: '$userId' },
57
- userName: { $first: '$userName' },
58
- userAvatarUrl: { $first: '$userAvatarUrl' },
59
- game: { $first: '$game' },
60
- channels: { $first: '$channels' },
61
- count: { $sum: 1 },
62
- profit: { $sum: '$profit' },
63
- },
64
- },
65
- {
66
- $sort: { profit: -1 },
67
- },
68
- {
69
- $setWindowFields: {
70
- sortBy: { profit: -1 },
71
- output: { rank: { $rank: {} } },
72
- },
73
- },
74
- {
75
- $project: {
76
- _id: 0,
77
- id: { $concat: ['$_id.userId', '_', '$_id.date'] },
78
- userId: 1,
79
- userName: 1,
80
- userAvatarUrl: 1,
81
- game: 1,
82
- channels: 1,
83
- count: 1,
84
- date: '$_id.date',
85
- rank: 1,
86
- },
87
- },
88
- ]);
89
- }
90
- }
1
+ import { Injectable } from '@nestjs/common';
2
+ import { InjectModel } from '@nestjs/mongoose';
3
+ import { Model } from 'mongoose';
4
+
5
+ import { Rating, RatingDocument } from '..';
6
+ import { getChannelRegExpFilter } from '../utils';
7
+ import { IRatingMonthlyResult } from '../models/rating-monthly-result.interface';
8
+
9
+ @Injectable()
10
+ export class RatingRepository {
11
+ constructor(
12
+ @InjectModel(Rating.name) private ratingModel: Model<RatingDocument>,
13
+ ) {}
14
+
15
+ async findRating(
16
+ channel: string,
17
+ game: string,
18
+ ): Promise<Array<Rating> | null> {
19
+ return this.ratingModel
20
+ .find({
21
+ channels: getChannelRegExpFilter(channel),
22
+ })
23
+ .exec();
24
+ }
25
+
26
+ async addBulkPlayerRating(items: Array<Rating>): Promise<void> {
27
+ await this.ratingModel.insertMany(items);
28
+ }
29
+
30
+ async getMonthlyRatingList(
31
+ game: string,
32
+ startDate: Date,
33
+ endDate: Date,
34
+ ): Promise<Array<IRatingMonthlyResult>> {
35
+ return this.ratingModel.aggregate([
36
+ {
37
+ $match: {
38
+ game,
39
+ date: {
40
+ $gte: startDate,
41
+ $lte: endDate,
42
+ },
43
+ },
44
+ },
45
+ {
46
+ $group: {
47
+ _id: {
48
+ userId: '$userId',
49
+ date: {
50
+ $dateToString: {
51
+ format: '%Y-%m',
52
+ date: '$date',
53
+ },
54
+ },
55
+ },
56
+ userId: { $first: '$userId' },
57
+ userName: { $first: '$userName' },
58
+ userAvatarUrl: { $first: '$userAvatarUrl' },
59
+ game: { $first: '$game' },
60
+ channels: { $first: '$channels' },
61
+ count: { $sum: 1 },
62
+ profit: { $sum: '$profit' },
63
+ },
64
+ },
65
+ {
66
+ $sort: { profit: -1 },
67
+ },
68
+ {
69
+ $setWindowFields: {
70
+ sortBy: { profit: -1 },
71
+ output: { rank: { $rank: {} } },
72
+ },
73
+ },
74
+ {
75
+ $project: {
76
+ _id: 0,
77
+ id: { $concat: ['$_id.userId', '_', '$_id.date'] },
78
+ userId: 1,
79
+ userName: 1,
80
+ userAvatarUrl: 1,
81
+ game: 1,
82
+ channels: 1,
83
+ count: 1,
84
+ date: '$_id.date',
85
+ rank: 1,
86
+ },
87
+ },
88
+ ]);
89
+ }
90
+ }
@@ -1,14 +1,14 @@
1
- import { Injectable } from '@nestjs/common';
2
- import { InjectModel } from '@nestjs/mongoose';
3
- import { Model } from 'mongoose';
4
-
5
- import { Room, RoomDocument } from '../';
6
-
7
- @Injectable()
8
- export class RoomsRepository {
9
- constructor(@InjectModel(Room.name) private roomModel: Model<RoomDocument>) {}
10
-
11
- async findRooms(gameType: string): Promise<Array<RoomDocument>> {
12
- return this.roomModel.find({ gameType }).exec();
13
- }
14
- }
1
+ import { Injectable } from '@nestjs/common';
2
+ import { InjectModel } from '@nestjs/mongoose';
3
+ import { Model } from 'mongoose';
4
+
5
+ import { Room, RoomDocument } from '../';
6
+
7
+ @Injectable()
8
+ export class RoomsRepository {
9
+ constructor(@InjectModel(Room.name) private roomModel: Model<RoomDocument>) {}
10
+
11
+ async findRooms(gameType: string): Promise<Array<RoomDocument>> {
12
+ return this.roomModel.find({ gameType }).exec();
13
+ }
14
+ }
@@ -1,14 +1,14 @@
1
- import { Injectable } from '@nestjs/common';
2
- import { InjectModel } from '@nestjs/mongoose';
3
- import { Model } from 'mongoose';
4
-
5
- import { Rule, RuleDocument } from '..';
6
-
7
- @Injectable()
8
- export class RuleRepository {
9
- constructor(@InjectModel(Rule.name) private ruleModel: Model<RuleDocument>) {}
10
-
11
- async findRule(gameType: string): Promise<Rule | null> {
12
- return this.ruleModel.findOne({ gameType }).exec();
13
- }
14
- }
1
+ import { Injectable } from '@nestjs/common';
2
+ import { InjectModel } from '@nestjs/mongoose';
3
+ import { Model } from 'mongoose';
4
+
5
+ import { Rule, RuleDocument } from '..';
6
+
7
+ @Injectable()
8
+ export class RuleRepository {
9
+ constructor(@InjectModel(Rule.name) private ruleModel: Model<RuleDocument>) {}
10
+
11
+ async findRule(gameType: string): Promise<Rule | null> {
12
+ return this.ruleModel.findOne({ gameType }).exec();
13
+ }
14
+ }