feat(SPG-760) Validasi Bundling dan Item active inactive
parent
cc01b23e2a
commit
239e2d778a
|
@ -36,7 +36,12 @@ export class ActiveItemManager extends BaseUpdateStatusManager<ItemEntity> {
|
|||
{
|
||||
relation: 'tenant',
|
||||
singleQuery: ['status', '!=', STATUS.ACTIVE],
|
||||
message: `Gagal! Belum ada item yang aktif`,
|
||||
message: `Gagal! tenant tidak aktif`,
|
||||
},
|
||||
{
|
||||
relation: 'bundling_items',
|
||||
singleQuery: ['status', '!=', STATUS.ACTIVE],
|
||||
message: `Gagal! Terdapat item yang belum aktif`,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
|
@ -7,11 +7,7 @@ import {
|
|||
import { ItemModel } from '../../../data/models/item.model';
|
||||
import { ItemChangeStatusEvent } from '../../entities/event/item-change-status.event';
|
||||
import { BatchResult } from 'src/core/response/domain/ok-response.interface';
|
||||
import {
|
||||
HttpStatus,
|
||||
Injectable,
|
||||
UnprocessableEntityException,
|
||||
} from '@nestjs/common';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { STATUS } from 'src/core/strings/constants/base.constants';
|
||||
|
||||
@Injectable()
|
||||
|
@ -33,7 +29,12 @@ export class BatchActiveItemManager extends BaseBatchUpdateStatusManager<ItemEnt
|
|||
{
|
||||
relation: 'tenant',
|
||||
singleQuery: ['status', '!=', STATUS.ACTIVE],
|
||||
message: `Gagal! Belum ada item yang aktif`,
|
||||
message: `Gagal! tenant tidak aktif`,
|
||||
},
|
||||
{
|
||||
relation: 'bundling_items',
|
||||
singleQuery: ['status', '!=', STATUS.ACTIVE],
|
||||
message: `Gagal! Terdapat item yang belum aktif`,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
|
@ -29,7 +29,12 @@ export class BatchConfirmItemManager extends BaseBatchUpdateStatusManager<ItemEn
|
|||
{
|
||||
relation: 'tenant',
|
||||
singleQuery: ['status', '!=', STATUS.ACTIVE],
|
||||
message: `Gagal! Belum ada item yang aktif`,
|
||||
message: `Gagal! tenant tidak aktif`,
|
||||
},
|
||||
{
|
||||
relation: 'bundling_items',
|
||||
singleQuery: ['status', '!=', STATUS.ACTIVE],
|
||||
message: `Gagal! Terdapat item yang belum aktif`,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
|
@ -32,7 +32,12 @@ export class ConfirmItemManager extends BaseUpdateStatusManager<ItemEntity> {
|
|||
{
|
||||
relation: 'tenant',
|
||||
singleQuery: ['status', '!=', STATUS.ACTIVE],
|
||||
message: `Gagal! Belum ada item yang aktif`,
|
||||
message: `Gagal! tenant tidak aktif`,
|
||||
},
|
||||
{
|
||||
relation: 'bundling_items',
|
||||
singleQuery: ['status', '!=', STATUS.ACTIVE],
|
||||
message: `Gagal! Terdapat item yang belum aktif`,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
import { HttpStatus, UnprocessableEntityException } from '@nestjs/common';
|
||||
import { STATUS } from 'src/core/strings/constants/base.constants';
|
||||
import { In } from 'typeorm';
|
||||
|
||||
export async function validateRelation(dataService, id) {
|
||||
const haveRelation = await dataService.getOneByOptions({
|
||||
where: {
|
||||
status: In([STATUS.ACTIVE]),
|
||||
bundling_items: {
|
||||
id: id,
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue