Skip to content

Commit

Permalink
public fishTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
ambrazasp committed Nov 30, 2023
1 parent e3052b0 commit 283193e
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions services/fishTypes.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

import moleculer from 'moleculer';
import { Method, Service } from 'moleculer-decorators';
import moleculer, { Context, RestSchema } from 'moleculer';
import { Action, Method, Service } from 'moleculer-decorators';

import DbConnection from '../mixins/database.mixin';
import {
Expand Down Expand Up @@ -64,6 +64,21 @@ export type FishType<
},
})
export default class FishTypesService extends moleculer.Service {
@Action({
rest: <RestSchema>{
method: 'GET',
basePath: '/public/fishTypes',
path: '/',
},
auth: RestrictionType.PUBLIC,
})
getPublicItems(ctx: Context) {
return this.findEntities(ctx, {
fields: ['id', 'label'],
sort: 'label',
});
}

@Method
async seedDB() {
await this.createEntities(null, [
Expand Down

0 comments on commit 283193e

Please sign in to comment.