Add packages/common
This commit is contained in:
parent
a46a2d28bf
commit
076ec515d3
4
packages/common/package.json
Normal file
4
packages/common/package.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"name": "@rondo/common",
|
||||||
|
"private": true
|
||||||
|
}
|
||||||
36
packages/common/src/IAPIDef.ts
Normal file
36
packages/common/src/IAPIDef.ts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
export interface IAPIDef {
|
||||||
|
'/auth/register': {
|
||||||
|
'post': {
|
||||||
|
body: {
|
||||||
|
username: string
|
||||||
|
password: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'/auth/login': {
|
||||||
|
'post': {
|
||||||
|
body: {
|
||||||
|
username: string
|
||||||
|
password: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'/auth/logout': {
|
||||||
|
'get': {}
|
||||||
|
},
|
||||||
|
'/users/password': {
|
||||||
|
'post': {
|
||||||
|
body: {
|
||||||
|
oldPassword: string
|
||||||
|
newPassword: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'/users/profile': {
|
||||||
|
'get': {
|
||||||
|
response: {
|
||||||
|
id: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
packages/common/src/IRoutes.ts
Normal file
21
packages/common/src/IRoutes.ts
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
export type IMethod = 'get'
|
||||||
|
| 'post'
|
||||||
|
| 'put'
|
||||||
|
| 'delete'
|
||||||
|
| 'patch'
|
||||||
|
| 'head'
|
||||||
|
| 'options'
|
||||||
|
|
||||||
|
export interface IRoutes {
|
||||||
|
// has to be any because otherwise TypeScript will start
|
||||||
|
// throwing error and interfaces without an index signature
|
||||||
|
// would not be usable
|
||||||
|
[route: string]: any
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IRoute {
|
||||||
|
params: any
|
||||||
|
query: any
|
||||||
|
body: any
|
||||||
|
response: any
|
||||||
|
}
|
||||||
@ -1,21 +1,2 @@
|
|||||||
export type IMethod = 'get'
|
export * from './IRoutes'
|
||||||
| 'post'
|
export * from './IAPIDef'
|
||||||
| 'put'
|
|
||||||
| 'delete'
|
|
||||||
| 'patch'
|
|
||||||
| 'head'
|
|
||||||
| 'options'
|
|
||||||
|
|
||||||
export interface IRoutes {
|
|
||||||
// has to be any because otherwise TypeScript will start
|
|
||||||
// throwing error and interfaces without an index signature
|
|
||||||
// would not be usable
|
|
||||||
[route: string]: any
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IRoute {
|
|
||||||
params: any
|
|
||||||
query: any
|
|
||||||
body: any
|
|
||||||
response: any
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user