jp.db.schemas 2.2.14 → 2.2.15

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 (91) hide show
  1. package/dist/schemas/activity_log.schema.js +1 -1
  2. package/dist/schemas/activity_log.schema.js.map +1 -1
  3. package/dist/schemas/purchase.schema.js +1 -1
  4. package/dist/schemas/purchase.schema.js.map +1 -1
  5. package/dist/schemas/user.schema.js +1 -1
  6. package/dist/schemas/user.schema.js.map +1 -1
  7. package/dist/schemas/users_achievement.schema.js +1 -1
  8. package/dist/schemas/users_achievement.schema.js.map +1 -1
  9. package/dist/schemas/users_balance.schema.js +1 -1
  10. package/dist/schemas/users_balance.schema.js.map +1 -1
  11. package/package.json +37 -37
  12. package/readme.md +3 -3
  13. package/src/index.ts +277 -277
  14. package/src/models/account-type.enum.ts +8 -8
  15. package/src/models/activity-log-user-login.interface.ts +10 -10
  16. package/src/models/activity-log.enum.ts +8 -8
  17. package/src/models/currency.enum.ts +6 -6
  18. package/src/models/experiences-level-edge.enum.ts +4 -4
  19. package/src/models/experiences-level-rank.enum.ts +5 -5
  20. package/src/models/rating-add-bulk-item.interface.ts +7 -7
  21. package/src/models/rating-monthly-result.interface.ts +12 -12
  22. package/src/models/tournament-participant.interface.ts +5 -5
  23. package/src/models/tournament-status.enum.ts +6 -6
  24. package/src/models/tournament-template.enum.ts +3 -3
  25. package/src/models/tournament-winner.interface.ts +7 -7
  26. package/src/models/users-balance-reason.enum.ts +8 -8
  27. package/src/repositories/achievement.repository.ts +22 -22
  28. package/src/repositories/activity-log.repository.ts +209 -209
  29. package/src/repositories/admin.repository.ts +20 -20
  30. package/src/repositories/article.repository.ts +24 -24
  31. package/src/repositories/banners.repository.ts +67 -67
  32. package/src/repositories/complains.repository.ts +31 -31
  33. package/src/repositories/daily-bonus.repository.ts +33 -33
  34. package/src/repositories/friend.repository.ts +16 -16
  35. package/src/repositories/game-result.repository.ts +19 -19
  36. package/src/repositories/game-statistic.repository.ts +22 -22
  37. package/src/repositories/index.ts +57 -57
  38. package/src/repositories/many-tables-tournament-rooms.repository.ts +167 -167
  39. package/src/repositories/menu.repository.ts +20 -20
  40. package/src/repositories/notification.repository.ts +59 -59
  41. package/src/repositories/one-table-tournament-rooms.repository.ts +142 -142
  42. package/src/repositories/premium.repository.ts +22 -22
  43. package/src/repositories/products.repository.ts +32 -32
  44. package/src/repositories/purchase.repository.ts +111 -111
  45. package/src/repositories/rating.repository.ts +79 -79
  46. package/src/repositories/rule.repository.ts +20 -20
  47. package/src/repositories/servers.repository.ts +16 -16
  48. package/src/repositories/setting.repository.ts +25 -25
  49. package/src/repositories/settings-options.repository.ts +17 -17
  50. package/src/repositories/simple-rooms.repository.ts +16 -16
  51. package/src/repositories/users-achievements.repository.ts +46 -46
  52. package/src/repositories/users-balances.repository.ts +65 -65
  53. package/src/repositories/users.repository.ts +153 -153
  54. package/src/repositories/welcome.repository.ts +22 -22
  55. package/src/schemas/achievement.schema.ts +34 -34
  56. package/src/schemas/activity_log.schema.ts +37 -37
  57. package/src/schemas/admin.schema.ts +22 -22
  58. package/src/schemas/article.schema.ts +37 -37
  59. package/src/schemas/banner.schema.ts +37 -37
  60. package/src/schemas/channel_message.schema.ts +32 -32
  61. package/src/schemas/complain.schema.ts +46 -46
  62. package/src/schemas/daily_bonus.schema.ts +46 -46
  63. package/src/schemas/feature.schema.ts +28 -28
  64. package/src/schemas/friend.schema.ts +46 -46
  65. package/src/schemas/game_result.schema.ts +68 -68
  66. package/src/schemas/game_statistic.schema.ts +34 -34
  67. package/src/schemas/many_tables_tournament_rooms.schema.ts +87 -87
  68. package/src/schemas/menu.schema.ts +37 -37
  69. package/src/schemas/notification.schema.ts +61 -61
  70. package/src/schemas/one_table_tournament_rooms.schema.ts +84 -84
  71. package/src/schemas/premium.schema.ts +34 -34
  72. package/src/schemas/product.schema.ts +111 -111
  73. package/src/schemas/purchase.schema.ts +61 -61
  74. package/src/schemas/purchase_channel.schema.ts +32 -32
  75. package/src/schemas/rating.schema.ts +37 -37
  76. package/src/schemas/rule.schema.ts +34 -34
  77. package/src/schemas/server.schema.ts +22 -22
  78. package/src/schemas/setting.schema.ts +49 -49
  79. package/src/schemas/settings_option.schema.ts +41 -41
  80. package/src/schemas/simple_rooms.schema.ts +49 -49
  81. package/src/schemas/user.fb.schema.ts +33 -33
  82. package/src/schemas/user.google.schema.ts +24 -24
  83. package/src/schemas/user.ok.schema.ts +53 -53
  84. package/src/schemas/user.schema.ts +185 -185
  85. package/src/schemas/user.tg.schema.ts +30 -30
  86. package/src/schemas/user.vk.schema.ts +70 -70
  87. package/src/schemas/user.ya.schema.ts +24 -24
  88. package/src/schemas/users_achievement.schema.ts +41 -41
  89. package/src/schemas/users_balance.schema.ts +34 -34
  90. package/src/schemas/welcome.schema.ts +37 -37
  91. package/src/utils.ts +7 -7
@@ -1,185 +1,185 @@
1
- import { Prop, Schema, SchemaFactory, Virtual } from '@nestjs/mongoose';
2
- import { Document, HydratedDocument } from 'mongoose';
3
- import dayjs from 'dayjs';
4
-
5
- import { AccountTypeEnum } from '../models/account-type.enum';
6
-
7
- import { VKUser } from './user.vk.schema';
8
- import { OKUser } from './user.ok.schema';
9
- import { YAUser } from './user.ya.schema';
10
- import { TGUser } from './user.tg.schema';
11
- import { GoogleUser } from './user.google.schema';
12
- import { FBUser } from './user.fb.schema';
13
- import { ExperiencesLevelEdgeEnum } from '../models/experiences-level-edge.enum';
14
- import { ExperiencesLevelRankEnum } from '../models/experiences-level-rank.enum';
15
-
16
- export type UserDocument = HydratedDocument<User>;
17
-
18
- @Schema()
19
- export class User {
20
- @Virtual({
21
- get: function (this: Document) {
22
- return this._id.toString();
23
- },
24
- })
25
- readonly userId: string;
26
-
27
- @Prop({ required: true })
28
- fullName: string;
29
-
30
- @Prop({ required: true })
31
- balance: number;
32
-
33
- @Prop({ required: true })
34
- avatarUrl: string;
35
-
36
- @Prop({ default: new Date() })
37
- registerDate: Date;
38
-
39
- @Prop({ required: true })
40
- premiumExpired: Date;
41
-
42
- // settings
43
-
44
- @Prop({ default: '' })
45
- fullNameAlias: string;
46
-
47
- @Prop({ default: '' })
48
- avatarAliasUrl: string;
49
-
50
- @Prop({ default: '' })
51
- avatar: string;
52
-
53
- @Prop({ default: 'theme__light' })
54
- theme: string;
55
-
56
- @Prop({ default: 'language__ru' })
57
- language: string;
58
-
59
- @Prop({ default: 'avatar_frame__default' })
60
- avatarFrame: string;
61
-
62
- @Prop({ default: 'card_skin__default' })
63
- cardSkin: string;
64
-
65
- @Prop({ default: 'game_sounds__on' })
66
- gameSounds: string;
67
-
68
- @Prop({ default: 'bg_pattern__default' })
69
- bgPattern: string;
70
-
71
- @Prop({ default: 'room_table__on' })
72
- roomTable: string;
73
-
74
- @Prop({ default: 'color_schema__default' })
75
- colorSchema: string;
76
-
77
- @Prop({ default: 0 })
78
- experience: number;
79
-
80
- @Prop({ default: 1 })
81
- level: number;
82
-
83
- // users
84
-
85
- @Prop({ type: VKUser })
86
- vkUser?: VKUser;
87
-
88
- @Prop({ type: OKUser })
89
- okUser?: OKUser;
90
-
91
- @Prop({ type: YAUser })
92
- yaUser?: YAUser;
93
-
94
- @Prop({ type: GoogleUser })
95
- googleUser?: GoogleUser;
96
-
97
- @Prop({ type: FBUser })
98
- fbUser?: FBUser;
99
-
100
- @Prop({ type: TGUser })
101
- tgUser?: TGUser;
102
-
103
- // virtuals
104
-
105
- @Virtual({
106
- get: function (this: User) {
107
- return dayjs().isAfter(this.premiumExpired);
108
- },
109
- })
110
- readonly hasPremiumAccount: boolean;
111
-
112
- @Virtual({
113
- get: function (this: User) {
114
- return this.fullNameAlias || this.fullName;
115
- },
116
- })
117
- readonly publicFullName: string;
118
-
119
- @Virtual({
120
- get: function (this: User) {
121
- return this.avatarAliasUrl || this.avatarUrl;
122
- },
123
- })
124
- readonly publicAvatarUrl: string;
125
-
126
- @Virtual({
127
- get: function (this: User) {
128
- if (this.yaUser) {
129
- return AccountTypeEnum.YA;
130
- } else if (this.vkUser) {
131
- return AccountTypeEnum.VK;
132
- } else if (this.okUser) {
133
- return AccountTypeEnum.OK;
134
- } else if (this.fbUser) {
135
- return AccountTypeEnum.FB;
136
- } else if (this.googleUser) {
137
- return AccountTypeEnum.GOOGLE;
138
- }
139
-
140
- return AccountTypeEnum.GUEST;
141
- },
142
- })
143
- readonly accountType: string;
144
-
145
- @Virtual({
146
- get: function (this: User) {
147
- return (
148
- this.accountType === AccountTypeEnum.GUEST || !!this.yaUser?.isGuest
149
- );
150
- },
151
- })
152
- readonly isGuest: boolean;
153
-
154
- @Virtual({
155
- get: function (this: User) {
156
- return this.language.replace('language__', '');
157
- },
158
- })
159
- readonly normalizedLang: string;
160
-
161
- @Virtual({
162
- get: function (this: User) {
163
- if (this.level < ExperiencesLevelEdgeEnum.PLAYER) {
164
- return ExperiencesLevelRankEnum.NEW;
165
- } else if (
166
- this.level >= ExperiencesLevelEdgeEnum.PLAYER &&
167
- this.level < ExperiencesLevelEdgeEnum.PROFI
168
- ) {
169
- return ExperiencesLevelRankEnum.PLAYER;
170
- } else {
171
- return ExperiencesLevelRankEnum.PROFI;
172
- }
173
- },
174
- })
175
- readonly levelRank: string;
176
-
177
- @Virtual({
178
- get: function (this: User) {
179
- return this.gameSounds === 'game_sounds__on';
180
- },
181
- })
182
- readonly gameSoundsOn: boolean;
183
- }
184
-
185
- export const UserSchema = SchemaFactory.createForClass(User);
1
+ import { Prop, Schema, SchemaFactory, Virtual } from '@nestjs/mongoose';
2
+ import { Document, HydratedDocument } from 'mongoose';
3
+ import dayjs from 'dayjs';
4
+
5
+ import { AccountTypeEnum } from '../models/account-type.enum';
6
+
7
+ import { VKUser } from './user.vk.schema';
8
+ import { OKUser } from './user.ok.schema';
9
+ import { YAUser } from './user.ya.schema';
10
+ import { TGUser } from './user.tg.schema';
11
+ import { GoogleUser } from './user.google.schema';
12
+ import { FBUser } from './user.fb.schema';
13
+ import { ExperiencesLevelEdgeEnum } from '../models/experiences-level-edge.enum';
14
+ import { ExperiencesLevelRankEnum } from '../models/experiences-level-rank.enum';
15
+
16
+ export type UserDocument = HydratedDocument<User>;
17
+
18
+ @Schema()
19
+ export class User {
20
+ @Virtual({
21
+ get: function (this: Document) {
22
+ return this._id.toString();
23
+ },
24
+ })
25
+ readonly userId: string;
26
+
27
+ @Prop({ required: true })
28
+ fullName: string;
29
+
30
+ @Prop({ required: true })
31
+ balance: number;
32
+
33
+ @Prop({ required: true })
34
+ avatarUrl: string;
35
+
36
+ @Prop({ default: Date.now })
37
+ registerDate: Date;
38
+
39
+ @Prop({ required: true })
40
+ premiumExpired: Date;
41
+
42
+ // settings
43
+
44
+ @Prop({ default: '' })
45
+ fullNameAlias: string;
46
+
47
+ @Prop({ default: '' })
48
+ avatarAliasUrl: string;
49
+
50
+ @Prop({ default: '' })
51
+ avatar: string;
52
+
53
+ @Prop({ default: 'theme__light' })
54
+ theme: string;
55
+
56
+ @Prop({ default: 'language__ru' })
57
+ language: string;
58
+
59
+ @Prop({ default: 'avatar_frame__default' })
60
+ avatarFrame: string;
61
+
62
+ @Prop({ default: 'card_skin__default' })
63
+ cardSkin: string;
64
+
65
+ @Prop({ default: 'game_sounds__on' })
66
+ gameSounds: string;
67
+
68
+ @Prop({ default: 'bg_pattern__default' })
69
+ bgPattern: string;
70
+
71
+ @Prop({ default: 'room_table__on' })
72
+ roomTable: string;
73
+
74
+ @Prop({ default: 'color_schema__default' })
75
+ colorSchema: string;
76
+
77
+ @Prop({ default: 0 })
78
+ experience: number;
79
+
80
+ @Prop({ default: 1 })
81
+ level: number;
82
+
83
+ // users
84
+
85
+ @Prop({ type: VKUser })
86
+ vkUser?: VKUser;
87
+
88
+ @Prop({ type: OKUser })
89
+ okUser?: OKUser;
90
+
91
+ @Prop({ type: YAUser })
92
+ yaUser?: YAUser;
93
+
94
+ @Prop({ type: GoogleUser })
95
+ googleUser?: GoogleUser;
96
+
97
+ @Prop({ type: FBUser })
98
+ fbUser?: FBUser;
99
+
100
+ @Prop({ type: TGUser })
101
+ tgUser?: TGUser;
102
+
103
+ // virtuals
104
+
105
+ @Virtual({
106
+ get: function (this: User) {
107
+ return dayjs().isAfter(this.premiumExpired);
108
+ },
109
+ })
110
+ readonly hasPremiumAccount: boolean;
111
+
112
+ @Virtual({
113
+ get: function (this: User) {
114
+ return this.fullNameAlias || this.fullName;
115
+ },
116
+ })
117
+ readonly publicFullName: string;
118
+
119
+ @Virtual({
120
+ get: function (this: User) {
121
+ return this.avatarAliasUrl || this.avatarUrl;
122
+ },
123
+ })
124
+ readonly publicAvatarUrl: string;
125
+
126
+ @Virtual({
127
+ get: function (this: User) {
128
+ if (this.yaUser) {
129
+ return AccountTypeEnum.YA;
130
+ } else if (this.vkUser) {
131
+ return AccountTypeEnum.VK;
132
+ } else if (this.okUser) {
133
+ return AccountTypeEnum.OK;
134
+ } else if (this.fbUser) {
135
+ return AccountTypeEnum.FB;
136
+ } else if (this.googleUser) {
137
+ return AccountTypeEnum.GOOGLE;
138
+ }
139
+
140
+ return AccountTypeEnum.GUEST;
141
+ },
142
+ })
143
+ readonly accountType: string;
144
+
145
+ @Virtual({
146
+ get: function (this: User) {
147
+ return (
148
+ this.accountType === AccountTypeEnum.GUEST || !!this.yaUser?.isGuest
149
+ );
150
+ },
151
+ })
152
+ readonly isGuest: boolean;
153
+
154
+ @Virtual({
155
+ get: function (this: User) {
156
+ return this.language.replace('language__', '');
157
+ },
158
+ })
159
+ readonly normalizedLang: string;
160
+
161
+ @Virtual({
162
+ get: function (this: User) {
163
+ if (this.level < ExperiencesLevelEdgeEnum.PLAYER) {
164
+ return ExperiencesLevelRankEnum.NEW;
165
+ } else if (
166
+ this.level >= ExperiencesLevelEdgeEnum.PLAYER &&
167
+ this.level < ExperiencesLevelEdgeEnum.PROFI
168
+ ) {
169
+ return ExperiencesLevelRankEnum.PLAYER;
170
+ } else {
171
+ return ExperiencesLevelRankEnum.PROFI;
172
+ }
173
+ },
174
+ })
175
+ readonly levelRank: string;
176
+
177
+ @Virtual({
178
+ get: function (this: User) {
179
+ return this.gameSounds === 'game_sounds__on';
180
+ },
181
+ })
182
+ readonly gameSoundsOn: boolean;
183
+ }
184
+
185
+ export const UserSchema = SchemaFactory.createForClass(User);
@@ -1,30 +1,30 @@
1
- import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
- import { HydratedDocument } from 'mongoose';
3
-
4
- export type TGUserDocument = HydratedDocument<TGUser>;
5
-
6
- @Schema()
7
- export class TGUser {
8
- @Prop()
9
- id: number;
10
-
11
- @Prop()
12
- firstName: string;
13
-
14
- @Prop()
15
- lastName?: string;
16
-
17
- @Prop()
18
- username?: string;
19
-
20
- @Prop()
21
- languageCode?: string;
22
-
23
- @Prop()
24
- photoUrl?: string;
25
-
26
- @Prop()
27
- allowsWriteToPm?: boolean;
28
- }
29
-
30
- export const TGUserSchema = SchemaFactory.createForClass(TGUser);
1
+ import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
+ import { HydratedDocument } from 'mongoose';
3
+
4
+ export type TGUserDocument = HydratedDocument<TGUser>;
5
+
6
+ @Schema()
7
+ export class TGUser {
8
+ @Prop()
9
+ id: number;
10
+
11
+ @Prop()
12
+ firstName: string;
13
+
14
+ @Prop()
15
+ lastName?: string;
16
+
17
+ @Prop()
18
+ username?: string;
19
+
20
+ @Prop()
21
+ languageCode?: string;
22
+
23
+ @Prop()
24
+ photoUrl?: string;
25
+
26
+ @Prop()
27
+ allowsWriteToPm?: boolean;
28
+ }
29
+
30
+ export const TGUserSchema = SchemaFactory.createForClass(TGUser);
@@ -1,70 +1,70 @@
1
- import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
- import { HydratedDocument } from 'mongoose';
3
-
4
- export type VKUserCityDocument = HydratedDocument<VKUserCity>;
5
-
6
- @Schema()
7
- export class VKUserCity {
8
- @Prop()
9
- id: number;
10
-
11
- @Prop()
12
- title: string;
13
- }
14
-
15
- export const VKUserCitySchema = SchemaFactory.createForClass(VKUserCity);
16
-
17
- export type VKUserDocument = HydratedDocument<VKUser>;
18
-
19
- @Schema()
20
- export class VKUser {
21
- @Prop()
22
- id: number;
23
-
24
- @Prop()
25
- first_name: string;
26
-
27
- @Prop()
28
- last_name: string;
29
-
30
- @Prop()
31
- sex: number;
32
-
33
- @Prop()
34
- bdate: string;
35
-
36
- @Prop()
37
- city: VKUserCity;
38
-
39
- @Prop()
40
- country: VKUserCity;
41
-
42
- @Prop()
43
- photo_100: string;
44
-
45
- @Prop()
46
- photo_200: string;
47
-
48
- @Prop()
49
- photo_max_orig: string;
50
-
51
- @Prop()
52
- timezone: number;
53
-
54
- @Prop()
55
- is_closed: boolean;
56
-
57
- @Prop()
58
- can_access_closed: boolean;
59
-
60
- @Prop()
61
- can_invite_to_chats: boolean;
62
-
63
- @Prop()
64
- is_app_ios: boolean;
65
-
66
- @Prop()
67
- is_vk_user_id?: boolean;
68
- }
69
-
70
- export const VKUserSchema = SchemaFactory.createForClass(VKUser);
1
+ import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
+ import { HydratedDocument } from 'mongoose';
3
+
4
+ export type VKUserCityDocument = HydratedDocument<VKUserCity>;
5
+
6
+ @Schema()
7
+ export class VKUserCity {
8
+ @Prop()
9
+ id: number;
10
+
11
+ @Prop()
12
+ title: string;
13
+ }
14
+
15
+ export const VKUserCitySchema = SchemaFactory.createForClass(VKUserCity);
16
+
17
+ export type VKUserDocument = HydratedDocument<VKUser>;
18
+
19
+ @Schema()
20
+ export class VKUser {
21
+ @Prop()
22
+ id: number;
23
+
24
+ @Prop()
25
+ first_name: string;
26
+
27
+ @Prop()
28
+ last_name: string;
29
+
30
+ @Prop()
31
+ sex: number;
32
+
33
+ @Prop()
34
+ bdate: string;
35
+
36
+ @Prop()
37
+ city: VKUserCity;
38
+
39
+ @Prop()
40
+ country: VKUserCity;
41
+
42
+ @Prop()
43
+ photo_100: string;
44
+
45
+ @Prop()
46
+ photo_200: string;
47
+
48
+ @Prop()
49
+ photo_max_orig: string;
50
+
51
+ @Prop()
52
+ timezone: number;
53
+
54
+ @Prop()
55
+ is_closed: boolean;
56
+
57
+ @Prop()
58
+ can_access_closed: boolean;
59
+
60
+ @Prop()
61
+ can_invite_to_chats: boolean;
62
+
63
+ @Prop()
64
+ is_app_ios: boolean;
65
+
66
+ @Prop()
67
+ is_vk_user_id?: boolean;
68
+ }
69
+
70
+ export const VKUserSchema = SchemaFactory.createForClass(VKUser);
@@ -1,24 +1,24 @@
1
- import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
- import { HydratedDocument } from 'mongoose';
3
-
4
- export type YAUserDocument = HydratedDocument<YAUser>;
5
-
6
- @Schema()
7
- export class YAUser {
8
- @Prop()
9
- userId: string;
10
-
11
- @Prop()
12
- fullName: string;
13
-
14
- @Prop()
15
- language: string;
16
-
17
- @Prop()
18
- avatarUrl: string;
19
-
20
- @Prop()
21
- isGuest: boolean;
22
- }
23
-
24
- export const YAUserSchema = SchemaFactory.createForClass(YAUser);
1
+ import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
+ import { HydratedDocument } from 'mongoose';
3
+
4
+ export type YAUserDocument = HydratedDocument<YAUser>;
5
+
6
+ @Schema()
7
+ export class YAUser {
8
+ @Prop()
9
+ userId: string;
10
+
11
+ @Prop()
12
+ fullName: string;
13
+
14
+ @Prop()
15
+ language: string;
16
+
17
+ @Prop()
18
+ avatarUrl: string;
19
+
20
+ @Prop()
21
+ isGuest: boolean;
22
+ }
23
+
24
+ export const YAUserSchema = SchemaFactory.createForClass(YAUser);