Skip to content

station

# 一个面向 前端/用户/调用者 的 type
type Query {
    # users 接受两个参数 station_id 和 partner_id,返回由 User type 组成的列表
    users(station_id: String, partner_id: Int): [User]

    # roles 接受两个参数 station_id 和 contain_role_name,返回由 Role type 组成的列表
    roles(station_id: String!, contain_role_name: String): [Role]
    # role 接受一个必传参数 id,返回一个 Role type
    role(id: ID!): Role

    # permissions 接受两个参数 station_id 和 partner_id,返回由 Permission type 组成的列表
    permissions(station_id: ID, partner_id: ID): [Permission!]!  # statin_id 和 partner_id 至少传一个
    # permission 接受一个必传参数 id,返回一个 Permission type
    permission(id: ID!): Permission

    # stations 接受一个必传参数 partner_id,返回由 Station type 组成的列表
    stations(partner_id: String!) [Station]
}

# User type
type User {
    id: ID
    username: String
    create_time: Datetime
    update_time: Datetime
    is_admin: Bool
    is_valid: Bool
    roles: [Role]  # User type 有一个名为 roles 的属性,这个属性的值是 一个由 Roles type 组成的列表
    visible_stations: [Station]  # User type 有一个名为 visible_stations 的属性,这个属性的值是 一个由 Station type 组成的列表
}

# Role type
type Role {
    id: ID
    name: String
    users: [User]
    station: Station
    description: String
    permissions: [Permission]
}

# Station type
type Station {
    id: ID
    name: String
    roles: [Role]
}

type Permissions {
    id: ID
    name: String
    permission_level2_class: PermissionLevel1Class
    stations(station_id: String, partner_id: Int): [Station]
    roles   (station_id: String, partner_id: Int): [Role]
    users   (station_id: String, partner_id: Int): [User]
}

type PermissionLevel1Class {
    id: ID
    name: String
}

type PermissionLevel2Class {
    id: ID
    name: String
    permission_level1_class: PermissionLevel1Class
}