This commit is contained in:
2026-02-14 16:17:20 +03:30
parent eb4d19ab81
commit 7bf7d0b1c3
18 changed files with 135 additions and 88 deletions
+5 -5
View File
@@ -46,7 +46,7 @@ export class ShopService {
const validateSubscriptionId = await em.findOne(Shop, { subscriptionId: dto.subscriptionId })
if (validateSubscriptionId) {
throw new BadRequestException("Duplicate subscriptionId: " + dto.subscriptionId)
throw new BadRequestException(RestMessage.DUPLICATE_SUBSCRIPTION_ID);
}
// Create shop
@@ -64,7 +64,7 @@ export class ShopService {
const role = await em.findOne(Role, { isSystem: true });
if (!role) {
throw new BadRequestException(`System role not found`);
throw new BadRequestException(RestMessage.SYSTEM_ROLE_NOT_FOUND);
}
const normalizedPhone = normalizePhone(dto.phone);
@@ -116,7 +116,7 @@ export class ShopService {
const shop = await this.em.findOne(Shop, { slug });
if (!shop) {
throw new NotFoundException(`Shop with slug "${slug}" not found`);
throw new NotFoundException(RestMessage.NOT_FOUND);
}
return shop;
@@ -235,7 +235,7 @@ export class ShopService {
async findOrFail(shopId: string) {
const shop = await this.shopRepository.findOne({ id: shopId }, { populate: ['deliveries'] })
if (!shop) {
throw new BadRequestException("Shop not found")
throw new BadRequestException(RestMessage.NOT_FOUND);
}
return shop
}
@@ -243,7 +243,7 @@ export class ShopService {
async findOrFailBySlug(shopSlug: string) {
const shop = await this.shopRepository.findOne({ slug: shopSlug }, { populate: ['deliveries'] })
if (!shop) {
throw new BadRequestException("Shop not found")
throw new BadRequestException(RestMessage.NOT_FOUND);
}
return shop
}