mirror of
https://github.com/hexastack/hexabot
synced 2025-01-22 10:35:37 +00:00
feat: implement dynamic create DTO for Menu
This commit is contained in:
parent
635687536b
commit
43c56ab2dd
@ -16,6 +16,7 @@ import {
|
||||
ValidateIf,
|
||||
} from 'class-validator';
|
||||
|
||||
import { DtoConfig } from '@/utils/types/dto.types';
|
||||
import { IsObjectId } from '@/utils/validation-rules/is-object-id';
|
||||
|
||||
import { MenuType } from '../schemas/types/menu';
|
||||
@ -53,3 +54,7 @@ export class MenuCreateDto {
|
||||
}
|
||||
|
||||
export class MenuQueryDto extends PartialType(MenuCreateDto) {}
|
||||
|
||||
export type MenuDTOMapActions = DtoConfig<{
|
||||
create: MenuCreateDto;
|
||||
}>;
|
||||
|
@ -13,6 +13,7 @@ import { Model } from 'mongoose';
|
||||
|
||||
import { BaseRepository } from '@/utils/generics/base-repository';
|
||||
|
||||
import { MenuDTOMapActions } from '../dto/menu.dto';
|
||||
import {
|
||||
Menu,
|
||||
MENU_POPULATE,
|
||||
@ -26,7 +27,8 @@ import { MenuType } from '../schemas/types/menu';
|
||||
export class MenuRepository extends BaseRepository<
|
||||
Menu,
|
||||
MenuPopulate,
|
||||
MenuFull
|
||||
MenuFull,
|
||||
MenuDTOMapActions
|
||||
> {
|
||||
constructor(
|
||||
readonly eventEmitter: EventEmitter2,
|
||||
|
@ -20,13 +20,18 @@ import { MENU_CACHE_KEY } from '@/utils/constants/cache';
|
||||
import { Cacheable } from '@/utils/decorators/cacheable.decorator';
|
||||
import { BaseService } from '@/utils/generics/base-service';
|
||||
|
||||
import { MenuCreateDto } from '../dto/menu.dto';
|
||||
import { MenuCreateDto, MenuDTOMapActions } from '../dto/menu.dto';
|
||||
import { MenuRepository } from '../repositories/menu.repository';
|
||||
import { Menu, MenuFull, MenuPopulate } from '../schemas/menu.schema';
|
||||
import { AnyMenu, MenuTree, MenuType } from '../schemas/types/menu';
|
||||
|
||||
@Injectable()
|
||||
export class MenuService extends BaseService<Menu, MenuPopulate, MenuFull> {
|
||||
export class MenuService extends BaseService<
|
||||
Menu,
|
||||
MenuPopulate,
|
||||
MenuFull,
|
||||
MenuDTOMapActions
|
||||
> {
|
||||
private RootSymbol: symbol = Symbol('RootMenu');
|
||||
|
||||
constructor(
|
||||
|
Loading…
Reference in New Issue
Block a user