chore: complete payment service but not tested

This commit is contained in:
mahyargdz
2025-02-04 09:15:22 +03:30
parent 31368610dd
commit 5d91afcc6e
22 changed files with 313 additions and 77 deletions
@@ -1,7 +1,7 @@
export enum NotifSettingsEnum {
ANNOUNCE_NOTIF = "ANNOUNCE_NOTIF",
BILL_PAYMENT = "BILL_PAYMENT",
CREATE_SERIVCE = "CREATE_SERIVCE",
CREATE_SERVICE = "CREATE_SERVICE",
UNBLOCKING_SERVICE = "UNBLOCKING_SERVICE",
ANSWER_TICKET = "ANSWER_TICKET",
CREATE_INVOICE = "CREATE_INVOICE",
@@ -13,7 +13,7 @@ export enum NotifSettingsEnum {
export enum FarsiNotifSettingsEnum {
ANNOUNCE_NOTIF = "اعلانات و اطلاعیه ها",
BILL_PAYMENT = "پرداخت صورت حساب",
CREATE_SERIVCE = "ایجاد سرویس",
CREATE_SERVICE = "ایجاد سرویس",
UNBLOCKING_SERVICE = "رفع انسداد سرویس",
ANSWER_TICKET = "پاسخ تیکت",
CREATE_INVOICE = "ایجاد صورت حساب",
+1 -1
View File
@@ -44,7 +44,7 @@ export const userSettings = [
},
},
{
title: NotifSettingsEnum.CREATE_SERIVCE,
title: NotifSettingsEnum.CREATE_SERVICE,
fields: {
sms: true,
email: false,
@@ -12,31 +12,31 @@ import { UserSettingsRepository } from "../repositories/user-settings.repository
@Injectable()
export class UserSettingsService {
constructor(private readonly userSettingsRepository: UserSettingsRepository) {}
//*+*******************************************
async createUserSettings(userId: string, queryRunner: QueryRunner) {
const user = await queryRunner.manager.findOneBy(User, {
id: userId,
});
if (!user) throw new BadRequestException(UserMessage.USER_NOT_FOUND);
for (const setting of userSettings) {
const notifSetting = await queryRunner.manager.findOneBy(NotifSetting, {
title: setting.title,
});
console.log({ notifSetting });
if (!notifSetting) throw new BadRequestException(SettingMessageEnum.NOTIF_NOT_FOUND);
const userSetting = queryRunner.manager.create(UserSetting, {
...setting,
notifSetting,
user,
});
console.log({ userSetting });
await queryRunner.manager.save(userSetting);
}
return {
message: CommonMessage.CREATED,
};
}
//*+*******************************************
async getSettings(userId: string) {
const settings = await this.userSettingsRepository.find({
where: {
@@ -51,6 +51,7 @@ export class UserSettingsService {
});
return { settings };
}
//*+*******************************************
async updateUserSetting(settingId: string, updateDto: UpdateUserSettingsDto) {
const setting = await this.userSettingsRepository.findOne({