File tree Expand file tree Collapse file tree 3 files changed +5
-9
lines changed Expand file tree Collapse file tree 3 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ export default function (plop: NodePlopAPI) {
8383 cli ( 'yarn config set nodeLinker node-modules' ) ,
8484 cli ( 'yarn plugin import interactive-tools' ) ,
8585 cli ( 'yarn' ) ,
86- cli ( 'yarn lint --fix' ) ,
86+ cli ( 'yarn lint --fix --max-warnings 10 ' ) ,
8787 data ?. features . includes ( 'db' ) && cli ( 'yarn migration:create initial-schema' ) ,
8888 {
8989 type : 'gitInit' ,
Original file line number Diff line number Diff line change @@ -7,9 +7,6 @@ import { Kysely, PostgresDialect } from 'kysely';
77import type { DB } from './generated/database';
88{{ else }}
99{{ /inArray }}
10- import type { {{ properCase name }} , {{ properCase name }} ConfigSchema } from './types';
11-
12- type Config = {{ properCase name }} ConfigSchema;
1310
1411export function service(): {{ properCase name }} ['Service'] {
1512 const base = useService<{{properCase name}}[' ServiceLocals' ]>();
@@ -21,13 +18,13 @@ export function service(): {{properCase name}}['Service'] {
2118 {{ #inArray features ' db' }}
2219 const db = new Kysely<DB >({
2320 dialect: new PostgresDialect({
24- pool: new Pool(app.locals.config.get< Config [ ' db ' ]>('db') as Config['db'] ),
21+ pool: new Pool(app.locals.config.db ),
2522 }),
2623 });
2724 {{ /inArray }}
2825
2926 {{ #inArray features ' redis' }}
30- const { enabled: redisEnabled, ...redisConfig } = app.locals.config.get< Config [ ' redis' ]>('redis') || {};
27+ const { enabled: redisEnabled, ...redisConfig } = app.locals.config.redis || {};
3128 const redis = redisEnabled ? new Redis(redisConfig) : undefined;
3229 {{ /inArray }}
3330
Original file line number Diff line number Diff line change 22{{ #inArray features ' redis' }} import type { Redis } from 'ioredis';{{ /inArray }}
33import type {
44 RequestLocals,
5- RequestWithApp,
6- Service,
7- ServiceExpress,
85 ServiceLocals,
96 ServiceTypes,
107} from '@openapi-typescript-infra/service';
@@ -14,6 +11,8 @@ import type { DB } from '../generated/database';
1411{{ /inArray }}
1512import type { operationHandlers } from '../generated/service';
1613
14+ import type { {{ properCase name }} , {{ properCase name }} ConfigSchema } from './types';
15+
1716export interface {{ properCase name }} Locals extends ServiceLocals<{{properCase name}}ConfigSchema> {
1817{{ #inArray features ' db' }} db: Kysely<DB >;
1918{{ /inArray }} {{ #inArray features ' redis' }} redis?: Redis;
You can’t perform that action at this time.
0 commit comments