Teamlinker/code/common/routes/user.ts
sx1989827 0e724bd185 aa
2021-12-27 21:59:34 +08:00

160 lines
4.9 KiB
TypeScript

import { ICommon_Model_User } from './../model/user';
import { ECommon_Services } from './../types';
import { ICommon_Route_Res_User_List, ICommon_Route_Res_User_Profile, ICommon_Route_Res_User_ProjectList, ICommon_Route_Res_User_TeamList } from './response';
import { ECommon_HttpApi_Method } 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_User,"password">>{},
ignoreValidate:true
},
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">> & {userId?:string}>{},
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:<{
userId:string
}>{},
res:{},
},
active:{//禁用、启用用户
method:ECommon_HttpApi_Method.PUT,
path:"/active",
req:<{
active:number,
userId:string
}>{},
res:{},
},
list:{
method:ECommon_HttpApi_Method.GET,
path:"/list",
req:<{
keyword?:string,
page:number,
size:number
}>{},
res:<ICommon_Route_Res_User_List>{},
},
resetPassword:{
method:ECommon_HttpApi_Method.PUT,
path:"/reset_password",
req:<{
userId?:string,
password:string
}>{},
res:{},
},
teamList:{
method:ECommon_HttpApi_Method.GET,
path:"/team_list",
req:<{
userId?:string,
keyword?:string,
page:number,
size:number
}>{},
res:<ICommon_Route_Res_User_TeamList>{},
},
projectList:{
method:ECommon_HttpApi_Method.GET,
path:"/project_list",
req:<{
userId?:string,
keyword?:string,
page:number,
size:number
}>{},
res:<ICommon_Route_Res_User_ProjectList>{},
},
profile:{
method:ECommon_HttpApi_Method.GET,
path:"/profile",
req:<{
userId?:string
}>{},
res:<ICommon_Route_Res_User_Profile>{},
},
infos:{
method:ECommon_HttpApi_Method.GET,
path:"/infos",
req:<{
userIds:string
}>{},
res:<Omit<ICommon_Model_User,"password"|"created_time"|"modified_time">[]>{},
},
filterUser:{
method:ECommon_HttpApi_Method.GET,
path:"/filter",
req:<{
name:string
}>{},
res:<{
name:string,
id:string,
photo:string
}[]>{},
}
}
}
export=api