@hedhog/admin 0.0.104 → 0.0.106

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. package/README.md +141 -141
  2. package/dist/admin.module.d.ts.map +1 -1
  3. package/dist/admin.module.js +8 -7
  4. package/dist/admin.module.js.map +1 -1
  5. package/dist/auth/auth.service.d.ts +1 -1
  6. package/dist/auth/auth.service.d.ts.map +1 -1
  7. package/dist/auth/auth.service.js +8 -8
  8. package/dist/auth/auth.service.js.map +1 -1
  9. package/dist/auth/auth.service.spec.js +16 -16
  10. package/dist/auth/auth.service.spec.js.map +1 -1
  11. package/dist/dto/with-locale.dto.d.ts +4 -0
  12. package/dist/dto/with-locale.dto.d.ts.map +1 -0
  13. package/dist/dto/{with-locales.dto.js → with-locale.dto.js} +5 -5
  14. package/dist/dto/with-locale.dto.js.map +1 -0
  15. package/dist/index.d.ts +2 -2
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +2 -2
  18. package/dist/index.js.map +1 -1
  19. package/dist/locale/locale.controller.d.ts +1 -1
  20. package/dist/locale/locale.controller.d.ts.map +1 -1
  21. package/dist/locale/locale.controller.js +4 -4
  22. package/dist/locale/locale.controller.js.map +1 -1
  23. package/dist/locale/locale.middleware.d.ts +1 -1
  24. package/dist/locale/locale.middleware.d.ts.map +1 -1
  25. package/dist/locale/locale.middleware.js +2 -2
  26. package/dist/locale/locale.middleware.js.map +1 -1
  27. package/dist/locale/locale.service.d.ts +6 -6
  28. package/dist/locale/locale.service.d.ts.map +1 -1
  29. package/dist/locale/locale.service.js +43 -43
  30. package/dist/locale/locale.service.js.map +1 -1
  31. package/dist/locale/locale.service.spec.js +14 -14
  32. package/dist/locale/locale.service.spec.js.map +1 -1
  33. package/dist/menu/menu.controller.js +3 -3
  34. package/dist/menu/menu.controller.js.map +1 -1
  35. package/dist/menu/menu.service.d.ts +3 -3
  36. package/dist/menu/menu.service.d.ts.map +1 -1
  37. package/dist/menu/menu.service.js +35 -35
  38. package/dist/menu/menu.service.js.map +1 -1
  39. package/dist/menu/menu.service.spec.js +33 -37
  40. package/dist/menu/menu.service.spec.js.map +1 -1
  41. package/dist/role/dto/create.dto.d.ts +2 -2
  42. package/dist/role/dto/create.dto.d.ts.map +1 -1
  43. package/dist/role/dto/create.dto.js +2 -2
  44. package/dist/role/dto/create.dto.js.map +1 -1
  45. package/dist/role/guards/role.guard.js +4 -4
  46. package/dist/role/guards/role.guard.js.map +1 -1
  47. package/dist/role/role.controller.d.ts.map +1 -1
  48. package/dist/role/role.controller.js +9 -9
  49. package/dist/role/role.controller.js.map +1 -1
  50. package/dist/role/role.service.d.ts +2 -2
  51. package/dist/role/role.service.d.ts.map +1 -1
  52. package/dist/role/role.service.js +35 -35
  53. package/dist/role/role.service.js.map +1 -1
  54. package/dist/role/role.service.spec.d.ts +0 -1
  55. package/dist/role/role.service.spec.js +400 -340
  56. package/dist/role/role.service.spec.js.map +1 -1
  57. package/dist/route/route.controller.js +3 -3
  58. package/dist/route/route.controller.js.map +1 -1
  59. package/dist/route/route.service.d.ts +2 -2
  60. package/dist/route/route.service.d.ts.map +1 -1
  61. package/dist/route/route.service.js +19 -19
  62. package/dist/route/route.service.js.map +1 -1
  63. package/dist/route/route.service.spec.js +27 -27
  64. package/dist/route/route.service.spec.js.map +1 -1
  65. package/dist/screen/screen.controller.d.ts +1 -1
  66. package/dist/screen/screen.controller.d.ts.map +1 -1
  67. package/dist/screen/screen.controller.js +8 -8
  68. package/dist/screen/screen.controller.js.map +1 -1
  69. package/dist/screen/screen.service.d.ts +3 -3
  70. package/dist/screen/screen.service.d.ts.map +1 -1
  71. package/dist/screen/screen.service.js +18 -18
  72. package/dist/screen/screen.service.js.map +1 -1
  73. package/dist/screen/screen.service.spec.js +16 -16
  74. package/dist/screen/screen.service.spec.js.map +1 -1
  75. package/dist/setting/dto/setting.dto.d.ts +9 -0
  76. package/dist/setting/dto/setting.dto.d.ts.map +1 -0
  77. package/dist/setting/dto/{settings.dto.js → setting.dto.js} +6 -6
  78. package/dist/setting/dto/setting.dto.js.map +1 -0
  79. package/dist/setting/{settings.controller.d.ts → setting.controller.d.ts} +8 -8
  80. package/dist/setting/setting.controller.d.ts.map +1 -0
  81. package/dist/setting/{settings.controller.js → setting.controller.js} +26 -26
  82. package/dist/setting/setting.controller.js.map +1 -0
  83. package/dist/setting/setting.module.d.ts +3 -0
  84. package/dist/setting/setting.module.d.ts.map +1 -0
  85. package/dist/setting/{settings.module.js → setting.module.js} +6 -6
  86. package/dist/setting/setting.module.js.map +1 -0
  87. package/dist/setting/{settings.service.d.ts → setting.service.d.ts} +6 -6
  88. package/dist/setting/setting.service.d.ts.map +1 -0
  89. package/dist/setting/{settings.service.js → setting.service.js} +44 -44
  90. package/dist/setting/setting.service.js.map +1 -0
  91. package/dist/setting/setting.service.spec.d.ts +2 -0
  92. package/dist/setting/setting.service.spec.d.ts.map +1 -0
  93. package/dist/setting/{settings.service.spec.js → setting.service.spec.js} +17 -17
  94. package/dist/setting/setting.service.spec.js.map +1 -0
  95. package/dist/user/user.controller.d.ts +2 -2
  96. package/dist/user/user.controller.d.ts.map +1 -1
  97. package/dist/user/user.controller.js +8 -8
  98. package/dist/user/user.controller.js.map +1 -1
  99. package/dist/user/user.service.d.ts +3 -3
  100. package/dist/user/user.service.d.ts.map +1 -1
  101. package/dist/user/user.service.js +10 -10
  102. package/dist/user/user.service.js.map +1 -1
  103. package/dist/user/user.service.spec.js +62 -49
  104. package/dist/user/user.service.spec.js.map +1 -1
  105. package/package.json +2 -2
  106. package/src/admin.module.ts +37 -0
  107. package/src/auth/auth.controller.ts +48 -0
  108. package/src/auth/auth.module.ts +39 -0
  109. package/src/auth/auth.service.spec.ts +196 -0
  110. package/src/auth/auth.service.ts +175 -0
  111. package/src/auth/decorators/public.decorator.ts +4 -0
  112. package/src/auth/decorators/user.decorator.ts +17 -0
  113. package/src/auth/dto/forget.dto.ts +6 -0
  114. package/src/auth/dto/login.dto.ts +15 -0
  115. package/src/auth/dto/otp.dto.ts +11 -0
  116. package/src/auth/enums/multifactor-type.enum.ts +4 -0
  117. package/src/auth/guards/auth.guard.ts +50 -0
  118. package/src/auth/types/user.type.ts +8 -0
  119. package/src/dto/delete.dto.ts +8 -0
  120. package/src/dto/update-ids.dto.ts +9 -0
  121. package/src/dto/with-locale.dto.ts +8 -0
  122. package/src/index.ts +34 -0
  123. package/src/locale/dto/create.dto.ts +12 -0
  124. package/src/locale/dto/delete.dto.ts +8 -0
  125. package/src/locale/dto/set-enabled.dto.ts +9 -0
  126. package/src/locale/dto/update.dto.ts +15 -0
  127. package/src/locale/index.ts +4 -0
  128. package/src/locale/locale.controller.ts +79 -0
  129. package/src/locale/locale.decorator.ts +8 -0
  130. package/src/locale/locale.middleware.ts +34 -0
  131. package/src/locale/locale.module.ts +23 -0
  132. package/src/locale/locale.service.spec.ts +193 -0
  133. package/src/locale/locale.service.ts +366 -0
  134. package/src/menu/dto/create.dto.ts +25 -0
  135. package/src/menu/dto/order.dto.ts +8 -0
  136. package/src/menu/dto/update.dto.ts +19 -0
  137. package/src/menu/menu.controller.ts +106 -0
  138. package/src/menu/menu.module.ts +18 -0
  139. package/src/menu/menu.service.spec.ts +247 -0
  140. package/src/menu/menu.service.ts +263 -0
  141. package/src/role/decorators/role.decorator.ts +4 -0
  142. package/src/role/dto/create.dto.ts +7 -0
  143. package/src/role/dto/update.dto.ts +4 -0
  144. package/src/role/guards/role.guard.ts +122 -0
  145. package/src/role/role.controller.ts +126 -0
  146. package/src/role/role.module.ts +28 -0
  147. package/src/role/role.service.spec.ts +417 -0
  148. package/src/role/role.service.ts +302 -0
  149. package/src/route/dto/create.dto.ts +13 -0
  150. package/src/route/dto/update.dto.ts +15 -0
  151. package/src/route/route.controller.ts +91 -0
  152. package/src/route/route.module.ts +18 -0
  153. package/src/route/route.service.spec.ts +299 -0
  154. package/src/route/route.service.ts +164 -0
  155. package/src/screen/dto/create.dto.ts +19 -0
  156. package/src/screen/dto/update.dto.ts +19 -0
  157. package/src/screen/screen.controller.ts +93 -0
  158. package/src/screen/screen.module.ts +18 -0
  159. package/src/screen/screen.service.spec.ts +298 -0
  160. package/src/screen/screen.service.ts +181 -0
  161. package/src/setting/dto/create.dto.ts +1 -0
  162. package/src/setting/dto/setting-user.dto.ts +6 -0
  163. package/src/setting/dto/setting.dto.ts +17 -0
  164. package/src/setting/dto/update.dto.ts +3 -0
  165. package/src/setting/setting.controller.ts +100 -0
  166. package/src/setting/setting.module.ts +18 -0
  167. package/src/setting/setting.service.spec.ts +183 -0
  168. package/src/setting/setting.service.ts +346 -0
  169. package/src/types/http-method.ts +8 -0
  170. package/src/user/constants/user.constants.ts +1 -0
  171. package/src/user/dto/create.dto.ts +24 -0
  172. package/src/user/dto/update.dto.ts +41 -0
  173. package/src/user/user.controller.ts +75 -0
  174. package/src/user/user.module.ts +18 -0
  175. package/src/user/user.service.spec.ts +294 -0
  176. package/src/user/user.service.ts +129 -0
  177. package/tsconfig.lib.json +9 -0
  178. package/tsconfig.production.json +20 -0
  179. package/dist/dto/with-locales.dto.d.ts +0 -4
  180. package/dist/dto/with-locales.dto.d.ts.map +0 -1
  181. package/dist/dto/with-locales.dto.js.map +0 -1
  182. package/dist/setting/dto/settings.dto.d.ts +0 -9
  183. package/dist/setting/dto/settings.dto.d.ts.map +0 -1
  184. package/dist/setting/dto/settings.dto.js.map +0 -1
  185. package/dist/setting/settings.controller.d.ts.map +0 -1
  186. package/dist/setting/settings.controller.js.map +0 -1
  187. package/dist/setting/settings.module.d.ts +0 -3
  188. package/dist/setting/settings.module.d.ts.map +0 -1
  189. package/dist/setting/settings.module.js.map +0 -1
  190. package/dist/setting/settings.service.d.ts.map +0 -1
  191. package/dist/setting/settings.service.js.map +0 -1
  192. package/dist/setting/settings.service.spec.d.ts +0 -2
  193. package/dist/setting/settings.service.spec.d.ts.map +0 -1
  194. package/dist/setting/settings.service.spec.js.map +0 -1
@@ -12,19 +12,19 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.SettingsService = void 0;
15
+ exports.SettingService = void 0;
16
16
  const pagination_1 = require("@hedhog/pagination");
17
17
  const prisma_1 = require("@hedhog/prisma");
18
18
  const utils_1 = require("@hedhog/utils");
19
19
  const common_1 = require("@nestjs/common");
20
- let SettingsService = class SettingsService {
20
+ let SettingService = class SettingService {
21
21
  constructor(prismaService, paginationService) {
22
22
  this.prismaService = prismaService;
23
23
  this.paginationService = paginationService;
24
24
  }
25
25
  async setManySettings(data) {
26
- for (const { slug, value } of data.settings) {
27
- await this.prismaService.settings.updateMany({
26
+ for (const { slug, value } of data.setting) {
27
+ await this.prismaService.setting.updateMany({
28
28
  where: {
29
29
  slug,
30
30
  },
@@ -39,21 +39,21 @@ let SettingsService = class SettingsService {
39
39
  const fields = ['slug', 'value'];
40
40
  paginationParams.pageSize = 100;
41
41
  const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
42
- const result = await this.paginationService.paginate(this.prismaService.settings, paginationParams, {
42
+ const result = await this.paginationService.paginate(this.prismaService.setting, paginationParams, {
43
43
  where: {
44
44
  AND: {
45
- setting_groups: {
45
+ setting_group: {
46
46
  slug,
47
47
  },
48
48
  OR,
49
49
  },
50
50
  },
51
51
  include: {
52
- setting_groups: {
52
+ setting_group: {
53
53
  include: {
54
- setting_group_translations: {
54
+ setting_group_locale: {
55
55
  where: {
56
- locales: {
56
+ locale: {
57
57
  code: locale,
58
58
  },
59
59
  },
@@ -64,9 +64,9 @@ let SettingsService = class SettingsService {
64
64
  },
65
65
  },
66
66
  },
67
- setting_translations: {
67
+ setting_locale: {
68
68
  where: {
69
- locales: {
69
+ locale: {
70
70
  code: locale,
71
71
  },
72
72
  },
@@ -76,25 +76,25 @@ let SettingsService = class SettingsService {
76
76
  },
77
77
  },
78
78
  },
79
- }, 'setting_translations');
79
+ }, 'setting_locale');
80
80
  result.data = result.data.map((setting) => {
81
- setting.setting_groups = (0, utils_1.itemTranslations)('setting_group_translations', setting.setting_groups);
81
+ setting.setting_group = (0, utils_1.itemTranslations)('setting_group_locale', setting.setting_group);
82
82
  return setting;
83
83
  });
84
84
  return result;
85
85
  }
86
- async getSettingGroups(locale, paginationParams) {
86
+ async listSettingGroups(locale, paginationParams) {
87
87
  const fields = ['slug', 'icon'];
88
88
  paginationParams.pageSize = 100;
89
89
  const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
90
- const result = await this.paginationService.paginate(this.prismaService.setting_groups, paginationParams, {
90
+ const result = await this.paginationService.paginate(this.prismaService.setting_group, paginationParams, {
91
91
  where: {
92
92
  OR,
93
93
  },
94
94
  include: {
95
- setting_group_translations: {
95
+ setting_group_locale: {
96
96
  where: {
97
- locales: {
97
+ locale: {
98
98
  code: locale,
99
99
  },
100
100
  },
@@ -104,22 +104,22 @@ let SettingsService = class SettingsService {
104
104
  },
105
105
  },
106
106
  },
107
- }, 'setting_group_translations');
107
+ }, 'setting_group_locale');
108
108
  return result;
109
109
  }
110
- async getSettings(locale, paginationParams) {
110
+ async listSettings(locale, paginationParams) {
111
111
  const fields = ['slug', 'value'];
112
112
  const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
113
- const result = await this.paginationService.paginate(this.prismaService.settings, paginationParams, {
113
+ const result = await this.paginationService.paginate(this.prismaService.setting, paginationParams, {
114
114
  where: {
115
115
  OR,
116
116
  },
117
117
  include: {
118
- setting_groups: {
118
+ setting_group: {
119
119
  include: {
120
- setting_group_translations: {
120
+ setting_group_locale: {
121
121
  where: {
122
- locales: {
122
+ locale: {
123
123
  code: locale,
124
124
  },
125
125
  },
@@ -130,9 +130,9 @@ let SettingsService = class SettingsService {
130
130
  },
131
131
  },
132
132
  },
133
- setting_translations: {
133
+ setting_locale: {
134
134
  where: {
135
- locales: {
135
+ locale: {
136
136
  code: locale,
137
137
  },
138
138
  },
@@ -142,31 +142,31 @@ let SettingsService = class SettingsService {
142
142
  },
143
143
  },
144
144
  },
145
- }, 'setting_translations');
145
+ }, 'setting_locale');
146
146
  result.data = result.data.map((setting) => {
147
- setting.setting_groups = (0, utils_1.itemTranslations)('setting_group_translations', setting.setting_groups);
147
+ setting.setting_group = (0, utils_1.itemTranslations)('setting_group_locale', setting.setting_group);
148
148
  return setting;
149
149
  });
150
150
  return result;
151
151
  }
152
152
  async get(settingId) {
153
- return this.prismaService.settings.findUnique({
153
+ return this.prismaService.setting.findUnique({
154
154
  where: { id: settingId },
155
155
  });
156
156
  }
157
157
  async create({}) {
158
- return this.prismaService.settings.create({
158
+ return this.prismaService.setting.create({
159
159
  data: {},
160
160
  });
161
161
  }
162
162
  async update({ id, data }) {
163
- return this.prismaService.settings.update({
163
+ return this.prismaService.setting.update({
164
164
  where: { id },
165
165
  data,
166
166
  });
167
167
  }
168
168
  async updateFromSlug(slug, data) {
169
- const { id } = await this.prismaService.settings.findFirst({
169
+ const { id } = await this.prismaService.setting.findFirst({
170
170
  where: {
171
171
  slug,
172
172
  },
@@ -183,7 +183,7 @@ let SettingsService = class SettingsService {
183
183
  if (ids == undefined || ids == null) {
184
184
  throw new common_1.BadRequestException(`You must select at least one setting to delete.`);
185
185
  }
186
- return this.prismaService.settings.deleteMany({
186
+ return this.prismaService.setting.deleteMany({
187
187
  where: {
188
188
  id: {
189
189
  in: ids,
@@ -192,7 +192,7 @@ let SettingsService = class SettingsService {
192
192
  });
193
193
  }
194
194
  async setSettingUserValue(user_id, slug, value) {
195
- const user = await this.prismaService.users.findUnique({
195
+ const user = await this.prismaService.user.findUnique({
196
196
  where: {
197
197
  id: user_id,
198
198
  },
@@ -203,7 +203,7 @@ let SettingsService = class SettingsService {
203
203
  if (!user) {
204
204
  throw new common_1.BadRequestException(`User with id ${user_id} not found.`);
205
205
  }
206
- const setting = await this.prismaService.settings.findFirst({
206
+ const setting = await this.prismaService.setting.findFirst({
207
207
  where: {
208
208
  slug,
209
209
  user_override: true,
@@ -212,7 +212,7 @@ let SettingsService = class SettingsService {
212
212
  if (!setting) {
213
213
  throw new common_1.BadRequestException(`Setting with slug ${slug} not found or user can not override.`);
214
214
  }
215
- return await this.prismaService.setting_users.upsert({
215
+ return await this.prismaService.setting_user.upsert({
216
216
  where: {
217
217
  user_id_setting_id: {
218
218
  setting_id: setting.id,
@@ -236,7 +236,7 @@ let SettingsService = class SettingsService {
236
236
  }
237
237
  async getSettingValues(slug) {
238
238
  slug = Array.isArray(slug) ? slug : [slug];
239
- let settings = await this.prismaService.settings.findMany({
239
+ let setting = await this.prismaService.setting.findMany({
240
240
  where: {
241
241
  slug: {
242
242
  in: slug,
@@ -250,8 +250,8 @@ let SettingsService = class SettingsService {
250
250
  user_override: true,
251
251
  },
252
252
  });
253
- const slugUserOverride = settings.filter((setting) => setting.userOverride);
254
- const settingsUser = await this.prismaService.setting_users.findMany({
253
+ const slugUserOverride = setting.filter((setting) => setting.userOverride);
254
+ const settingUser = await this.prismaService.setting_user.findMany({
255
255
  where: {
256
256
  setting_id: {
257
257
  in: slugUserOverride.map((setting) => setting.id),
@@ -263,22 +263,22 @@ let SettingsService = class SettingsService {
263
263
  },
264
264
  });
265
265
  const data = {};
266
- settings.forEach((setting) => {
266
+ setting.forEach((setting) => {
267
267
  data[setting.slug] = setting.value;
268
268
  });
269
- settingsUser.forEach((setting) => {
269
+ settingUser.forEach((setting) => {
270
270
  data[slugUserOverride.find((s) => s.id === setting.setting_id).slug] =
271
271
  setting.value;
272
272
  });
273
273
  return data;
274
274
  }
275
275
  };
276
- exports.SettingsService = SettingsService;
277
- exports.SettingsService = SettingsService = __decorate([
276
+ exports.SettingService = SettingService;
277
+ exports.SettingService = SettingService = __decorate([
278
278
  (0, common_1.Injectable)(),
279
279
  __param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => prisma_1.PrismaService))),
280
280
  __param(1, (0, common_1.Inject)((0, common_1.forwardRef)(() => pagination_1.PaginationService))),
281
281
  __metadata("design:paramtypes", [prisma_1.PrismaService,
282
282
  pagination_1.PaginationService])
283
- ], SettingsService);
284
- //# sourceMappingURL=settings.service.js.map
283
+ ], SettingService);
284
+ //# sourceMappingURL=setting.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setting.service.js","sourceRoot":"","sources":["../../src/setting/setting.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAsE;AACtE,2CAA+C;AAC/C,yCAAiD;AACjD,2CAKwB;AAOjB,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,YAEmB,aAA4B,EAE5B,iBAAoC;QAFpC,kBAAa,GAAb,aAAa,CAAe;QAE5B,sBAAiB,GAAjB,iBAAiB,CAAmB;IACpD,CAAC;IAEJ,KAAK,CAAC,eAAe,CAAC,IAAgB;QACpC,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAC3C,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC;gBAC1C,KAAK,EAAE;oBACL,IAAI;iBACL;gBACD,IAAI,EAAE;oBACJ,KAAK;iBACN;aACF,CAAC,CAAC;QACL,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,MAAW,EAAE,gBAAqB,EAAE,IAAY;QACxE,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAEjC,gBAAgB,CAAC,QAAQ,GAAG,GAAG,CAAC;QAEhC,MAAM,EAAE,GAAU,IAAI,CAAC,aAAa,CAAC,uBAAuB,CAC1D,MAAM,EACN,gBAAgB,CACjB,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAClD,IAAI,CAAC,aAAa,CAAC,OAAO,EAC1B,gBAAgB,EAChB;YACE,KAAK,EAAE;gBACL,GAAG,EAAE;oBACH,aAAa,EAAE;wBACb,IAAI;qBACL;oBACD,EAAE;iBACH;aACF;YACD,OAAO,EAAE;gBACP,aAAa,EAAE;oBAC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IAD1B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,sBAAa,CAAC,CAAC,CAAA;IAEvC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,8BAAiB,CAAC,CAAC,CAAA;qCADZ,sBAAa;QAET,8BAAiB;GAL5C,cAAc,CA0U1B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=setting.service.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setting.service.spec.d.ts","sourceRoot":"","sources":["../../src/setting/setting.service.spec.ts"],"names":[],"mappings":""}
@@ -4,19 +4,19 @@ const pagination_1 = require("@hedhog/pagination");
4
4
  const prisma_1 = require("@hedhog/prisma");
5
5
  const common_1 = require("@nestjs/common");
6
6
  const testing_1 = require("@nestjs/testing");
7
- const settings_service_1 = require("./settings.service");
8
- describe('SettingsService', () => {
7
+ const setting_service_1 = require("./setting.service");
8
+ describe('SettingService', () => {
9
9
  let service;
10
10
  let prismaService;
11
11
  // let paginationService: PaginationService;
12
12
  beforeEach(async () => {
13
13
  const module = await testing_1.Test.createTestingModule({
14
14
  providers: [
15
- settings_service_1.SettingsService,
15
+ setting_service_1.SettingService,
16
16
  {
17
17
  provide: prisma_1.PrismaService,
18
18
  useValue: {
19
- settings: {
19
+ setting: {
20
20
  findUnique: jest.fn(),
21
21
  create: jest.fn(),
22
22
  update: jest.fn(),
@@ -33,7 +33,7 @@ describe('SettingsService', () => {
33
33
  },
34
34
  ],
35
35
  }).compile();
36
- service = module.get(settings_service_1.SettingsService);
36
+ service = module.get(setting_service_1.SettingService);
37
37
  prismaService = module.get(prisma_1.PrismaService);
38
38
  // paginationService = module.get<PaginationService>(PaginationService);
39
39
  });
@@ -41,7 +41,7 @@ describe('SettingsService', () => {
41
41
  expect(service).toBeDefined();
42
42
  });
43
43
  /* describe('getSettings', () => {
44
- it('should return paginated settings', async () => {
44
+ it('should return paginated setting', async () => {
45
45
  const paginationParams: PaginationDTO = {
46
46
  page: 1,
47
47
  pageSize: 10,
@@ -73,7 +73,7 @@ describe('SettingsService', () => {
73
73
  paginationParams,
74
74
  );
75
75
  expect(paginationService.paginate).toHaveBeenCalledWith(
76
- prismaService.settings,
76
+ prismaService.setting,
77
77
  paginationParams,
78
78
  { where: { OR: [] } },
79
79
  );
@@ -89,10 +89,10 @@ describe('SettingsService', () => {
89
89
  updated_at: new Date(),
90
90
  };
91
91
  jest
92
- .spyOn(prismaService.settings, 'findUnique')
92
+ .spyOn(prismaService.setting, 'findUnique')
93
93
  .mockResolvedValue(mockSetting);
94
94
  const result = await service.get(1);
95
- expect(prismaService.settings.findUnique).toHaveBeenCalledWith({
95
+ expect(prismaService.setting.findUnique).toHaveBeenCalledWith({
96
96
  where: { id: 1 },
97
97
  });
98
98
  expect(result).toEqual(mockSetting);
@@ -110,12 +110,12 @@ describe('SettingsService', () => {
110
110
  };
111
111
 
112
112
  jest
113
- .spyOn(prismaService.settings, 'create')
113
+ .spyOn(prismaService.setting, 'create')
114
114
  .mockResolvedValue(mockSetting);
115
115
 
116
116
  const result = await service.create(createDTO);
117
117
 
118
- expect(prismaService.settings.create).toHaveBeenCalledWith({
118
+ expect(prismaService.setting.create).toHaveBeenCalledWith({
119
119
  data: { name: createDTO.name },
120
120
  });
121
121
  expect(result).toEqual(mockSetting);
@@ -132,10 +132,10 @@ describe('SettingsService', () => {
132
132
  updated_at: new Date(),
133
133
  };
134
134
  jest
135
- .spyOn(prismaService.settings, 'update')
135
+ .spyOn(prismaService.setting, 'update')
136
136
  .mockResolvedValue(mockSetting);
137
137
  const result = await service.update(updateInput);
138
- expect(prismaService.settings.update).toHaveBeenCalledWith({
138
+ expect(prismaService.setting.update).toHaveBeenCalledWith({
139
139
  where: { id: updateInput.id },
140
140
  data: updateInput.data,
141
141
  });
@@ -147,16 +147,16 @@ describe('SettingsService', () => {
147
147
  const deleteDTO = { ids: null };
148
148
  await expect(service.delete(deleteDTO)).rejects.toThrow(new common_1.BadRequestException(`You must select at least one setting to delete.`));
149
149
  });
150
- it('should delete settings by ids', async () => {
150
+ it('should delete setting by ids', async () => {
151
151
  const deleteDTO = { ids: [1, 2] };
152
152
  jest
153
- .spyOn(prismaService.settings, 'deleteMany')
153
+ .spyOn(prismaService.setting, 'deleteMany')
154
154
  .mockResolvedValue({ count: 2 });
155
155
  await service.delete(deleteDTO);
156
- expect(prismaService.settings.deleteMany).toHaveBeenCalledWith({
156
+ expect(prismaService.setting.deleteMany).toHaveBeenCalledWith({
157
157
  where: { id: { in: deleteDTO.ids } },
158
158
  });
159
159
  });
160
160
  });
161
161
  });
162
- //# sourceMappingURL=settings.service.spec.js.map
162
+ //# sourceMappingURL=setting.service.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setting.service.spec.js","sourceRoot":"","sources":["../../src/setting/setting.service.spec.ts"],"names":[],"mappings":";;AAAA,mDAAuD;AACvD,2CAA+C;AAC/C,2CAAqD;AACrD,6CAAsD;AAGtD,uDAAmD;AAEnD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,IAAI,OAAuB,CAAC;IAC5B,IAAI,aAA4B,CAAC;IACjC,4CAA4C;IAE5C,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,MAAM,MAAM,GAAkB,MAAM,cAAI,CAAC,mBAAmB,CAAC;YAC3D,SAAS,EAAE;gBACT,gCAAc;gBACd;oBACE,OAAO,EAAE,sBAAa;oBACtB,QAAQ,EAAE;wBACR,OAAO,EAAE;4BACP,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;4BACrB,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE;4BACjB,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE;4BACjB,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;yBACtB;wBACD,uBAAuB,EAAE,IAAI,CAAC,EAAE,EAAE;qBACnC;iBACF;gBACD;oBACE,OAAO,EA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AE;YAC5C,MAAM,SAAS,GAAc,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YAE7C,IAAI;iBACD,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE,YAAY,CAAC;iBAC1C,iBAAiB,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;YAEnC,MAAM,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAEhC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC;gBAC5D,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,CAAC,GAAG,EAAE,EAAE;aACrC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -6,10 +6,10 @@ import { UserService } from './user.service';
6
6
  export declare class UserController {
7
7
  private readonly userService;
8
8
  constructor(userService: UserService);
9
- getUsers(paginationParams: any): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
9
+ list(paginationParams: any): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
10
10
  listRoles(userId: number, paginationParams: any): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
11
11
  updateRoles(userId: number, data: UpdateIdsDTO): Promise<any>;
12
- show(userId: number): Promise<any>;
12
+ get(userId: number): Promise<any>;
13
13
  create(data: CreateDTO): Promise<any>;
14
14
  update(userId: number, data: UpdateDTO): Promise<any>;
15
15
  delete(data: DeleteDTO): Promise<any>;
@@ -1 +1 @@
1
- {"version":3,"file":"user.controller.d.ts","sourceRoot":"","sources":["../../src/user/user.controller.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,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CAAS,IAAI,EAAE,SAAS;CAGrC"}
@@ -25,8 +25,8 @@ let UserController = class UserController {
25
25
  constructor(userService) {
26
26
  this.userService = userService;
27
27
  }
28
- async getUsers(paginationParams) {
29
- return this.userService.getUsers(paginationParams);
28
+ async list(paginationParams) {
29
+ return this.userService.list(paginationParams);
30
30
  }
31
31
  async listRoles(userId, paginationParams) {
32
32
  return this.userService.listRoles(userId, paginationParams);
@@ -34,7 +34,7 @@ let UserController = class UserController {
34
34
  async updateRoles(userId, data) {
35
35
  return this.userService.updateRoles(userId, data);
36
36
  }
37
- async show(userId) {
37
+ async get(userId) {
38
38
  return this.userService.get(userId);
39
39
  }
40
40
  create(data) {
@@ -57,9 +57,9 @@ __decorate([
57
57
  __metadata("design:type", Function),
58
58
  __metadata("design:paramtypes", [Object]),
59
59
  __metadata("design:returntype", Promise)
60
- ], UserController.prototype, "getUsers", null);
60
+ ], UserController.prototype, "list", null);
61
61
  __decorate([
62
- (0, common_1.Get)(':userId/roles'),
62
+ (0, common_1.Get)(':userId/role'),
63
63
  __param(0, (0, common_1.Param)('userId', common_1.ParseIntPipe)),
64
64
  __param(1, (0, pagination_1.Pagination)()),
65
65
  __metadata("design:type", Function),
@@ -67,7 +67,7 @@ __decorate([
67
67
  __metadata("design:returntype", Promise)
68
68
  ], UserController.prototype, "listRoles", null);
69
69
  __decorate([
70
- (0, common_1.Patch)(':userId/roles'),
70
+ (0, common_1.Patch)(':userId/role'),
71
71
  __param(0, (0, common_1.Param)('userId', common_1.ParseIntPipe)),
72
72
  __param(1, (0, common_1.Body)()),
73
73
  __metadata("design:type", Function),
@@ -80,7 +80,7 @@ __decorate([
80
80
  __metadata("design:type", Function),
81
81
  __metadata("design:paramtypes", [Number]),
82
82
  __metadata("design:returntype", Promise)
83
- ], UserController.prototype, "show", null);
83
+ ], UserController.prototype, "get", null);
84
84
  __decorate([
85
85
  (0, common_1.Post)(),
86
86
  __param(0, (0, common_1.Body)()),
@@ -105,7 +105,7 @@ __decorate([
105
105
  ], UserController.prototype, "delete", null);
106
106
  exports.UserController = UserController = __decorate([
107
107
  (0, role_decorator_1.Role)(),
108
- (0, common_1.Controller)('users'),
108
+ (0, common_1.Controller)('user'),
109
109
  __param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => user_service_1.UserService))),
110
110
  __metadata("design:paramtypes", [user_service_1.UserService])
111
111
  ], UserController);
@@ -1 +1 @@
1
- {"version":3,"file":"user.controller.js","sourceRoot":"","sources":["../../src/user/user.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAgD;AAChD,2CAWwB;AACxB,kDAA8C;AAC9C,0DAAqD;AACrD,sEAAyD;AACzD,iDAA6C;AAC7C,iDAA6C;AAC7C,iDAA6C;AAItC,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,YAEmB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IACxC,CAAC;IAGE,AAAN,KAAK,CAAC,QAAQ,CAAe,gBAAgB;QAC3C,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IACrD,CAAC;IAGK,AAAN,KAAK,CAAC,SAAS,CACkB,MAAc,EAC/B,gBAAgB;QAE9B,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC9D,CAAC;IAGK,AAAN,KAAK,CAAC,WAAW,CACgB,MAAc,EACrC,IAAkB;QAE1B,OAAO,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;IAGK,AAAN,KAAK,CAAC,IAAI,CAAgC,MAAc;QACtD,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;IAGD,MAAM,CAAS,IAAe;QAC5B,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAGK,AAAN,KAAK,CAA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16 +1,16 @@
1
1
  import { PaginationDTO, PaginationService } from '@hedhog/pagination';
2
2
  import { PrismaService } from '@hedhog/prisma';
3
- import { CreateDTO } from './dto/create.dto';
4
3
  import { DeleteDTO } from '../dto/delete.dto';
5
- import { UpdateDTO } from './dto/update.dto';
6
4
  import { UpdateIdsDTO } from '../dto/update-ids.dto';
5
+ import { CreateDTO } from './dto/create.dto';
6
+ import { UpdateDTO } from './dto/update.dto';
7
7
  export declare class UserService {
8
8
  private readonly prismaService;
9
9
  private readonly paginationService;
10
10
  constructor(prismaService: PrismaService, paginationService: PaginationService);
11
11
  listRoles(userId: number, paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
12
12
  updateRoles(userId: number, { ids }: UpdateIdsDTO): Promise<any>;
13
- getUsers(paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
13
+ list(paginationParams: PaginationDTO): Promise<import("@hedhog/pagination").PaginatedResult<unknown>>;
14
14
  get(userId: number): Promise<any>;
15
15
  hashPassword(password: string): Promise<string>;
16
16
  create({ email, name, password }: CreateDTO): Promise<any>;
@@ -1 +1 @@
1
- {"version":3,"file":"user.service.d.ts","sourceRoot":"","sources":["../../src/user/user.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAS/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,qBACa,WAAW;IAGpB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAFjB,aAAa,EAAE,aAAa,E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EAAE,GAAG,EAAE,EAAE,YAAY;IAkBjD,IAAI,CAAC,gBAAgB,EAAE,aAAa;IAkBpC,GAAG,CAAC,MAAM,EAAE,MAAM;IAIlB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAK/C,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,SAAS;IAY3C,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE;IAOpD,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,SAAS;CAoBhC"}
@@ -24,9 +24,9 @@ let UserService = class UserService {
24
24
  this.paginationService = paginationService;
25
25
  }
26
26
  async listRoles(userId, paginationParams) {
27
- return this.paginationService.paginate(this.prismaService.roles, paginationParams, {
27
+ return this.paginationService.paginate(this.prismaService.role, paginationParams, {
28
28
  include: {
29
- role_users: {
29
+ role_user: {
30
30
  where: {
31
31
  user_id: userId,
32
32
  },
@@ -39,12 +39,12 @@ let UserService = class UserService {
39
39
  });
40
40
  }
41
41
  async updateRoles(userId, { ids }) {
42
- await this.prismaService.role_users.deleteMany({
42
+ await this.prismaService.role_user.deleteMany({
43
43
  where: {
44
44
  user_id: userId,
45
45
  },
46
46
  });
47
- return this.prismaService.role_users.createMany({
47
+ return this.prismaService.role_user.createMany({
48
48
  data: ids.map((role) => {
49
49
  return {
50
50
  user_id: userId,
@@ -54,17 +54,17 @@ let UserService = class UserService {
54
54
  skipDuplicates: true,
55
55
  });
56
56
  }
57
- async getUsers(paginationParams) {
57
+ async list(paginationParams) {
58
58
  const fields = ['name', 'email'];
59
59
  const OR = this.prismaService.createInsensitiveSearch(fields, paginationParams);
60
- return this.paginationService.paginate(this.prismaService.users, paginationParams, {
60
+ return this.paginationService.paginate(this.prismaService.user, paginationParams, {
61
61
  where: {
62
62
  OR,
63
63
  },
64
64
  });
65
65
  }
66
66
  async get(userId) {
67
- return this.prismaService.users.findUnique({ where: { id: userId } });
67
+ return this.prismaService.user.findUnique({ where: { id: userId } });
68
68
  }
69
69
  async hashPassword(password) {
70
70
  const salt = await (0, bcrypt_1.genSalt)(user_constants_1.SALT_ROUNDS);
@@ -72,7 +72,7 @@ let UserService = class UserService {
72
72
  }
73
73
  async create({ email, name, password }) {
74
74
  const hashedPassword = await this.hashPassword(password);
75
- return this.prismaService.users.create({
75
+ return this.prismaService.user.create({
76
76
  data: {
77
77
  email,
78
78
  name,
@@ -81,7 +81,7 @@ let UserService = class UserService {
81
81
  });
82
82
  }
83
83
  async update({ id, data }) {
84
- return this.prismaService.users.update({
84
+ return this.prismaService.user.update({
85
85
  where: { id },
86
86
  data,
87
87
  });
@@ -90,7 +90,7 @@ let UserService = class UserService {
90
90
  if (ids == undefined || ids == null) {
91
91
  throw new common_1.BadRequestException(`You must select at least one user to delete.`);
92
92
  }
93
- return this.prismaService.users.deleteMany({
93
+ return this.prismaService.user.deleteMany({
94
94
  where: {
95
95
  id: {
96
96
  in: ids,
@@ -1 +1 @@
1
- {"version":3,"file":"user.service.js","sourceRoot":"","sources":["../../src/user/user.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAAsE;AACtE,2CAA+C;AAC/C,2CAKwB;AACxB,mCAAuC;AACvC,+DAAyD;AAOlD,IAAM,WAAW,GAAjB,MAAM,WAAW;IACtB,YAEmB,aAA4B,EAE5B,iBAAoC;QAFpC,kBAAa,GAAb,aAAa,CAAe;QAE5B,sBAAiB,GAAjB,iBAAiB,CAAmB;IACpD,CAAC;IAEJ,KAAK,CAAC,SAAS,CAAC,MAAc,EAAE,gBAA+B;QAC7D,OAAO,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CACpC,IAAI,CAAC,aAAa,CAAC,KAAK,EACxB,gBAAgB,EAChB;YACE,OAAO,EAAE;gBACP,UAAU,EAAE;oBACV,KAAK,EAAE;wBACL,OAAO,EAAE,MAAM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