jp.db.schemas 1.0.17 → 1.0.19

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 (121) hide show
  1. package/dist/index.d.ts +18 -2
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +33 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/repositories/admin.repository.d.ts +9 -0
  6. package/dist/repositories/admin.repository.d.ts.map +1 -0
  7. package/dist/repositories/admin.repository.js +41 -0
  8. package/dist/repositories/admin.repository.js.map +1 -0
  9. package/dist/repositories/article.repository.d.ts +10 -0
  10. package/dist/repositories/article.repository.d.ts.map +1 -0
  11. package/dist/repositories/article.repository.js +50 -0
  12. package/dist/repositories/article.repository.js.map +1 -0
  13. package/dist/repositories/banners.repository.d.ts +15 -0
  14. package/dist/repositories/banners.repository.d.ts.map +1 -0
  15. package/dist/repositories/banners.repository.js +60 -0
  16. package/dist/repositories/banners.repository.js.map +1 -0
  17. package/dist/repositories/complains.repository.d.ts +11 -0
  18. package/dist/repositories/complains.repository.d.ts.map +1 -0
  19. package/dist/repositories/complains.repository.js +44 -0
  20. package/dist/repositories/complains.repository.js.map +1 -0
  21. package/dist/repositories/index.d.ts +11 -0
  22. package/dist/repositories/index.d.ts.map +1 -0
  23. package/dist/repositories/index.js +22 -0
  24. package/dist/repositories/index.js.map +1 -0
  25. package/dist/repositories/notification.repository.d.ts +15 -0
  26. package/dist/repositories/notification.repository.d.ts.map +1 -0
  27. package/dist/repositories/notification.repository.js +60 -0
  28. package/dist/repositories/notification.repository.js.map +1 -0
  29. package/dist/repositories/products.repository.d.ts +9 -0
  30. package/dist/repositories/products.repository.d.ts.map +1 -0
  31. package/dist/repositories/products.repository.js +46 -0
  32. package/dist/repositories/products.repository.js.map +1 -0
  33. package/dist/repositories/scheduled-tournaments.repository.d.ts +11 -0
  34. package/dist/repositories/scheduled-tournaments.repository.d.ts.map +1 -0
  35. package/dist/repositories/scheduled-tournaments.repository.js +44 -0
  36. package/dist/repositories/scheduled-tournaments.repository.js.map +1 -0
  37. package/dist/repositories/servers.repository.d.ts +8 -0
  38. package/dist/repositories/servers.repository.d.ts.map +1 -0
  39. package/dist/repositories/servers.repository.js +36 -0
  40. package/dist/repositories/servers.repository.js.map +1 -0
  41. package/dist/repositories/users.repository.d.ts +15 -0
  42. package/dist/repositories/users.repository.d.ts.map +1 -0
  43. package/dist/repositories/users.repository.js +70 -0
  44. package/dist/repositories/users.repository.js.map +1 -0
  45. package/dist/schemas/achievement.schema.d.ts +23 -0
  46. package/dist/schemas/achievement.schema.d.ts.map +1 -0
  47. package/dist/schemas/achievement.schema.js +61 -0
  48. package/dist/schemas/achievement.schema.js.map +1 -0
  49. package/dist/schemas/banner.schema.d.ts +1 -0
  50. package/dist/schemas/banner.schema.d.ts.map +1 -1
  51. package/dist/schemas/banner.schema.js +4 -0
  52. package/dist/schemas/banner.schema.js.map +1 -1
  53. package/dist/schemas/channel_message.schema.d.ts +20 -0
  54. package/dist/schemas/channel_message.schema.d.ts.map +1 -0
  55. package/dist/schemas/channel_message.schema.js +49 -0
  56. package/dist/schemas/channel_message.schema.js.map +1 -0
  57. package/dist/schemas/feature.schema.d.ts +19 -0
  58. package/dist/schemas/feature.schema.d.ts.map +1 -0
  59. package/dist/schemas/feature.schema.js +45 -0
  60. package/dist/schemas/feature.schema.js.map +1 -0
  61. package/dist/schemas/notification.schema.d.ts +1 -0
  62. package/dist/schemas/notification.schema.d.ts.map +1 -1
  63. package/dist/schemas/notification.schema.js +4 -0
  64. package/dist/schemas/notification.schema.js.map +1 -1
  65. package/dist/schemas/product.schema.d.ts +50 -0
  66. package/dist/schemas/product.schema.d.ts.map +1 -0
  67. package/dist/schemas/product.schema.js +169 -0
  68. package/dist/schemas/product.schema.js.map +1 -0
  69. package/dist/schemas/purchase.schema.d.ts +1 -0
  70. package/dist/schemas/purchase.schema.d.ts.map +1 -1
  71. package/dist/schemas/purchase.schema.js +4 -0
  72. package/dist/schemas/purchase.schema.js.map +1 -1
  73. package/dist/schemas/purchase_channel.schema.d.ts +20 -0
  74. package/dist/schemas/purchase_channel.schema.d.ts.map +1 -0
  75. package/dist/schemas/purchase_channel.schema.js +49 -0
  76. package/dist/schemas/purchase_channel.schema.js.map +1 -0
  77. package/dist/schemas/rating.schema.d.ts +25 -0
  78. package/dist/schemas/rating.schema.d.ts.map +1 -0
  79. package/dist/schemas/rating.schema.js +69 -0
  80. package/dist/schemas/rating.schema.js.map +1 -0
  81. package/dist/schemas/rooms.schema.d.ts +1 -0
  82. package/dist/schemas/rooms.schema.d.ts.map +1 -1
  83. package/dist/schemas/rooms.schema.js +4 -0
  84. package/dist/schemas/rooms.schema.js.map +1 -1
  85. package/dist/schemas/scheduled_tournament.schema.d.ts +1 -0
  86. package/dist/schemas/scheduled_tournament.schema.d.ts.map +1 -1
  87. package/dist/schemas/scheduled_tournament.schema.js +4 -0
  88. package/dist/schemas/scheduled_tournament.schema.js.map +1 -1
  89. package/dist/schemas/setting.schema.d.ts +24 -0
  90. package/dist/schemas/setting.schema.d.ts.map +1 -0
  91. package/dist/schemas/setting.schema.js +65 -0
  92. package/dist/schemas/setting.schema.js.map +1 -0
  93. package/dist/utils.d.ts +2 -0
  94. package/dist/utils.d.ts.map +1 -0
  95. package/dist/utils.js +7 -0
  96. package/dist/utils.js.map +1 -0
  97. package/package.json +1 -1
  98. package/src/index.ts +59 -0
  99. package/src/repositories/admin.repository.ts +23 -0
  100. package/src/repositories/article.repository.ts +33 -0
  101. package/src/repositories/banners.repository.ts +54 -0
  102. package/src/repositories/complains.repository.ts +30 -0
  103. package/src/repositories/index.ts +21 -0
  104. package/src/repositories/notification.repository.ts +54 -0
  105. package/src/repositories/products.repository.ts +29 -0
  106. package/src/repositories/scheduled-tournaments.repository.ts +30 -0
  107. package/src/repositories/servers.repository.ts +18 -0
  108. package/src/repositories/users.repository.ts +69 -0
  109. package/src/schemas/achievement.schema.ts +40 -0
  110. package/src/schemas/banner.schema.ts +3 -0
  111. package/src/schemas/channel_message.schema.ts +31 -0
  112. package/src/schemas/feature.schema.ts +28 -0
  113. package/src/schemas/notification.schema.ts +3 -0
  114. package/src/schemas/product.schema.ts +123 -0
  115. package/src/schemas/purchase.schema.ts +3 -0
  116. package/src/schemas/purchase_channel.schema.ts +31 -0
  117. package/src/schemas/rating.schema.ts +46 -0
  118. package/src/schemas/rooms.schema.ts +3 -0
  119. package/src/schemas/scheduled_tournament.schema.ts +3 -0
  120. package/src/schemas/setting.schema.ts +43 -0
  121. package/src/utils.ts +3 -0
package/src/index.ts CHANGED
@@ -30,6 +30,32 @@ import { Banner, BannerSchema } from './schemas/banner.schema';
30
30
  import type { BannerDocument } from './schemas/banner.schema';
31
31
  import { Server, ServerSchema } from './schemas/server.schema';
32
32
  import type { ServerDocument } from './schemas/server.schema';
33
+ import { Achievement, AchievementSchema } from './schemas/achievement.schema';
34
+ import type { AchievementDocument } from './schemas/achievement.schema';
35
+ import { ChannelMessage, ChannelMessageSchema } from './schemas/channel_message.schema';
36
+ import type { ChannelMessageDocument } from './schemas/channel_message.schema';
37
+ import { Feature, FeatureSchema } from './schemas/feature.schema';
38
+ import type { FeatureDocument } from './schemas/feature.schema';
39
+ import { Product, ProductSchema } from './schemas/product.schema';
40
+ import type { ProductDocument } from './schemas/product.schema';
41
+ import { PurchaseChannel, PurchaseChannelSchema } from './schemas/purchase_channel.schema';
42
+ import type { PurchaseChannelDocument } from './schemas/purchase_channel.schema';
43
+ import { Rating, RatingSchema } from './schemas/rating.schema';
44
+ import type { RatingDocument } from './schemas/rating.schema';
45
+ import { Setting, SettingSchema } from './schemas/setting.schema';
46
+ import type { SettingDocument } from './schemas/setting.schema';
47
+
48
+ import {
49
+ AdminRepository,
50
+ ArticleRepository,
51
+ BannersRepository,
52
+ ComplainsRepository,
53
+ NotificationRepository,
54
+ ProductsRepository,
55
+ ScheduledTournamentsRepository,
56
+ ServersRepository,
57
+ UsersRepository,
58
+ } from './repositories'
33
59
 
34
60
  export type {
35
61
  UserDocument,
@@ -48,6 +74,13 @@ export type {
48
74
  ArticleDocument,
49
75
  BannerDocument,
50
76
  ServerDocument,
77
+ AchievementDocument,
78
+ ChannelMessageDocument,
79
+ FeatureDocument,
80
+ ProductDocument,
81
+ PurchaseChannelDocument,
82
+ RatingDocument,
83
+ SettingDocument,
51
84
  }
52
85
 
53
86
  export {
@@ -83,4 +116,30 @@ export {
83
116
  BannerSchema,
84
117
  Server,
85
118
  ServerSchema,
119
+ Achievement,
120
+ AchievementSchema,
121
+ ChannelMessage,
122
+ ChannelMessageSchema,
123
+ Feature,
124
+ FeatureSchema,
125
+ Product,
126
+ ProductSchema,
127
+ PurchaseChannel,
128
+ PurchaseChannelSchema,
129
+ Rating,
130
+ RatingSchema,
131
+ Setting,
132
+ SettingSchema,
133
+ }
134
+
135
+ export {
136
+ AdminRepository,
137
+ ArticleRepository,
138
+ BannersRepository,
139
+ ComplainsRepository,
140
+ NotificationRepository,
141
+ ProductsRepository,
142
+ ScheduledTournamentsRepository,
143
+ ServersRepository,
144
+ UsersRepository,
86
145
  }
@@ -0,0 +1,23 @@
1
+ import { Injectable } from '@nestjs/common';
2
+ import { InjectModel } from '@nestjs/mongoose';
3
+ import { Model } from 'mongoose';
4
+
5
+ import { Admin, AdminDocument } from '../';
6
+
7
+ @Injectable()
8
+ export class AdminRepository {
9
+ constructor (@InjectModel(Admin.name) private adminModel: Model<AdminDocument>) {
10
+ }
11
+
12
+ async findById (id: string): Promise<Admin | null> {
13
+ return this.adminModel
14
+ .findOne({ _id: id })
15
+ .exec();
16
+ }
17
+
18
+ async findByLogin (login: string): Promise<Admin | null> {
19
+ return this.adminModel
20
+ .findOne({ login })
21
+ .exec();
22
+ }
23
+ }
@@ -0,0 +1,33 @@
1
+ import { Injectable } from '@nestjs/common';
2
+ import { InjectModel } from '@nestjs/mongoose';
3
+ import { Model } from 'mongoose';
4
+
5
+ import { Article, ArticleDocument } from '../';
6
+
7
+ @Injectable()
8
+ export class ArticleRepository {
9
+ constructor (@InjectModel(Article.name) private articleModel: Model<ArticleDocument>) {
10
+ }
11
+
12
+ async findAllArticles (): Promise<Array<Article>> {
13
+ return this.articleModel
14
+ .find()
15
+ .sort({ createDate: -1 })
16
+ .exec();
17
+ }
18
+
19
+ async findLastArticle (): Promise<Article | null> {
20
+ return await this.articleModel
21
+ .findOne()
22
+ .sort({ createDate: -1 })
23
+ .exec();
24
+ }
25
+
26
+ async findTop3Articles (): Promise<Array<Article>> {
27
+ return this.articleModel
28
+ .find()
29
+ .sort({ createDate: -1 })
30
+ .limit(3)
31
+ .exec();
32
+ }
33
+ }
@@ -0,0 +1,54 @@
1
+ import { Injectable } from '@nestjs/common';
2
+ import { InjectModel } from '@nestjs/mongoose';
3
+ import { Model } from 'mongoose';
4
+
5
+ import { Banner, BannerDocument } from '../';
6
+
7
+ @Injectable()
8
+ export class BannersRepository {
9
+ constructor (@InjectModel(Banner.name) private bannerModel: Model<BannerDocument>) {
10
+ }
11
+
12
+ async findById (id: string): Promise<Banner | null> {
13
+ return this.bannerModel
14
+ .findById(id)
15
+ .exec();
16
+ }
17
+
18
+ async findAndCount (limit: number, skip: number): Promise<{
19
+ items: Array<Banner>,
20
+ total: number
21
+ }> {
22
+ const items = await this.bannerModel
23
+ .find()
24
+ .sort({ createDate: -1 })
25
+ .limit(limit)
26
+ .skip(skip)
27
+ .exec();
28
+
29
+ const total = await this.bannerModel
30
+ .find()
31
+ .countDocuments()
32
+ .exec();
33
+
34
+ return { items, total };
35
+ }
36
+
37
+ public async createBanner (banner: Banner): Promise<Banner> {
38
+ return this.bannerModel.create(banner);
39
+ }
40
+
41
+ async updateBanner (bannerId: string, banner: Partial<Banner>): Promise<void> {
42
+ await this.bannerModel.findByIdAndUpdate(
43
+ bannerId,
44
+ {
45
+ $set: {
46
+ ...banner,
47
+ },
48
+ }).exec();
49
+ }
50
+
51
+ public async removeBanner (bannerId: string): Promise<void> {
52
+ await this.bannerModel.findByIdAndDelete(bannerId);
53
+ }
54
+ }
@@ -0,0 +1,30 @@
1
+ import { Injectable } from '@nestjs/common';
2
+ import { InjectModel } from '@nestjs/mongoose';
3
+ import { Model } from 'mongoose';
4
+
5
+ import { Complain, ComplainDocument } from '../';
6
+
7
+ @Injectable()
8
+ export class ComplainsRepository {
9
+ constructor (@InjectModel(Complain.name) private complainModel: Model<ComplainDocument>) {
10
+ }
11
+
12
+ async findAndCount (limit: number, skip: number): Promise<{
13
+ items: Array<Complain>,
14
+ total: number
15
+ }> {
16
+ const items = await this.complainModel
17
+ .find()
18
+ .sort({ createDate: -1 })
19
+ .limit(limit)
20
+ .skip(skip)
21
+ .exec();
22
+
23
+ const total = await this.complainModel
24
+ .find()
25
+ .countDocuments()
26
+ .exec();
27
+
28
+ return { items, total };
29
+ }
30
+ }
@@ -0,0 +1,21 @@
1
+ import { AdminRepository } from './admin.repository';
2
+ import { ArticleRepository } from './article.repository';
3
+ import { BannersRepository } from './banners.repository';
4
+ import { ComplainsRepository } from './complains.repository';
5
+ import { NotificationRepository } from './notification.repository';
6
+ import { ProductsRepository } from './products.repository';
7
+ import { ScheduledTournamentsRepository } from './scheduled-tournaments.repository';
8
+ import { ServersRepository } from './servers.repository';
9
+ import { UsersRepository } from './users.repository';
10
+
11
+ export {
12
+ AdminRepository,
13
+ ArticleRepository,
14
+ BannersRepository,
15
+ ComplainsRepository,
16
+ NotificationRepository,
17
+ ProductsRepository,
18
+ ScheduledTournamentsRepository,
19
+ ServersRepository,
20
+ UsersRepository,
21
+ }
@@ -0,0 +1,54 @@
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 (@InjectModel(Notification.name) private notificationModel: Model<NotificationDocument>) {
10
+ }
11
+
12
+ async findById (id: string): Promise<Notification | null> {
13
+ return this.notificationModel
14
+ .findById(id)
15
+ .exec();
16
+ }
17
+
18
+ async findAndCount (limit: number, skip: number): Promise<{
19
+ items: Array<Notification>,
20
+ total: number
21
+ }> {
22
+ const items = await this.notificationModel
23
+ .find()
24
+ .sort({ createDate: -1 })
25
+ .limit(limit)
26
+ .skip(skip)
27
+ .exec();
28
+
29
+ const total = await this.notificationModel
30
+ .find()
31
+ .countDocuments()
32
+ .exec();
33
+
34
+ return { items, total };
35
+ }
36
+
37
+ public async crateNotification (notification: Notification): Promise<Notification> {
38
+ return this.notificationModel.create(notification);
39
+ }
40
+
41
+ async updateNotification (notificationId: string, notification: Partial<Notification>): Promise<void> {
42
+ await this.notificationModel.findByIdAndUpdate(
43
+ notificationId,
44
+ {
45
+ $set: {
46
+ ...notification,
47
+ },
48
+ }).exec();
49
+ }
50
+
51
+ public async removeNotification (notificationId: string): Promise<void> {
52
+ await this.notificationModel.findByIdAndDelete(notificationId);
53
+ }
54
+ }
@@ -0,0 +1,29 @@
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 (@InjectModel(Product.name) private productModel: Model<ProductDocument>) {
11
+ }
12
+
13
+ async findByProductId (productId: string): Promise<Product | null> {
14
+ return this.productModel
15
+ .findOne({ productId })
16
+ .exec();
17
+ }
18
+
19
+ async findProducts (parentId: string | null, channel: string): Promise<Array<Product> | null> {
20
+ return this.productModel
21
+ .find({
22
+ parentId,
23
+ active: true,
24
+ channels: getChannelRegExpFilter(channel),
25
+ })
26
+ .exec();
27
+ }
28
+ }
29
+
@@ -0,0 +1,30 @@
1
+ import { Injectable } from '@nestjs/common';
2
+ import { InjectModel } from '@nestjs/mongoose';
3
+ import { Model } from 'mongoose';
4
+
5
+ import { ScheduledTournament, ScheduledTournamentDocument } from '../';
6
+
7
+ @Injectable()
8
+ export class ScheduledTournamentsRepository {
9
+ constructor (@InjectModel(ScheduledTournament.name) private scheduledTournamentModel: Model<ScheduledTournamentDocument>) {
10
+ }
11
+
12
+ async findAndCount (limit: number, skip: number): Promise<{
13
+ items: Array<ScheduledTournament>,
14
+ total: number
15
+ }> {
16
+ const items = await this.scheduledTournamentModel
17
+ .find({ category: 'global'})
18
+ .sort({ date: -1 })
19
+ .limit(limit)
20
+ .skip(skip)
21
+ .exec();
22
+
23
+ const total = await this.scheduledTournamentModel
24
+ .find({ category: 'global'})
25
+ .countDocuments()
26
+ .exec();
27
+
28
+ return { items, total };
29
+ }
30
+ }
@@ -0,0 +1,18 @@
1
+ import { Injectable } from '@nestjs/common';
2
+ import { InjectModel } from '@nestjs/mongoose';
3
+ import { Model } from 'mongoose';
4
+
5
+ import { Server, ServerDocument } from '../';
6
+
7
+ @Injectable()
8
+ export class ServersRepository {
9
+ constructor (@InjectModel(Server.name) private serverModel: Model<ServerDocument>) {
10
+ }
11
+
12
+ async findServerByName (name: string): Promise<Server | null> {
13
+ return this.serverModel
14
+ .findOne({name})
15
+ .exec();
16
+ }
17
+ }
18
+
@@ -0,0 +1,69 @@
1
+ import { Injectable } from '@nestjs/common';
2
+ import { InjectModel } from '@nestjs/mongoose';
3
+ import { Model } from 'mongoose';
4
+
5
+ import { User, UserDocument } from '../';
6
+
7
+ function getFullNameFilter (userName: string) {
8
+ const regexpName = {
9
+ '$regex': userName,
10
+ '$options': 'i',
11
+ };
12
+
13
+ return userName ? { $or: [{ fullName: regexpName }, { fullNameAlias: regexpName }] } : {};
14
+ }
15
+
16
+ @Injectable()
17
+ export class UsersRepository {
18
+ constructor (@InjectModel(User.name) private userModel: Model<UserDocument>) {
19
+ }
20
+
21
+ async findById (id: string): Promise<User | null> {
22
+ return this.userModel
23
+ .findById(id)
24
+ .exec();
25
+ }
26
+
27
+ async findByVKId (vkId: number): Promise<User | null> {
28
+ return this.userModel
29
+ .findOne({ 'vkUser.id': vkId })
30
+ .exec();
31
+ }
32
+
33
+ async findAndCount (userName: string, limit: number, skip: number): Promise<{
34
+ items: Array<User>,
35
+ total: number
36
+ }> {
37
+ const items = await this.userModel
38
+ .find(getFullNameFilter(userName))
39
+ .limit(limit)
40
+ .skip(skip)
41
+ .exec();
42
+
43
+ const total = await this.userModel
44
+ .find(getFullNameFilter(userName))
45
+ .countDocuments()
46
+ .exec();
47
+
48
+ return { items, total };
49
+ }
50
+
51
+ async createUser (user: User): Promise<User> {
52
+ return this.userModel.create(user);
53
+ }
54
+
55
+ async updateUser (userId: string, user: Partial<User>, balanceAdding?: number): Promise<UserDocument | null> {
56
+ delete user.balance;
57
+
58
+ return this.userModel.findByIdAndUpdate(
59
+ userId,
60
+ {
61
+ $set: {
62
+ ...user,
63
+ },
64
+ $inc: { balance: balanceAdding ?? 0 }
65
+ },
66
+ { new: true },
67
+ ).exec();
68
+ }
69
+ }
@@ -0,0 +1,40 @@
1
+ import { Prop, Schema, SchemaFactory, Virtual } from '@nestjs/mongoose';
2
+ import { Document, HydratedDocument } from 'mongoose';
3
+
4
+ export type AchievementDocument = HydratedDocument<Achievement>;
5
+
6
+ @Schema()
7
+ export class Achievement {
8
+ @Virtual({
9
+ get: function (this: Document) {
10
+ return this.id;
11
+ },
12
+ })
13
+ readonly achievementId: string;
14
+
15
+ @Prop()
16
+ title: string;
17
+
18
+ @Prop()
19
+ titleEn: string;
20
+
21
+ @Prop()
22
+ description: string;
23
+
24
+ @Prop()
25
+ descriptionEn: string;
26
+
27
+ @Prop()
28
+ code: string;
29
+
30
+ @Prop()
31
+ vkId: string;
32
+
33
+ @Prop()
34
+ prize: number;
35
+
36
+ @Prop()
37
+ game?: string;
38
+ }
39
+
40
+ export const AchievementSchema = SchemaFactory.createForClass(Achievement);
@@ -32,6 +32,9 @@ export class Banner {
32
32
 
33
33
  @Prop()
34
34
  createDate: Date;
35
+
36
+ @Prop()
37
+ game?: string;
35
38
  }
36
39
 
37
40
  export const BannerSchema = SchemaFactory.createForClass(Banner);
@@ -0,0 +1,31 @@
1
+ import { Prop, Schema, SchemaFactory, Virtual } from '@nestjs/mongoose';
2
+ import { Document, HydratedDocument } from 'mongoose';
3
+
4
+ export type ChannelMessageDocument = HydratedDocument<ChannelMessage>;
5
+
6
+ @Schema()
7
+ export class ChannelMessage {
8
+ @Virtual({
9
+ get: function (this: Document) {
10
+ return this.id;
11
+ },
12
+ })
13
+ readonly channelMessageId: string;
14
+
15
+ @Prop()
16
+ channelId: string;
17
+
18
+ @Prop()
19
+ date: Date;
20
+
21
+ @Prop()
22
+ text: string;
23
+
24
+ @Prop()
25
+ userId: string;
26
+
27
+ @Prop()
28
+ read: boolean;
29
+ }
30
+
31
+ export const ChannelMessageSchema = SchemaFactory.createForClass(ChannelMessage);
@@ -0,0 +1,28 @@
1
+ import { Prop, Schema, SchemaFactory, Virtual } from '@nestjs/mongoose';
2
+ import { Document, HydratedDocument } from 'mongoose';
3
+
4
+ export type FeatureDocument = HydratedDocument<Feature>;
5
+
6
+ @Schema()
7
+ export class Feature {
8
+ @Virtual({
9
+ get: function (this: Document) {
10
+ return this.id;
11
+ },
12
+ })
13
+ readonly featureId: string;
14
+
15
+ @Prop()
16
+ name: string;
17
+
18
+ @Prop()
19
+ enabled: boolean;
20
+
21
+ @Prop()
22
+ channels: string;
23
+
24
+ @Prop()
25
+ game?: string;
26
+ }
27
+
28
+ export const FeatureSchema = SchemaFactory.createForClass(Feature);
@@ -53,6 +53,9 @@ export class Notification {
53
53
 
54
54
  @Prop()
55
55
  channels: string;
56
+
57
+ @Prop()
58
+ game?: string;
56
59
  }
57
60
 
58
61
  export const NotificationSchema = SchemaFactory.createForClass(Notification);
@@ -0,0 +1,123 @@
1
+ import { Prop, Schema, SchemaFactory, Virtual } from '@nestjs/mongoose';
2
+ import { Document, HydratedDocument } from 'mongoose';
3
+
4
+ export type ProductDocument = HydratedDocument<Product>;
5
+
6
+ @Schema()
7
+ export class Product {
8
+ @Virtual({
9
+ get: function (this: Document) {
10
+ return this.id;
11
+ },
12
+ })
13
+ readonly productId: string;
14
+
15
+ @Prop()
16
+ title: string;
17
+
18
+ @Prop()
19
+ titleEn: string;
20
+
21
+ @Prop()
22
+ subtitle: string;
23
+
24
+ @Prop()
25
+ subtitleEn: string;
26
+
27
+ @Prop()
28
+ description: string;
29
+
30
+ @Prop()
31
+ descriptionEn: string;
32
+
33
+ @Prop()
34
+ descriptionAcquired: string;
35
+
36
+ @Prop()
37
+ descriptionAcquiredEn: string;
38
+
39
+ @Prop()
40
+ buttonAcquired: string;
41
+
42
+ @Prop()
43
+ buttonAcquiredEn: string;
44
+
45
+ @Prop()
46
+ button: string;
47
+
48
+ @Prop()
49
+ buttonEn: string;
50
+
51
+ @Prop()
52
+ link: string;
53
+
54
+ @Prop()
55
+ linkVK: string;
56
+
57
+ @Prop()
58
+ channels: string;
59
+
60
+ @Prop()
61
+ code: string;
62
+
63
+ @Prop()
64
+ position: number;
65
+
66
+ @Prop()
67
+ active: boolean;
68
+
69
+ @Prop()
70
+ image: string;
71
+
72
+ @Prop()
73
+ icon: string;
74
+
75
+ @Prop()
76
+ external: boolean;
77
+
78
+ @Prop()
79
+ isConsumable: boolean;
80
+
81
+ // поля для товара
82
+
83
+ @Prop()
84
+ parentId?: string | null;
85
+
86
+ @Prop()
87
+ price?: number;
88
+
89
+ @Prop()
90
+ priceVK?: number;
91
+
92
+ @Prop()
93
+ priceOK?: number;
94
+
95
+ @Prop()
96
+ priceYA?: number;
97
+
98
+ @Prop()
99
+ priceGooglePlay?: number;
100
+
101
+ @Prop()
102
+ priceFB?: number;
103
+
104
+ @Prop()
105
+ priceTG?: number;
106
+
107
+ @Prop()
108
+ priceRuStore?: number;
109
+
110
+ @Prop()
111
+ value?: number;
112
+
113
+ @Prop()
114
+ period?: string;
115
+
116
+ @Prop()
117
+ type?: string;
118
+
119
+ @Prop()
120
+ game?: string;
121
+ }
122
+
123
+ export const ProductSchema = SchemaFactory.createForClass(Product);