/
global.d.ts
37 lines (33 loc) · 1.08 KB
/
global.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import type { PlatformaticApp, PlatformaticDBMixin, PlatformaticDBConfig, Entity, Entities, EntityHooks } from '@platformatic/db'
import { EntityTypes, Retro,User,UserRetro } from './types'
declare module 'fastify' {
interface FastifyInstance {
getSchema<T extends 'Retro' | 'User' | 'UserRetro'>(schemaId: T): {
'$id': string,
title: string,
description: string,
type: string,
properties: {
[x in keyof EntityTypes[T]]: { type: string, nullable?: boolean }
},
required: string[]
};
}
}
interface AppEntities extends Entities {
retro: Entity<Retro>,
user: Entity<User>,
userRetro: Entity<UserRetro>,
}
interface AppEntityHooks {
addEntityHooks(entityName: 'retro', hooks: EntityHooks<Retro>): any
addEntityHooks(entityName: 'user', hooks: EntityHooks<User>): any
addEntityHooks(entityName: 'userRetro', hooks: EntityHooks<UserRetro>): any
}
declare module 'fastify' {
interface FastifyInstance {
platformatic: PlatformaticApp<PlatformaticDBConfig> &
PlatformaticDBMixin<AppEntities> &
AppEntityHooks
}
}