Loading packages/core/src/graphql/products/promotions/promotion.resolver.ts +18 −0 Original line number Diff line number Diff line Loading @@ -18,4 +18,22 @@ export class PromotionResolver { ) { return this._promotionService.createPromotion(createInput); } @Mutation() async removePromotion(_, { id }: { id: string }): Promise<void> { await this._promotionService.throwIfNotExists(id); return this._promotionService.remove(id); } @Mutation() async removePromotionsByIds(_, { ids }: { ids: string[] }): Promise<void> { const promotions = await this._promotionService.find({ _id: { $in: ids }, isDeleted: { $eq: false }, }); const promotionsIds = promotions.map((p) => p.id); return this._promotionService.removeMultipleByIds(promotionsIds); } } packages/core/src/graphql/products/promotions/promotion.types.graphql +2 −0 Original line number Diff line number Diff line Loading @@ -41,4 +41,6 @@ type Query { type Mutation { createPromotion(createInput: PromotionCreateInput): Promotion removePromotion(id: String!): Void removePromotionsByIds(ids: [String!]!): Remove } packages/core/src/services/products/PromotionService.ts +9 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ import Promotion from '@modules/server.common/entities/Promotion'; import { createEverLogger } from '../../helpers/Log'; import Logger from 'bunyan'; import { IPromotionCreateObject } from '@ever-platform/common/src/interfaces/IPromotion'; import { first } from 'rxjs/operators'; @injectable() @routerName('promotion') Loading Loading @@ -40,4 +41,12 @@ export class PromotionService extends DBService<Promotion> implements IService { isDeleted: { $eq: false }, }); } async throwIfNotExists(promotionId: string) { const promotion = await this.get(promotionId).pipe(first()).toPromise(); if (!promotion || promotion.isDeleted) { throw Error(`Prmotion with id '${promotionId}' does not exist!`); } } } packages/merchant-tablet-ionic/src/assets/i18n/bg-BG.json +15 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,21 @@ } } }, "PROMOTIONS": { "PROMOTIONS": "Промоции", "BASIC_INFO": "Основна информация", "TITLE": "Заглавие", "ACTIVE_FROM": "Активна от", "ACTIVE_TO": "Активна до", "PURCHASES_COUNT": "Брой покупки", "IS_ACTIVE": "Активна", "SELECT_DATE": "Изберете дата", "DESCRIPTION": "Описание", "SAVE": "Запази", "NEXT": "Нататък", "BACK": "Обратно", "LANGUAGE": "Език" }, "SELECT LANGUAGE": { "USA": "САЩ", "ISRAEL": "Израел", Loading packages/merchant-tablet-ionic/src/assets/i18n/bg.json +15 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,21 @@ } } }, "PROMOTIONS": { "PROMOTIONS": "Промоции", "BASIC_INFO": "Основна информация", "TITLE": "Заглавие", "ACTIVE_FROM": "Активна от", "ACTIVE_TO": "Активна до", "PURCHASES_COUNT": "Брой покупки", "IS_ACTIVE": "Активна", "SELECT_DATE": "Изберете дата", "DESCRIPTION": "Описание", "SAVE": "Запази", "NEXT": "Нататък", "BACK": "Обратно", "LANGUAGE": "Език" }, "SELECT LANGUAGE": { "USA": "САЩ", "ISRAEL": "Израел", Loading Loading
packages/core/src/graphql/products/promotions/promotion.resolver.ts +18 −0 Original line number Diff line number Diff line Loading @@ -18,4 +18,22 @@ export class PromotionResolver { ) { return this._promotionService.createPromotion(createInput); } @Mutation() async removePromotion(_, { id }: { id: string }): Promise<void> { await this._promotionService.throwIfNotExists(id); return this._promotionService.remove(id); } @Mutation() async removePromotionsByIds(_, { ids }: { ids: string[] }): Promise<void> { const promotions = await this._promotionService.find({ _id: { $in: ids }, isDeleted: { $eq: false }, }); const promotionsIds = promotions.map((p) => p.id); return this._promotionService.removeMultipleByIds(promotionsIds); } }
packages/core/src/graphql/products/promotions/promotion.types.graphql +2 −0 Original line number Diff line number Diff line Loading @@ -41,4 +41,6 @@ type Query { type Mutation { createPromotion(createInput: PromotionCreateInput): Promotion removePromotion(id: String!): Void removePromotionsByIds(ids: [String!]!): Remove }
packages/core/src/services/products/PromotionService.ts +9 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ import Promotion from '@modules/server.common/entities/Promotion'; import { createEverLogger } from '../../helpers/Log'; import Logger from 'bunyan'; import { IPromotionCreateObject } from '@ever-platform/common/src/interfaces/IPromotion'; import { first } from 'rxjs/operators'; @injectable() @routerName('promotion') Loading Loading @@ -40,4 +41,12 @@ export class PromotionService extends DBService<Promotion> implements IService { isDeleted: { $eq: false }, }); } async throwIfNotExists(promotionId: string) { const promotion = await this.get(promotionId).pipe(first()).toPromise(); if (!promotion || promotion.isDeleted) { throw Error(`Prmotion with id '${promotionId}' does not exist!`); } } }
packages/merchant-tablet-ionic/src/assets/i18n/bg-BG.json +15 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,21 @@ } } }, "PROMOTIONS": { "PROMOTIONS": "Промоции", "BASIC_INFO": "Основна информация", "TITLE": "Заглавие", "ACTIVE_FROM": "Активна от", "ACTIVE_TO": "Активна до", "PURCHASES_COUNT": "Брой покупки", "IS_ACTIVE": "Активна", "SELECT_DATE": "Изберете дата", "DESCRIPTION": "Описание", "SAVE": "Запази", "NEXT": "Нататък", "BACK": "Обратно", "LANGUAGE": "Език" }, "SELECT LANGUAGE": { "USA": "САЩ", "ISRAEL": "Израел", Loading
packages/merchant-tablet-ionic/src/assets/i18n/bg.json +15 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,21 @@ } } }, "PROMOTIONS": { "PROMOTIONS": "Промоции", "BASIC_INFO": "Основна информация", "TITLE": "Заглавие", "ACTIVE_FROM": "Активна от", "ACTIVE_TO": "Активна до", "PURCHASES_COUNT": "Брой покупки", "IS_ACTIVE": "Активна", "SELECT_DATE": "Изберете дата", "DESCRIPTION": "Описание", "SAVE": "Запази", "NEXT": "Нататък", "BACK": "Обратно", "LANGUAGE": "Език" }, "SELECT LANGUAGE": { "USA": "САЩ", "ISRAEL": "Израел", Loading