@hed-hog/contact-us 0.0.3 → 0.0.4
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.
- package/dist/contact-us.controller.d.ts +2 -2
- package/dist/contact-us.controller.d.ts.map +1 -1
- package/dist/contact-us.controller.js +8 -6
- package/dist/contact-us.controller.js.map +1 -1
- package/dist/contact-us.module.d.ts.map +1 -1
- package/dist/contact-us.module.js +0 -2
- package/dist/contact-us.module.js.map +1 -1
- package/dist/contact-us.service.d.ts +2 -2
- package/dist/contact-us.service.d.ts.map +1 -1
- package/dist/contact-us.service.js +7 -6
- package/dist/contact-us.service.js.map +1 -1
- package/dist/dto/contact-us-response.dto.d.ts.map +1 -1
- package/dist/dto/contact-us-response.dto.js +4 -1
- package/dist/dto/contact-us-response.dto.js.map +1 -1
- package/dist/dto/contact-us-send.dto.d.ts.map +1 -1
- package/dist/dto/contact-us-send.dto.js +10 -3
- package/dist/dto/contact-us-send.dto.js.map +1 -1
- package/dist/dto/contact-us-status.dto.d.ts.map +1 -1
- package/dist/dto/contact-us-status.dto.js +2 -1
- package/dist/dto/contact-us-status.dto.js.map +1 -1
- package/package.json +3 -3
- package/src/contact-us.controller.ts +7 -3
- package/src/contact-us.module.ts +0 -2
- package/src/contact-us.service.ts +24 -8
- package/src/dto/contact-us-response.dto.ts +5 -1
- package/src/dto/contact-us-send.dto.ts +16 -3
- package/src/dto/contact-us-status.dto.ts +7 -1
- package/src/language/en.json +10 -0
- package/src/language/pt.json +10 -0
|
@@ -57,7 +57,7 @@ export declare class ContactUsController {
|
|
|
57
57
|
next: number;
|
|
58
58
|
lastPage: number;
|
|
59
59
|
}>;
|
|
60
|
-
deleteContactUsMessage(id: number): Promise<{
|
|
60
|
+
deleteContactUsMessage(id: number, locale: string): Promise<{
|
|
61
61
|
name: string;
|
|
62
62
|
response: string | null;
|
|
63
63
|
id: number;
|
|
@@ -69,7 +69,7 @@ export declare class ContactUsController {
|
|
|
69
69
|
user_id: number | null;
|
|
70
70
|
response_id: number | null;
|
|
71
71
|
}>;
|
|
72
|
-
updateContactUsMessageStatus(id: number, { status }: ContactUsStatusDTO): Promise<{
|
|
72
|
+
updateContactUsMessageStatus(id: number, { status }: ContactUsStatusDTO, locale: string): Promise<{
|
|
73
73
|
name: string;
|
|
74
74
|
response: string | null;
|
|
75
75
|
id: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-us.controller.d.ts","sourceRoot":"","sources":["../src/contact-us.controller.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE,qBACa,mBAAmB;IAE5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBAAhB,gBAAgB,EAAE,gBAAgB;IAK/C,oBAAoB;IAKpB,YAAY;;;;;;;IAKZ,mBAAmB,CAA4B,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKzD,oBAAoB,CAAe,gBAAgB,KAAA,EAAW,EAAE,MAAM,EAAE;;KAAA;;;;;;;;;IAKxE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"contact-us.controller.d.ts","sourceRoot":"","sources":["../src/contact-us.controller.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE,qBACa,mBAAmB;IAE5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBAAhB,gBAAgB,EAAE,gBAAgB;IAK/C,oBAAoB;IAKpB,YAAY;;;;;;;IAKZ,mBAAmB,CAA4B,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKzD,oBAAoB,CAAe,gBAAgB,KAAA,EAAW,EAAE,MAAM,EAAE;;KAAA;;;;;;;;;IAKxE,sBAAsB,CACC,EAAE,EAAE,MAAM,EAC3B,MAAM,EAAE,MAAM;;;;;;;;;;;;IAMpB,4BAA4B,CACL,EAAE,EAAE,MAAM,EAC7B,EAAE,MAAM,EAAE,EAAE,kBAAkB,EAC5B,MAAM,EAAE,MAAM;;;;;;;;;;;;IAMpB,yBAAyB,CACnB,MAAM,EAAE,MAAM,EACG,EAAE,EAAE,MAAM,EAC7B,EAAE,QAAQ,EAAE,EAAE,oBAAoB,EAClC,IAAI,KAAA;IAOR,sBAAsB,CAChB,MAAM,EAAE,MAAM,EAChB,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,gBAAgB;;;;;;;;;;;;CAIrD"}
|
|
@@ -37,11 +37,11 @@ let ContactUsController = class ContactUsController {
|
|
|
37
37
|
async getContactUsMessages(paginationParams, { status }) {
|
|
38
38
|
return this.contactUsService.getContactUsMessages(paginationParams, status);
|
|
39
39
|
}
|
|
40
|
-
async deleteContactUsMessage(id) {
|
|
41
|
-
return this.contactUsService.deleteContactUsMessage(id);
|
|
40
|
+
async deleteContactUsMessage(id, locale) {
|
|
41
|
+
return this.contactUsService.deleteContactUsMessage(id, locale);
|
|
42
42
|
}
|
|
43
|
-
async updateContactUsMessageStatus(id, { status }) {
|
|
44
|
-
return this.contactUsService.updateContactUsMessageStatus(id, { status });
|
|
43
|
+
async updateContactUsMessageStatus(id, { status }, locale) {
|
|
44
|
+
return this.contactUsService.updateContactUsMessageStatus(id, { status }, locale);
|
|
45
45
|
}
|
|
46
46
|
async respondToContactUsMessage(locale, id, { response }, user) {
|
|
47
47
|
return this.contactUsService.respondToContactUsMessage(locale, id, { response }, user);
|
|
@@ -82,16 +82,18 @@ __decorate([
|
|
|
82
82
|
__decorate([
|
|
83
83
|
(0, common_1.Delete)(':id'),
|
|
84
84
|
__param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
|
|
85
|
+
__param(1, (0, api_locale_1.Locale)()),
|
|
85
86
|
__metadata("design:type", Function),
|
|
86
|
-
__metadata("design:paramtypes", [Number]),
|
|
87
|
+
__metadata("design:paramtypes", [Number, String]),
|
|
87
88
|
__metadata("design:returntype", Promise)
|
|
88
89
|
], ContactUsController.prototype, "deleteContactUsMessage", null);
|
|
89
90
|
__decorate([
|
|
90
91
|
(0, common_1.Patch)('status/:id'),
|
|
91
92
|
__param(0, (0, common_1.Param)('id', common_1.ParseIntPipe)),
|
|
92
93
|
__param(1, (0, common_1.Body)()),
|
|
94
|
+
__param(2, (0, api_locale_1.Locale)()),
|
|
93
95
|
__metadata("design:type", Function),
|
|
94
|
-
__metadata("design:paramtypes", [Number, contact_us_status_dto_1.ContactUsStatusDTO]),
|
|
96
|
+
__metadata("design:paramtypes", [Number, contact_us_status_dto_1.ContactUsStatusDTO, String]),
|
|
95
97
|
__metadata("design:returntype", Promise)
|
|
96
98
|
], ContactUsController.prototype, "updateContactUsMessageStatus", null);
|
|
97
99
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-us.controller.js","sourceRoot":"","sources":["../src/contact-us.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAA4C;AAC5C,oDAA6C;AAC7C,4DAAqD;AACrD,2CAAwG;AACxG,6DAAwD;AACxD,2EAAqE;AACrE,mEAA6D;AAC7D,uEAAiE;AAG1D,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAC9B,YACmB,gBAAkC;QAAlC,qBAAgB,GAAhB,gBAAgB,CAAkB;IACjD,CAAC;IAIC,AAAN,KAAK,CAAC,oBAAoB;QACxB,OAAO,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,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,CAAA;;;;+DAElE;AAGK;IADL,IAAA,eAAM,EAAC,KAAK,CAAC;IAEX,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,qBAAY,CAAC,CAAA;IACzB,WAAA,IAAA,mBAAM,GAAE,CAAA;;;;iEAGV;AAGK;IADL,IAAA,cAAK,EAAC,YAAY,CAAC;IAEjB,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,qBAAY,CAAC,CAAA;IACzB,WAAA,IAAA,aAAI,GAAE,CAAA;IACN,WAAA,IAAA,mBAAM,GAAE,CAAA;;6CADW,0CAAkB;;uEAIvC;AAGK;IADL,IAAA,aAAI,EAAC,cAAc,CAAC;IAElB,WAAA,IAAA,mBAAM,GAAE,CAAA;IACR,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,qBAAY,CAAC,CAAA;IACzB,WAAA,IAAA,aAAI,GAAE,CAAA;IACN,WAAA,IAAA,UAAI,GAAE,CAAA;;qDADe,8CAAoB;;oEAI3C;AAIK;IAFL,IAAA,YAAM,GAAE;IACR,IAAA,aAAI,GAAE;IAEJ,WAAA,IAAA,mBAAM,GAAE,CAAA;IACR,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAA2B,sCAAgB;;iEAGnD;8BA5DU,mBAAmB;IAD/B,IAAA,mBAAU,EAAC,YAAY,CAAC;qCAGc,qCAAgB;GAF1C,mBAAmB,CA6D/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-us.module.d.ts","sourceRoot":"","sources":["../src/contact-us.module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contact-us.module.d.ts","sourceRoot":"","sources":["../src/contact-us.module.ts"],"names":[],"mappings":"AAQA,qBAYa,eAAe;CAAG"}
|
|
@@ -9,7 +9,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.ContactUsModule = void 0;
|
|
10
10
|
const admin_1 = require("@hed-hog/admin");
|
|
11
11
|
const mail_module_1 = require("@hed-hog/admin/mail/mail.module");
|
|
12
|
-
const setting_module_1 = require("@hed-hog/admin/setting/setting.module");
|
|
13
12
|
const api_locale_1 = require("@hed-hog/api-locale");
|
|
14
13
|
const api_pagination_1 = require("@hed-hog/api-pagination");
|
|
15
14
|
const api_prisma_1 = require("@hed-hog/api-prisma");
|
|
@@ -26,7 +25,6 @@ exports.ContactUsModule = ContactUsModule = __decorate([
|
|
|
26
25
|
(0, common_1.forwardRef)(() => api_prisma_1.PrismaModule),
|
|
27
26
|
(0, common_1.forwardRef)(() => api_pagination_1.PaginationModule),
|
|
28
27
|
(0, common_1.forwardRef)(() => admin_1.AdminModule),
|
|
29
|
-
(0, common_1.forwardRef)(() => setting_module_1.SettingModule),
|
|
30
28
|
(0, common_1.forwardRef)(() => mail_module_1.MailModule),
|
|
31
29
|
],
|
|
32
30
|
controllers: [contact_us_controller_1.ContactUsController],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-us.module.js","sourceRoot":"","sources":["../src/contact-us.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,0CAA6C;AAC7C,iEAA6D;AAC7D,
|
|
1
|
+
{"version":3,"file":"contact-us.module.js","sourceRoot":"","sources":["../src/contact-us.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,0CAA6C;AAC7C,iEAA6D;AAC7D,oDAAmD;AACnD,4DAA2D;AAC3D,oDAAmD;AACnD,2CAAoD;AACpD,mEAA8D;AAC9D,6DAAwD;AAajD,IAAM,eAAe,GAArB,MAAM,eAAe;CAAG,CAAA;AAAlB,0CAAe;0BAAf,eAAe;IAZ3B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,yBAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,yBAAY,CAAC;YAC9B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,iCAAgB,CAAC;YAClC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,mBAAW,CAAC;YAC7B,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,wBAAU,CAAC;SAC7B;QACD,WAAW,EAAE,CAAC,2CAAmB,CAAC;QAClC,SAAS,EAAE,CAAC,qCAAgB,CAAC;QAC7B,OAAO,EAAE,CAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,qCAAgB,CAAC,CAAC;KAC9C,CAAC;GACW,eAAe,CAAG"}
|
|
@@ -58,7 +58,7 @@ export declare class ContactUsService {
|
|
|
58
58
|
next: number;
|
|
59
59
|
lastPage: number;
|
|
60
60
|
}>;
|
|
61
|
-
deleteContactUsMessage(id: number): Promise<{
|
|
61
|
+
deleteContactUsMessage(id: number, locale?: string): Promise<{
|
|
62
62
|
name: string;
|
|
63
63
|
response: string | null;
|
|
64
64
|
id: number;
|
|
@@ -70,7 +70,7 @@ export declare class ContactUsService {
|
|
|
70
70
|
user_id: number | null;
|
|
71
71
|
response_id: number | null;
|
|
72
72
|
}>;
|
|
73
|
-
updateContactUsMessageStatus(id: number, { status }: ContactUsStatusDTO): Promise<{
|
|
73
|
+
updateContactUsMessageStatus(id: number, { status }: ContactUsStatusDTO, locale?: string): Promise<{
|
|
74
74
|
name: string;
|
|
75
75
|
response: string | null;
|
|
76
76
|
id: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-us.service.d.ts","sourceRoot":"","sources":["../src/contact-us.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"contact-us.service.d.ts","sourceRoot":"","sources":["../src/contact-us.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,EAA0B,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAG5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE,qBACa,gBAAgB;IAGzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAErB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAJP,MAAM,EAAE,aAAa,EAErB,IAAI,EAAE,WAAW,EAEjB,OAAO,EAAE,cAAc;IAGpC,oBAAoB;IAOpB,YAAY;;;;;;;IAmBZ,mBAAmB,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAU9B,oBAAoB,CAAC,gBAAgB,KAAA,EAAE,MAAM,KAAA;cAsHjC,GAAG,EAAE;;;;;;;;IAUjB,sBAAsB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,GAAE,MAAa;;;;;;;;;;;;IAgBxD,4BAA4B,CAChC,EAAE,EAAE,MAAM,EACV,EAAE,MAAM,EAAE,EAAE,kBAAkB,EAC9B,MAAM,GAAE,MAAa;;;;;;;;;;;;IAsBjB,yBAAyB,CAC7B,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,MAAM,EACV,EAAE,QAAQ,EAAE,EAAE,oBAAoB,EAClC,IAAI,KAAA;IAmCA,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,gBAAgB;;;;;;;;;;;;CA2CxF"}
|
|
@@ -14,6 +14,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.ContactUsService = void 0;
|
|
16
16
|
const admin_1 = require("@hed-hog/admin");
|
|
17
|
+
const api_locale_1 = require("@hed-hog/api-locale");
|
|
17
18
|
const api_prisma_1 = require("@hed-hog/api-prisma");
|
|
18
19
|
const common_1 = require("@nestjs/common");
|
|
19
20
|
const date_fns_1 = require("date-fns");
|
|
@@ -32,7 +33,7 @@ let ContactUsService = class ContactUsService {
|
|
|
32
33
|
async getUserStats() {
|
|
33
34
|
const statuses = ['new', 'answered', 'progress', 'archived'];
|
|
34
35
|
const counts = await Promise.all(statuses.map((status) => this.prisma.contact_us.count({
|
|
35
|
-
where: { status },
|
|
36
|
+
where: { status: status },
|
|
36
37
|
})));
|
|
37
38
|
return {
|
|
38
39
|
total: await this.prisma.contact_us.count({}),
|
|
@@ -174,23 +175,23 @@ let ContactUsService = class ContactUsService {
|
|
|
174
175
|
lastPage,
|
|
175
176
|
};
|
|
176
177
|
}
|
|
177
|
-
async deleteContactUsMessage(id) {
|
|
178
|
+
async deleteContactUsMessage(id, locale = 'en') {
|
|
178
179
|
const message = await this.prisma.contact_us.findUnique({
|
|
179
180
|
where: { id: Number(id) },
|
|
180
181
|
});
|
|
181
182
|
if (!message) {
|
|
182
|
-
throw new common_1.NotFoundException('Contact Us message not found');
|
|
183
|
+
throw new common_1.NotFoundException((0, api_locale_1.getLocaleText)('contactUsNotFound', locale, 'Contact Us message not found'));
|
|
183
184
|
}
|
|
184
185
|
return this.prisma.contact_us.delete({
|
|
185
186
|
where: { id: Number(id) },
|
|
186
187
|
});
|
|
187
188
|
}
|
|
188
|
-
async updateContactUsMessageStatus(id, { status }) {
|
|
189
|
+
async updateContactUsMessageStatus(id, { status }, locale = 'en') {
|
|
189
190
|
const message = await this.prisma.contact_us.findUnique({
|
|
190
191
|
where: { id: Number(id) },
|
|
191
192
|
});
|
|
192
193
|
if (!message) {
|
|
193
|
-
throw new common_1.NotFoundException('Contact Us message not found');
|
|
194
|
+
throw new common_1.NotFoundException((0, api_locale_1.getLocaleText)('contactUsNotFound', locale, 'Contact Us message not found'));
|
|
194
195
|
}
|
|
195
196
|
if (status === 'all') {
|
|
196
197
|
status = 'new';
|
|
@@ -205,7 +206,7 @@ let ContactUsService = class ContactUsService {
|
|
|
205
206
|
where: { id: Number(id) },
|
|
206
207
|
});
|
|
207
208
|
if (!message) {
|
|
208
|
-
throw new common_1.NotFoundException('Contact Us message not found');
|
|
209
|
+
throw new common_1.NotFoundException((0, api_locale_1.getLocaleText)('contactUsNotFound', locale, 'Contact Us message not found'));
|
|
209
210
|
}
|
|
210
211
|
await this.prisma.contact_us.update({
|
|
211
212
|
where: { id: Number(id) },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-us.service.js","sourceRoot":"","sources":["../src/contact-us.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0CAA6D;AAC7D,oDAAoD;AACpD,2CAAmF;AACnF,uCAAkC;AAM3B,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAC3B,YAEmB,MAAqB,EAErB,IAAiB,EAEjB,OAAuB;QAJvB,WAAM,GAAN,MAAM,CAAe;QAErB,SAAI,GAAJ,IAAI,CAAa;QAEjB,YAAO,GAAP,OAAO,CAAgB;IACvC,CAAC;IAEJ,KAAK,CAAC,oBAAoB;QACxB,OAAO,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC;YACnC,kBAAkB;YAClB,kBAAkB;SACnB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,MAAM,QAAQ,GAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;QAClE,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAC9B,QAAQ,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACtB,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC;YAC3B,KAAK,EAAE,EAAE,MAAM,EAAE;
|
|
1
|
+
{"version":3,"file":"contact-us.service.js","sourceRoot":"","sources":["../src/contact-us.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0CAA6D;AAC7D,oDAAoD;AACpD,oDAA4E;AAC5E,2CAAmF;AACnF,uCAAkC;AAM3B,IAAM,gBAAgB,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AAM,EAAC,SAAS,CAAC,UAAU,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;aAChE;SACF,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC;IACnB,CAAC;CACF,CAAA;AAzSY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,0BAAa,CAAC,CAAC,CAAA;IAEvC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,mBAAW,CAAC,CAAC,CAAA;IAErC,WAAA,IAAA,eAAM,EAAC,IAAA,mBAAU,EAAC,GAAG,EAAE,CAAC,sBAAc,CAAC,CAAC,CAAA;qCAHhB,0BAAa;QAEf,mBAAW;QAER,sBAAc;GAP/B,gBAAgB,CAyS5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-us-response.dto.d.ts","sourceRoot":"","sources":["../../src/dto/contact-us-response.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contact-us-response.dto.d.ts","sourceRoot":"","sources":["../../src/dto/contact-us-response.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,oBAAoB;IAK/B,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -10,12 +10,15 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ContactUsResponseDTO = void 0;
|
|
13
|
+
const api_locale_1 = require("@hed-hog/api-locale");
|
|
13
14
|
const class_validator_1 = require("class-validator");
|
|
14
15
|
class ContactUsResponseDTO {
|
|
15
16
|
}
|
|
16
17
|
exports.ContactUsResponseDTO = ContactUsResponseDTO;
|
|
17
18
|
__decorate([
|
|
18
|
-
(0, class_validator_1.IsString)(
|
|
19
|
+
(0, class_validator_1.IsString)({
|
|
20
|
+
message: (args) => (0, api_locale_1.getLocaleText)('validation.responseMustBeString', args.value),
|
|
21
|
+
}),
|
|
19
22
|
__metadata("design:type", String)
|
|
20
23
|
], ContactUsResponseDTO.prototype, "response", void 0);
|
|
21
24
|
//# sourceMappingURL=contact-us-response.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-us-response.dto.js","sourceRoot":"","sources":["../../src/dto/contact-us-response.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA2C;AAE3C,MAAa,oBAAoB;
|
|
1
|
+
{"version":3,"file":"contact-us-response.dto.js","sourceRoot":"","sources":["../../src/dto/contact-us-response.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAoD;AACpD,qDAA2C;AAE3C,MAAa,oBAAoB;CAMhC;AAND,oDAMC;AADC;IAJC,IAAA,0BAAQ,EAAC;QACR,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAChB,IAAA,0BAAa,EAAC,iCAAiC,EAAE,IAAI,CAAC,KAAK,CAAC;KAC/D,CAAC;;sDACe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-us-send.dto.d.ts","sourceRoot":"","sources":["../../src/dto/contact-us-send.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contact-us-send.dto.d.ts","sourceRoot":"","sources":["../../src/dto/contact-us-send.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,gBAAgB;IAK3B,IAAI,EAAE,MAAM,CAAC;IASb,KAAK,EAAE,MAAM,CAAC;IAMd,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -10,20 +10,27 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ContactUsSendDTO = void 0;
|
|
13
|
+
const api_locale_1 = require("@hed-hog/api-locale");
|
|
13
14
|
const class_validator_1 = require("class-validator");
|
|
14
15
|
class ContactUsSendDTO {
|
|
15
16
|
}
|
|
16
17
|
exports.ContactUsSendDTO = ContactUsSendDTO;
|
|
17
18
|
__decorate([
|
|
18
|
-
(0, class_validator_1.IsString)(
|
|
19
|
+
(0, class_validator_1.IsString)({
|
|
20
|
+
message: (args) => (0, api_locale_1.getLocaleText)('validation.nameMustBeString', args.value),
|
|
21
|
+
}),
|
|
19
22
|
__metadata("design:type", String)
|
|
20
23
|
], ContactUsSendDTO.prototype, "name", void 0);
|
|
21
24
|
__decorate([
|
|
22
|
-
(0, class_validator_1.IsEmail)(
|
|
25
|
+
(0, class_validator_1.IsEmail)({}, {
|
|
26
|
+
message: (args) => (0, api_locale_1.getLocaleText)('validation.emailMustBeValid', args.value),
|
|
27
|
+
}),
|
|
23
28
|
__metadata("design:type", String)
|
|
24
29
|
], ContactUsSendDTO.prototype, "email", void 0);
|
|
25
30
|
__decorate([
|
|
26
|
-
(0, class_validator_1.IsString)(
|
|
31
|
+
(0, class_validator_1.IsString)({
|
|
32
|
+
message: (args) => (0, api_locale_1.getLocaleText)('validation.messageMustBeString', args.value),
|
|
33
|
+
}),
|
|
27
34
|
__metadata("design:type", String)
|
|
28
35
|
], ContactUsSendDTO.prototype, "message", void 0);
|
|
29
36
|
//# sourceMappingURL=contact-us-send.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-us-send.dto.js","sourceRoot":"","sources":["../../src/dto/contact-us-send.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAoD;AAEpD,MAAa,gBAAgB;
|
|
1
|
+
{"version":3,"file":"contact-us-send.dto.js","sourceRoot":"","sources":["../../src/dto/contact-us-send.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAoD;AACpD,qDAAoD;AAEpD,MAAa,gBAAgB;CAqB5B;AArBD,4CAqBC;AAhBC;IAJC,IAAA,0BAAQ,EAAC;QACR,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAChB,IAAA,0BAAa,EAAC,6BAA6B,EAAE,IAAI,CAAC,KAAK,CAAC;KAC3D,CAAC;;8CACW;AASb;IAPC,IAAA,yBAAO,EACN,EAAE,EACF;QACE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAChB,IAAA,0BAAa,EAAC,6BAA6B,EAAE,IAAI,CAAC,KAAK,CAAC;KAC3D,CACF;;+CACa;AAMd;IAJC,IAAA,0BAAQ,EAAC;QACR,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAChB,IAAA,0BAAa,EAAC,gCAAgC,EAAE,IAAI,CAAC,KAAK,CAAC;KAC9D,CAAC;;iDACc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-us-status.dto.d.ts","sourceRoot":"","sources":["../../src/dto/contact-us-status.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contact-us-status.dto.d.ts","sourceRoot":"","sources":["../../src/dto/contact-us-status.dto.ts"],"names":[],"mappings":"AAGA,KAAK,MAAM,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,KAAK,CAAC;AAEnE,qBAAa,kBAAkB;IAa7B,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -10,6 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ContactUsStatusDTO = void 0;
|
|
13
|
+
const api_locale_1 = require("@hed-hog/api-locale");
|
|
13
14
|
const class_transformer_1 = require("class-transformer");
|
|
14
15
|
class ContactUsStatusDTO {
|
|
15
16
|
}
|
|
@@ -20,7 +21,7 @@ __decorate([
|
|
|
20
21
|
return value;
|
|
21
22
|
}
|
|
22
23
|
else {
|
|
23
|
-
throw new Error(`Invalid status: ${value}`);
|
|
24
|
+
throw new Error((0, api_locale_1.getLocaleText)('invalidStatus', 'en', `Invalid status: ${value}`).replace('{{status}}', value));
|
|
24
25
|
}
|
|
25
26
|
}),
|
|
26
27
|
__metadata("design:type", String)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-us-status.dto.js","sourceRoot":"","sources":["../../src/dto/contact-us-status.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA8C;AAI9C,MAAa,kBAAkB;
|
|
1
|
+
{"version":3,"file":"contact-us-status.dto.js","sourceRoot":"","sources":["../../src/dto/contact-us-status.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAoD;AACpD,yDAA8C;AAI9C,MAAa,kBAAkB;CAc9B;AAdD,gDAcC;AADC;IAZC,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;QACvB,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAChE,OAAO,KAAK,CAAC;QACf,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CACb,IAAA,0BAAa,EAAC,eAAe,EAAE,IAAI,EAAE,mBAAmB,KAAK,EAAE,CAAC,CAAC,OAAO,CACtE,YAAY,EACZ,KAAK,CACN,CACF,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;;kDACa"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hed-hog/contact-us",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"dependencies": {
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
"@nestjs/core": "^11",
|
|
10
10
|
"@nestjs/jwt": "^11",
|
|
11
11
|
"@nestjs/mapped-types": "*",
|
|
12
|
-
"@hed-hog/admin": "0.0.132",
|
|
13
|
-
"@hed-hog/api-pagination": "0.0.3",
|
|
14
12
|
"@hed-hog/api-locale": "0.0.10",
|
|
13
|
+
"@hed-hog/admin": "0.0.134",
|
|
14
|
+
"@hed-hog/api-pagination": "0.0.3",
|
|
15
15
|
"@hed-hog/api-prisma": "0.0.4",
|
|
16
16
|
"@hed-hog/api": "0.0.3"
|
|
17
17
|
},
|
|
@@ -35,16 +35,20 @@ export class ContactUsController {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
@Delete(':id')
|
|
38
|
-
async deleteContactUsMessage(
|
|
39
|
-
|
|
38
|
+
async deleteContactUsMessage(
|
|
39
|
+
@Param('id', ParseIntPipe) id: number,
|
|
40
|
+
@Locale() locale: string,
|
|
41
|
+
) {
|
|
42
|
+
return this.contactUsService.deleteContactUsMessage(id, locale);
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
@Patch('status/:id')
|
|
43
46
|
async updateContactUsMessageStatus(
|
|
44
47
|
@Param('id', ParseIntPipe) id: number,
|
|
45
48
|
@Body() { status }: ContactUsStatusDTO,
|
|
49
|
+
@Locale() locale: string,
|
|
46
50
|
) {
|
|
47
|
-
return this.contactUsService.updateContactUsMessageStatus(id, { status });
|
|
51
|
+
return this.contactUsService.updateContactUsMessageStatus(id, { status }, locale);
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
@Post('response/:id')
|
package/src/contact-us.module.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AdminModule } from '@hed-hog/admin';
|
|
2
2
|
import { MailModule } from '@hed-hog/admin/mail/mail.module';
|
|
3
|
-
import { SettingModule } from '@hed-hog/admin/setting/setting.module';
|
|
4
3
|
import { LocaleModule } from '@hed-hog/api-locale';
|
|
5
4
|
import { PaginationModule } from '@hed-hog/api-pagination';
|
|
6
5
|
import { PrismaModule } from '@hed-hog/api-prisma';
|
|
@@ -13,7 +12,6 @@ import { ContactUsService } from './contact-us.service';
|
|
|
13
12
|
forwardRef(() => PrismaModule),
|
|
14
13
|
forwardRef(() => PaginationModule),
|
|
15
14
|
forwardRef(() => AdminModule),
|
|
16
|
-
forwardRef(() => SettingModule),
|
|
17
15
|
forwardRef(() => MailModule),
|
|
18
16
|
],
|
|
19
17
|
controllers: [ContactUsController],
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MailService, SettingService } from '@hed-hog/admin';
|
|
2
|
-
import {
|
|
2
|
+
import { getLocaleText } from '@hed-hog/api-locale';
|
|
3
|
+
import { contact_us_status_enum, PrismaService } from '@hed-hog/api-prisma';
|
|
3
4
|
import { forwardRef, Inject, Injectable, NotFoundException } from '@nestjs/common';
|
|
4
5
|
import { format } from 'date-fns';
|
|
5
6
|
import { ContactUsResponseDTO } from './dto/contact-us-response.dto';
|
|
@@ -29,7 +30,7 @@ export class ContactUsService {
|
|
|
29
30
|
const counts = await Promise.all(
|
|
30
31
|
statuses.map((status) =>
|
|
31
32
|
this.prisma.contact_us.count({
|
|
32
|
-
where: { status },
|
|
33
|
+
where: { status: status as contact_us_status_enum },
|
|
33
34
|
}),
|
|
34
35
|
),
|
|
35
36
|
);
|
|
@@ -181,13 +182,15 @@ export class ContactUsService {
|
|
|
181
182
|
};
|
|
182
183
|
}
|
|
183
184
|
|
|
184
|
-
async deleteContactUsMessage(id: number) {
|
|
185
|
+
async deleteContactUsMessage(id: number, locale: string = 'en') {
|
|
185
186
|
const message = await this.prisma.contact_us.findUnique({
|
|
186
187
|
where: { id: Number(id) },
|
|
187
188
|
});
|
|
188
189
|
|
|
189
190
|
if (!message) {
|
|
190
|
-
throw new NotFoundException(
|
|
191
|
+
throw new NotFoundException(
|
|
192
|
+
getLocaleText('contactUsNotFound', locale, 'Contact Us message not found'),
|
|
193
|
+
);
|
|
191
194
|
}
|
|
192
195
|
|
|
193
196
|
return this.prisma.contact_us.delete({
|
|
@@ -195,13 +198,19 @@ export class ContactUsService {
|
|
|
195
198
|
});
|
|
196
199
|
}
|
|
197
200
|
|
|
198
|
-
async updateContactUsMessageStatus(
|
|
201
|
+
async updateContactUsMessageStatus(
|
|
202
|
+
id: number,
|
|
203
|
+
{ status }: ContactUsStatusDTO,
|
|
204
|
+
locale: string = 'en',
|
|
205
|
+
) {
|
|
199
206
|
const message = await this.prisma.contact_us.findUnique({
|
|
200
207
|
where: { id: Number(id) },
|
|
201
208
|
});
|
|
202
209
|
|
|
203
210
|
if (!message) {
|
|
204
|
-
throw new NotFoundException(
|
|
211
|
+
throw new NotFoundException(
|
|
212
|
+
getLocaleText('contactUsNotFound', locale, 'Contact Us message not found'),
|
|
213
|
+
);
|
|
205
214
|
}
|
|
206
215
|
|
|
207
216
|
if (status === 'all') {
|
|
@@ -214,13 +223,20 @@ export class ContactUsService {
|
|
|
214
223
|
});
|
|
215
224
|
}
|
|
216
225
|
|
|
217
|
-
async respondToContactUsMessage(
|
|
226
|
+
async respondToContactUsMessage(
|
|
227
|
+
locale: string,
|
|
228
|
+
id: number,
|
|
229
|
+
{ response }: ContactUsResponseDTO,
|
|
230
|
+
user,
|
|
231
|
+
) {
|
|
218
232
|
const message = await this.prisma.contact_us.findUnique({
|
|
219
233
|
where: { id: Number(id) },
|
|
220
234
|
});
|
|
221
235
|
|
|
222
236
|
if (!message) {
|
|
223
|
-
throw new NotFoundException(
|
|
237
|
+
throw new NotFoundException(
|
|
238
|
+
getLocaleText('contactUsNotFound', locale, 'Contact Us message not found'),
|
|
239
|
+
);
|
|
224
240
|
}
|
|
225
241
|
|
|
226
242
|
await this.prisma.contact_us.update({
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { getLocaleText } from '@hed-hog/api-locale';
|
|
1
2
|
import { IsString } from 'class-validator';
|
|
2
3
|
|
|
3
4
|
export class ContactUsResponseDTO {
|
|
4
|
-
@IsString(
|
|
5
|
+
@IsString({
|
|
6
|
+
message: (args) =>
|
|
7
|
+
getLocaleText('validation.responseMustBeString', args.value),
|
|
8
|
+
})
|
|
5
9
|
response: string;
|
|
6
10
|
}
|
|
@@ -1,12 +1,25 @@
|
|
|
1
|
+
import { getLocaleText } from '@hed-hog/api-locale';
|
|
1
2
|
import { IsEmail, IsString } from 'class-validator';
|
|
2
3
|
|
|
3
4
|
export class ContactUsSendDTO {
|
|
4
|
-
@IsString(
|
|
5
|
+
@IsString({
|
|
6
|
+
message: (args) =>
|
|
7
|
+
getLocaleText('validation.nameMustBeString', args.value),
|
|
8
|
+
})
|
|
5
9
|
name: string;
|
|
6
10
|
|
|
7
|
-
@IsEmail(
|
|
11
|
+
@IsEmail(
|
|
12
|
+
{},
|
|
13
|
+
{
|
|
14
|
+
message: (args) =>
|
|
15
|
+
getLocaleText('validation.emailMustBeValid', args.value),
|
|
16
|
+
},
|
|
17
|
+
)
|
|
8
18
|
email: string;
|
|
9
19
|
|
|
10
|
-
@IsString(
|
|
20
|
+
@IsString({
|
|
21
|
+
message: (args) =>
|
|
22
|
+
getLocaleText('validation.messageMustBeString', args.value),
|
|
23
|
+
})
|
|
11
24
|
message: string;
|
|
12
25
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getLocaleText } from '@hed-hog/api-locale';
|
|
1
2
|
import { Transform } from 'class-transformer';
|
|
2
3
|
|
|
3
4
|
type Status = 'new' | 'progress' | 'answered' | 'archived' | 'all';
|
|
@@ -7,7 +8,12 @@ export class ContactUsStatusDTO {
|
|
|
7
8
|
if (['new', 'progress', 'answered', 'archived'].includes(value)) {
|
|
8
9
|
return value;
|
|
9
10
|
} else {
|
|
10
|
-
throw new Error(
|
|
11
|
+
throw new Error(
|
|
12
|
+
getLocaleText('invalidStatus', 'en', `Invalid status: ${value}`).replace(
|
|
13
|
+
'{{status}}',
|
|
14
|
+
value,
|
|
15
|
+
),
|
|
16
|
+
);
|
|
11
17
|
}
|
|
12
18
|
})
|
|
13
19
|
status: Status;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"contactUsNotFound": "Contact Us message not found",
|
|
3
|
+
"invalidStatus": "Invalid status: {{status}}",
|
|
4
|
+
"validation": {
|
|
5
|
+
"nameMustBeString": "Name must be a string",
|
|
6
|
+
"emailMustBeValid": "Email must be valid",
|
|
7
|
+
"messageMustBeString": "Message must be a string",
|
|
8
|
+
"responseMustBeString": "Response must be a string"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"contactUsNotFound": "Mensagem de Fale Conosco não encontrada",
|
|
3
|
+
"invalidStatus": "Status inválido: {{status}}",
|
|
4
|
+
"validation": {
|
|
5
|
+
"nameMustBeString": "Nome deve ser uma string",
|
|
6
|
+
"emailMustBeValid": "Email deve ser válido",
|
|
7
|
+
"messageMustBeString": "Mensagem deve ser uma string",
|
|
8
|
+
"responseMustBeString": "Resposta deve ser uma string"
|
|
9
|
+
}
|
|
10
|
+
}
|