GraphQL (part 2): Model changes and resolvers (#19486)
This PR adds the necessary resolvers to support the graphQL front-end. Some additional methods need to be added to the model structs to support this. Comments have been made to clarify their purpose. There is a slight duplication of code in the api layer. But eventually that's going to go away when we move away from the REST API entirely. The schema is in api4/schema.graphqls and gets compiled into the binary as an asset. The GraphiQL editor url is at GET /api/v5/graphql. Everything is behind the feature flag MM_FEATUREFLAGS_GRAPHQL. ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
88968f9e17
Коммит
3f52bd197a
157
api4/schema.graphqls
Обычный файл
157
api4/schema.graphqls
Обычный файл
@@ -0,0 +1,157 @@
|
||||
schema {
|
||||
query: Query
|
||||
}
|
||||
|
||||
type Query {
|
||||
user(id: String!): User
|
||||
config(): StringMap!
|
||||
license(): StringMap!
|
||||
teamMembers(userId: String!,
|
||||
teamId: String = ""): [TeamMember]!
|
||||
channels(userId: String!,
|
||||
teamId: String = "",
|
||||
includeDeleted: Boolean = false,
|
||||
lastDeleteAt: Float = 0,
|
||||
lastUpdateAt: Float = 0,
|
||||
first: Int = 60,
|
||||
after: String = ""): [Channel]!
|
||||
channelsLeft(userId: String!,
|
||||
since: Float!): [String!]!
|
||||
channelMembers(userId: String!,
|
||||
channelId: String = "",
|
||||
first: Int = 60,
|
||||
after: String = "",
|
||||
lastUpdateAt: Float = 0): [ChannelMember]!
|
||||
}
|
||||
|
||||
scalar ChannelType
|
||||
|
||||
scalar SidebarCategoryType
|
||||
|
||||
scalar SidebarCategorySorting
|
||||
|
||||
scalar StringMap
|
||||
|
||||
scalar Time
|
||||
|
||||
type Channel {
|
||||
id : String!
|
||||
createAt : Float!
|
||||
updateAt : Float!
|
||||
deleteAt : Float!
|
||||
type : ChannelType!
|
||||
displayName: String!
|
||||
prettyDisplayName: String!
|
||||
name: String!
|
||||
header: String!
|
||||
purpose: String!
|
||||
creatorId: String!
|
||||
schemeId: String
|
||||
team: Team
|
||||
cursor: String
|
||||
}
|
||||
|
||||
type ChannelMember {
|
||||
channel : Channel
|
||||
user : User
|
||||
roles : [Role]!
|
||||
lastViewedAt : Float!
|
||||
msgCount : Float!
|
||||
mentionCount : Float!
|
||||
mentionCountRoot : Float!
|
||||
notifyProps : StringMap!
|
||||
lastUpdateAt : Float!
|
||||
schemeGuest : Boolean!
|
||||
schemeUser : Boolean!
|
||||
schemeAdmin : Boolean!
|
||||
explicitRoles : String!
|
||||
cursor: String
|
||||
}
|
||||
|
||||
type User {
|
||||
id: String!
|
||||
username: String!
|
||||
email: String!
|
||||
firstName: String!
|
||||
lastName: String!
|
||||
nickname: String!
|
||||
isBot: Boolean!
|
||||
isGuest: Boolean!
|
||||
isSystemAdmin: Boolean!
|
||||
createAt: Float!
|
||||
deleteAt: Float!
|
||||
authService: String!
|
||||
customStatus: CustomStatus
|
||||
status: Status
|
||||
props: StringMap!
|
||||
notifyProps: StringMap!
|
||||
lastPictureUpdateAt: Float!
|
||||
locale: String!
|
||||
timezone: StringMap!
|
||||
position: String!
|
||||
roles: [Role]!
|
||||
preferences: [Preference!]!
|
||||
}
|
||||
|
||||
type CustomStatus {
|
||||
emoji: String!
|
||||
text: String!
|
||||
duration: String!
|
||||
expiresAt: Time!
|
||||
}
|
||||
|
||||
type Status {
|
||||
status: String!
|
||||
manual: Boolean!
|
||||
lastActivityAt: Float!
|
||||
activeChannel: String!
|
||||
dndEndTime: Float!
|
||||
}
|
||||
|
||||
type Role {
|
||||
id: String!
|
||||
name: String!
|
||||
permissions: [String!]!
|
||||
schemeManaged: Boolean!
|
||||
builtIn: Boolean!
|
||||
}
|
||||
|
||||
type Preference {
|
||||
userId: String!
|
||||
category: String!
|
||||
name: String!
|
||||
value: String!
|
||||
}
|
||||
|
||||
type Team {
|
||||
id: String!
|
||||
displayName : String!
|
||||
name : String!
|
||||
description : String!
|
||||
email : String!
|
||||
type : String!
|
||||
companyName : String!
|
||||
allowedDomains : String!
|
||||
inviteId : String!
|
||||
}
|
||||
|
||||
type TeamMember {
|
||||
team: Team
|
||||
user: User
|
||||
roles: [Role]!
|
||||
deleteAt: Float!
|
||||
schemeGuest: Boolean!
|
||||
schemeUser: Boolean!
|
||||
schemeAdmin: Boolean!
|
||||
sidebarCategories: [SidebarCategory]!
|
||||
}
|
||||
|
||||
type SidebarCategory {
|
||||
id: String!
|
||||
sorting: SidebarCategorySorting!
|
||||
type: SidebarCategoryType!
|
||||
displayName: String!
|
||||
muted: Boolean!
|
||||
collapsed: Boolean!
|
||||
channelIds: [String!]!
|
||||
}
|
||||
Ссылка в новой задаче
Block a user