Teamlinker/code/common/routes/user.ts
sx1989827 846ee6ca75 add
2021-10-06 17:51:30 +08:00

87 lines
2.5 KiB
TypeScript

import { ICommon_Model_Admin } from './../model/admin';
import { ICommon_Model_User } from './../model/user';
import { ECommon_Services } from './../types';
import {ECommon_HttpApi_Method, ICommon_HttpApi} from "./types"
const api={
baseUrl:"/user",
service:ECommon_Services.User,
routes:{
login:{
method:ECommon_HttpApi_Method.POST,
path:"/login",
req:<{
username:string,
password:string
}>{},
res:<Omit<ICommon_Model_User,"password">>{},
ignoreValidate:true
},
checkUser:{
method:ECommon_HttpApi_Method.GET,
path:"/check_user",
req:<{
name:string
}>{},
res:<boolean>{},
ignoreValidate:true
},
logout:{
method:ECommon_HttpApi_Method.POST,
path:"/logout",
req:{},
res:{},
},
loginAdmin:{
method:ECommon_HttpApi_Method.POST,
path:"/admin_login",
req:<{
username:string,
password:string
}>{},
res:<Omit<ICommon_Model_Admin,"password">>{},
},
logoutAdmin:{
method:ECommon_HttpApi_Method.POST,
path:"/admin_logout",
req:{},
res:{},
},
refresh:{
method:ECommon_HttpApi_Method.GET,
path:"/refresh",
req:{},
res:<Omit<ICommon_Model_User,"password">>{},
},
update:{
method:ECommon_HttpApi_Method.PUT,
path:"/item",
req:<Partial<Omit<ICommon_Model_User,"id" | "password" | "created_time" | "modified_time">>>{},
res:<Omit<ICommon_Model_User,"password">>{},
},
create:{
method:ECommon_HttpApi_Method.POST,
path:"/item",
req:<Partial<Omit<ICommon_Model_User,"id" | "created_time" | "modified_time">> & {
username:string,
password:string
}>{},
res:<Omit<ICommon_Model_User,"password">>{}
},
remove:{
method:ECommon_HttpApi_Method.DELETE,
path:"/item",
req:{},
res:{},
},
active:{
method:ECommon_HttpApi_Method.PUT,
path:"/active",
req:<{
active:number
}>{},
res:{},
}
}
}
export=api