wildflock/src/services/aliases/aliases.ts

40 lines
956 B
TypeScript
Raw Normal View History

2023-08-06 06:21:17 +00:00
import type { Application } from '../../declarations';
import { validateAuth } from '../../hooks/validate-auth';
import { AliasesService, getOptions } from './aliases.class';
2023-07-29 18:10:00 +00:00
2023-08-06 06:21:17 +00:00
export const aliasesPath = 'aliases';
export const aliasesMethods = ['find', 'create', 'remove'] as const;
2023-07-29 18:10:00 +00:00
2023-08-06 06:21:17 +00:00
export * from './aliases.class';
2023-07-29 18:10:00 +00:00
export const aliases = (app: Application) => {
2023-08-06 06:21:17 +00:00
app.use(aliasesPath, new AliasesService(getOptions(app)), {
methods: aliasesMethods,
events: [],
});
2023-07-29 18:10:00 +00:00
2023-08-06 06:21:17 +00:00
app.service(aliasesPath).hooks({
around: {
all: [],
},
before: {
all: [validateAuth],
find: [],
create: [],
},
after: {
all: [],
},
error: {
all: [],
},
});
2023-07-29 21:50:42 +00:00
};
2023-07-29 18:10:00 +00:00
// Add this service to the service type index
2023-08-06 06:21:17 +00:00
declare module '../../declarations' {
interface ServiceTypes {
[aliasesPath]: AliasesService;
}
2023-07-29 18:10:00 +00:00
}