upgrade schema, resolvers, panel added

This commit is contained in:
2025-05-16 09:23:48 +03:00
parent 8a60bec73a
commit 2d382be794
80 changed files with 8641 additions and 1100 deletions

71
schema/admin.graphql Normal file
View File

@@ -0,0 +1,71 @@
type EnvVariable {
key: String!
value: String!
description: String
type: String!
isSecret: Boolean
}
type EnvSection {
name: String!
description: String
variables: [EnvVariable!]!
}
input EnvVariableInput {
key: String!
value: String!
type: String!
}
# Типы для управления пользователями
type AdminUserInfo {
id: Int!
email: String
name: String
slug: String
roles: [String!]
created_at: Int
last_seen: Int
muted: Boolean
is_active: Boolean
}
input AdminUserUpdateInput {
id: Int!
roles: [String!]
muted: Boolean
is_active: Boolean
}
type Role {
id: String!
name: String!
description: String
}
# Тип для пагинированного ответа пользователей
type AdminUserListResponse {
users: [AdminUserInfo!]!
total: Int!
page: Int!
perPage: Int!
totalPages: Int!
}
extend type Query {
getEnvVariables: [EnvSection!]!
# Запросы для управления пользователями
adminGetUsers(limit: Int, offset: Int, search: String): AdminUserListResponse!
adminGetRoles: [Role!]!
}
extend type Mutation {
updateEnvVariable(key: String!, value: String!): Boolean!
updateEnvVariables(variables: [EnvVariableInput!]!): Boolean!
# Мутации для управления пользователями
adminUpdateUser(user: AdminUserUpdateInput!): Boolean!
adminToggleUserBlock(userId: Int!): Boolean!
adminToggleUserMute(userId: Int!): Boolean!
}

View File

@@ -51,3 +51,18 @@ enum InviteStatus {
ACCEPTED
REJECTED
}
# Auth enums
enum AuthAction {
LOGIN
REGISTER
CONFIRM_EMAIL
RESET_PASSWORD
CHANGE_PASSWORD
}
enum RoleType {
SYSTEM
COMMUNITY
CUSTOM
}

View File

@@ -116,3 +116,25 @@ input CommunityInput {
desc: String
pic: String
}
# Auth inputs
input LoginCredentials {
email: String!
password: String!
}
input RegisterInput {
email: String!
password: String
name: String
}
input ChangePasswordInput {
oldPassword: String!
newPassword: String!
}
input ResetPasswordInput {
token: String!
newPassword: String!
}

View File

@@ -1,4 +1,14 @@
type Mutation {
# Auth mutations
login(email: String!, password: String!): AuthResult!
registerUser(email: String!, password: String, name: String): AuthResult!
sendLink(email: String!, lang: String, template: String): Author!
confirmEmail(token: String!): AuthResult!
getSession: SessionInfo!
changePassword(oldPassword: String!, newPassword: String!): AuthSuccess!
resetPassword(token: String!, newPassword: String!): AuthSuccess!
requestPasswordReset(email: String!, lang: String): AuthSuccess!
# author
rate_author(rated_slug: String!, value: Int!): CommonResult!
update_author(profile: ProfileInput!): CommonResult!

View File

@@ -6,6 +6,14 @@ type Query {
load_authors_by(by: AuthorsBy!, limit: Int, offset: Int): [Author]
# search_authors(what: String!): [Author]
# Auth queries
signOut: AuthSuccess!
me: AuthResult!
isEmailUsed(email: String!): Boolean!
isAdmin: Boolean!
getOAuthProviders: [OAuthProvider!]!
getRoles: [RolesInfo!]!
# community
get_community: Community
get_communities_all: [Community]

View File

@@ -23,10 +23,14 @@ type Author {
last_seen: Int
updated_at: Int
deleted_at: Int
email: String
seo: String
# synthetic
stat: AuthorStat # ratings inside
communities: [Community]
# Auth fields
roles: [String!]
email_verified: Boolean
}
type ReactionUpdating {
@@ -280,3 +284,39 @@ type MyRateComment {
my_rate: ReactionKind
}
# Auth types
type AuthResult {
success: Boolean!
error: String
token: String
author: Author
}
type Permission {
resource: String!
action: String!
conditions: String
}
type SessionInfo {
token: String!
author: Author!
}
type AuthSuccess {
success: Boolean!
}
type OAuthProvider {
id: String!
name: String!
url: String!
}
type RolesInfo {
id: String!
name: String!
description: String
permissions: [Permission!]!
}