transform core api codes into this project, update modules as admin/pos context modules
This commit is contained in:
@@ -1,12 +1,54 @@
|
||||
import translates from '@/common/constants/translates/translates'
|
||||
import {
|
||||
AccountRole,
|
||||
AccountStatus,
|
||||
BusinessRole,
|
||||
GoodPricingModel,
|
||||
LicenseStatus,
|
||||
LicenseType,
|
||||
PartnerRole,
|
||||
POSRole,
|
||||
POSStatus,
|
||||
POSType,
|
||||
ProviderRole,
|
||||
UnitType,
|
||||
UserStatus,
|
||||
UserType,
|
||||
} from '@/generated/prisma/enums'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { GoldKarat } from '../../common/enums/enums'
|
||||
import { ResponseMapper } from '../../common/response/response-mapper'
|
||||
import { AccountType, GoldKarat, TokenType } from 'common/enums/enums'
|
||||
import { ResponseMapper } from 'common/response/response-mapper'
|
||||
|
||||
@Injectable()
|
||||
export class EnumsService {
|
||||
private prepareData(items: Record<string, string>) {
|
||||
console.log(translates.enums[items[0]])
|
||||
|
||||
return Object.values(items).map(item => ({
|
||||
name: translates.enums[item] || item,
|
||||
value: item,
|
||||
}))
|
||||
}
|
||||
|
||||
getAllEnums() {
|
||||
return {
|
||||
GoldKarat: Object.values(GoldKarat).filter(value => typeof value === 'string'),
|
||||
GoldKarat: this.prepareData(GoldKarat),
|
||||
UserStatus: this.prepareData(UserStatus),
|
||||
AccountRole: this.prepareData(AccountRole),
|
||||
AccountStatus: this.prepareData(AccountStatus),
|
||||
POSStatus: this.prepareData(POSStatus),
|
||||
POSRole: this.prepareData(POSRole),
|
||||
LicenseType: this.prepareData(LicenseType),
|
||||
LicenseStatus: this.prepareData(LicenseStatus),
|
||||
POSType: this.prepareData(POSType),
|
||||
UserType: this.prepareData(UserType),
|
||||
AccountType: this.prepareData(AccountType),
|
||||
PartnerRole: this.prepareData(PartnerRole),
|
||||
BusinessRole: this.prepareData(BusinessRole),
|
||||
ProviderRole: this.prepareData(ProviderRole),
|
||||
TokenType: this.prepareData(TokenType),
|
||||
UnitType: this.prepareData(UnitType),
|
||||
GoodPricingModel: this.prepareData(GoodPricingModel),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user