Ports
station/graphql GraphQL 接口,承载了所有 station 部分的查询工作
method
get
type Query {
user (id: Int): User
users (station_id: String, partner_id: Int): [User]
role (id: Int): Role
roles (station_id: Stting, contain_role_name: String): [Role]
permission (id: Int): Permission
TODO
}
type Role {
id: Int!
name: String!
desc: String
station_id: String!
create_time: DateTime!
update_time: DateTime!
users: [User]
permissions: [Permission]
}
type User {
id: Int!
password: String!
last_login: DateTime
is_superuser: Int!
username: String!
first_name: String!
last_name: String!
email: String!
is_staff: Boolean!
is_active: Boolean!
date_joined: DateTime!
telephone: String!
type_id: Int!
create_time: DateTime!
update_time: DateTime!
creator: String
card_id: String
card_photo1: String
card_photo2: String
roles: [Role]
station: Station
}
type Station {
id: String
name: String
partner_id: String
users: [User]
permissions: [Permission]
partner: Partner
}
type Permission {
id: Int!
name: String!
codename: String!
level2_id: Int!
level2_permission_class: Level2PermissionClass
roles: [Role]
stations: [Station]
}
type Partner {
id: Int!
name: String!
description: String
level: Boolean!
manager: Int
is_valid: Int!
pinyin_name: String
stations: [Station]
}
type Level2PermissionClass {
id: Int!
name: String!
level: Int!
parent_id: Int
create_time: DateTime!
update_time: DateTime!
delete: Boolean!
permissions: [Permission]!
level1_permission_class: Level1PermissionClass
}
type Level1PermissionClass {
id: Int!
name: String!
level: Int!
parent_id: Int
create_time: DateTime!
update_time: DateTime!
delete: Boolean!
level2_permission_classes: [Level2PermissionClass]
}
station/user/create 创建用户
method:
post
request:
username M str
station_id M str
role_ids M json list of int (不能为空)
is_admin M bool
is_valid M bool
password M str
name O str
phone O str
email O str
card_id O str
card_emblem_img O str
card_photo_img O str
response:
{ msg: OK, code: 0, data: { id: 123 } }
logic:
None
station/user/update 更新用户
method:
post
request:
id M int user's id
username O str
role_ids O json list of int (不能为空)
is_admin O bool
is_valid O bool
password O str
name O str
phone O str
email O str
card_id O str
card_emblem_img O str
card_photo_img O str
response:
{ msg: OK, code: 0, data: null }
logic:
不传的字段不会被更新
station/user/delete 删除用户
method:
post
request:
id M int user_id
response:
{ msg: OK, code: 0, data: null }
station/role/create 创建角色
method
post
request
name M str
station_id M str
description O str
permission_ids M json list of int
response
{ msg: OK, code: 0, data: { id: 123 } }
station/role/update 更新角色
method
post
request
id M int
name O str
description O str
permission_ids O json list of int
response
{ msg: OK, code: 0, data: null }
station/role/delete 删除角色
method
post
request
id M int
response
{ msg: OK, code: 0, data: null }
logic
角色下绑定了用户的情况下,接口会报错
station/permission/change_role 更新「某个站点旗下『激活某个权限的所有角色』」
method
POST
request
station_id M str
permission_id M int
role_ids M list of int
response
{ "code": 0, "msg": "OK", "data": null }
ma/graphql GraphQL 接口,承载了所有 ma 部分的查询工作
method
get
type Query {
user (id: Int!): User!
partner (id: Int!): Partner!
role (id: Int!): Role!
roles (partner_id: Int!, contain_role_name: String): [Role]!
permission (id: Int!): Permission!
level1_permission_classes: [Level1PermissionClass]!
}
type User {
name: String!
id: Int!
username: String!
email: String!
is_staff: Boolean!
is_active: Boolean!
phone_no: String
limit_station: Int
partner_id: Int
create_time: DateTime
update_time: DateTime
partner: Partner
roles: [Role]!
}
type Partner {
id: Int!
name: String!
description: String
is_valid: Int!
pinyin_name: String
users: [User]!
}
type Role {
description: String
id: Int!
name: String!
partner_id: String
create_time: DateTime
update_time: DateTime
users: [User]!
permissions: [Permission]!
}
type Permission {
id: Int!
name: String!
roles: [Role]!
level2_permission_class: Level2PermissionClass!
}
type Level1PermissionClass {
id: Int
name: String!
level: Int!
parent_id: Int
create_time: DateTime!
update_time: DateTime!
delete: Boolean!
level2_permission_classes: [Level2PermissionClass]
}
type Level2PermissionClass {
id: Int
name: String!
parent_id: Int
create_time: DateTime!
update_time: DateTime!
permissions: [Permission!]
level1_permission_class: Level1PermissionClass
}
ma/user/create 创建用户
method
POST
request
partner_id M int
username M str
role_ids M list of int
visible_station_ids M list of str
is_admin M bool
is_valid M bool
is_sale_manager M bool
password M str
name O str
phone O str
email O str
card_id O str
card_emblem_img O str
card_photo_img O str
response
{
data: { id: 123 },
msg: 'OK',
code: 0
}
ma/user/update 更新用户
method
POST
request
id M int 角色 id
name O str
description O str
permission_ids O list of int
response
{ "code": 0, "msg": "OK", "data": null }
ma/user/delete 删除用户
method
POST
request
id M int
response
{ "code": 0, "msg": "OK", "data": null }
ma/role/create 创建角色
method
post
request
name M str
partner_id M int
description O str
permission_ids M json list of int
response
{ msg: "OK", code: 0, data: { id: 123 } }
ma/role/update 更新角色
method
post
request
id M int
name O str
description O str
permission_ids O json list of int
response
{ msg: "OK", code: 0, data: null }
ma/role/delete 删除角色
method
post
request
id M int
response
{ msg: "OK", code: 0, data: null }
ma/permission/change_role 更新「某个加盟商旗下『激活某个权限的所有角色』」
method
POST
request
partner_id M str
permission_id M int
role_ids M list of int
response
{ "code": 0, "msg": "OK", "data": null }