From 1c065ac542d21e89944b63c5d58d0f844f62b8fd Mon Sep 17 00:00:00 2001 From: Pranciskus Ambrazas Date: Thu, 7 Dec 2023 12:43:56 +0200 Subject: [PATCH] still cleanuping --- services/apps.service.ts | 8 ++------ services/permissions.service.ts | 2 +- services/seed.service.ts | 9 +++++++++ test/helpers/api.ts | 4 ++-- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/services/apps.service.ts b/services/apps.service.ts index b70226a..d4f775f 100644 --- a/services/apps.service.ts +++ b/services/apps.service.ts @@ -15,13 +15,10 @@ import { } from '../types'; import { AppAuthMeta } from './api.service'; +// default app types export enum AppType { - FISH_STOCKING = 'FISH_STOCKING', - FISHING = 'FISHING', - HUNTING = 'HUNTING', ADMIN = 'ADMIN', USERS = 'USERS', - SPECIES = 'SPECIES', } export enum UsersAppAccesses { @@ -31,7 +28,7 @@ export enum UsersAppAccesses { export interface App extends BaseModelInterface { name: string; apiKey: string; - type: AppType; + type: AppType & string; isAdmin: boolean; url: string; settings?: { @@ -66,7 +63,6 @@ export interface App extends BaseModelInterface { type: 'string', required: true, immutable: true, - enum: Object.values(AppType), validate: 'validateType', }, diff --git a/services/permissions.service.ts b/services/permissions.service.ts index f8d6841..090fa1f 100644 --- a/services/permissions.service.ts +++ b/services/permissions.service.ts @@ -2,7 +2,7 @@ import moleculer, { Context } from 'moleculer'; import { Action, Method, Service } from 'moleculer-decorators'; -import { App, AppType, UsersAppAccesses } from './apps.service'; +import { App, UsersAppAccesses } from './apps.service'; import { Group } from './groups.service'; import { UserGroup, UserGroupRole } from './userGroups.service'; import { User, UserType } from './users.service'; diff --git a/services/seed.service.ts b/services/seed.service.ts index 2d9f33c..d9c58a4 100644 --- a/services/seed.service.ts +++ b/services/seed.service.ts @@ -20,6 +20,15 @@ export default class SeedService extends moleculer.Service { productNameTo: 'BĮIP administravimo sistemos', }, }); + + await ctx.call('apps.create', { + name: 'Vidiniai naudotojai', + type: AppType.USERS, + url: 'https://admin.biip.lt', + settings: { + productNameTo: 'BĮĮP naudotojų valdymo sistemos', + }, + }); // create local user await ctx.call('usersLocal.invite', { diff --git a/test/helpers/api.ts b/test/helpers/api.ts index 51d57ff..bc52b8d 100644 --- a/test/helpers/api.ts +++ b/test/helpers/api.ts @@ -134,7 +134,7 @@ export class ApiHelper { }); this.appFishing = await this.broker.call('apps.create', { name: 'FishingTest', - type: AppType.FISHING, + type: 'FISHING', url: faker.internet.url(), settings: { productNameTo: faker.lorem.word(2), @@ -142,7 +142,7 @@ export class ApiHelper { }); this.appHunting = await this.broker.call('apps.create', { name: 'HuntingTest', - type: AppType.HUNTING, + type: 'HUNTING', url: faker.internet.url(), settings: { productNameTo: faker.lorem.word(2),