admin 8320de7d6e
All checks were successful
continuous-integration/drone/push Build is passing
v0.0.30.2 Убран duration из клипов
2025-09-02 23:03:56 +03:00

304 lines
9.1 KiB
GraphQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Тип пользователя
type User {
id: Int! # Уникальный идентификатор
username: String! # Имя пользователя
avatar: String! # Аватар
email: String! # Email (уникальный)
emailConfirmedAt: String # Дата подтверждения email (может быть null)
createdAt: String! # Дата создания
updatedAt: String! # Дата обновления
followersCount: Int!
followingCount: Int!
isFollowing(userId: Int!): Boolean!
followers(limit: Int = 20, offset: Int = 0): FollowersResponse!
following(limit: Int = 20, offset: Int = 0): FollowingResponse!
subscriptionNotifications(
unreadOnly: Boolean = false
limit: Int = 20
offset: Int = 0
): NotificationsResponse!
}
# Пост в блоге
type Post {
id: Int! # Уникальный идентификатор
title: String! # Заголовок поста
content: String! # Содержание поста
author: User! # Автор поста
commentsCount: Int!
likes: [Like!]! # Лайки к посту
likesCount: Int!
isLiked: Boolean!
createdAt: String! # Дата создания
updatedAt: String! # Дата обновления
}
# Комментарий к посту
type Comment {
id: Int! # Уникальный идентификатор
content: String! # Текст комментария
post: Post! # Пост, к которому относится
author: User! # Автор комментария
createdAt: String! # Дата создания
updatedAt: String! # Дата обновления
}
# Лайк к посту
type Like {
id: Int! # Уникальный идентификатор
post: Post! # Пост, который лайкнули
user: User! # Пользователь, который поставил лайк
createdAt: String! # Дата создания
}
type Tokens {
accessToken: String!
refreshToken: String!
accessTokenExpires: String! # или DateTime, если такой scalar есть
refreshTokenExpires: String!
emailConfirmed: Boolean!
}
# Входные данные для регистрации
input RegisterInput {
username: String! # Имя пользователя
email: String! # Email
password: String! # Пароль
}
# Входные данные для входа
input LoginInput {
email: String! # Email
password: String! # Пароль
}
type Message {
id: Int!
chatId: Int!
senderId: Int!
receiverId: Int!
content: String!
status: MessageStatus!
createdAt: String!
}
enum MessageStatus {
SENT
DELIVERED
READ
}
type Chat {
id: Int!
user1Id: Int!
user2Id: Int!
createdAt: String!
updatedAt: String!
lastMessage: Message
}
type Session {
id: Int!
device: Device!
startedAt: String!
lastActiveAt: String!
isCurrent: Boolean!
}
type Device {
id: Int!
name: String!
ipAddress: String!
userAgent: String!
lastActiveAt: String!
}
# типы для подписок
type Follower {
userId: Int!
username: String!
avatar: String!
createdAt: String!
}
type Following {
userId: Int!
username: String!
avatar: String!
createdAt: String!
}
type SubscriptionNotification {
id: Int!
followerId: Int!
followerUsername: String!
followerAvatar: String!
isRead: Boolean!
createdAt: String!
expiresAt: String!
}
type FollowersResponse {
followers: [Follower!]!
totalCount: Int!
}
type FollowingResponse {
following: [Following!]!
totalCount: Int!
}
type NotificationsResponse {
notifications: [SubscriptionNotification!]!
totalCount: Int!
unreadCount: Int!
}
type FollowResult {
success: Boolean!
message: String!
}
type UnfollowResult {
success: Boolean!
message: String!
}
type MarkNotificationReadResult {
success: Boolean!
message: String!
}
# Клип
type Clip {
id: Int!
title: String!
videoUrl: String!
thumbnailUrl: String!
author: User!
commentsCount: Int!
likesCount: Int!
isLiked: Boolean!
createdAt: String!
updatedAt: String!
}
# Лайк клипа
type ClipLike {
id: Int! # Уникальный идентификатор
clipId: Int! # ID клипа
userId: Int! # ID пользователя
createdAt: String! # Дата создания
}
# Комментарий к клипу
type ClipComment {
id: Int!
clipId: Int!
author: User!
content: String!
createdAt: String!
updatedAt: String!
}
scalar Upload
# Запросы (получение данных)
type Query {
me: User! # Получить текущего пользователя
post(id: Int!): Post! # Получить пост по ID
posts: [Post!]! # Получить все посты
postsPaginated(limit: Int!, offset: Int!): [Post!]!
getUserPosts(userId: Int!): [Post!]!
user(id: Int!): User! # Получить пользователя по ID
users: [User!]!
getChat(user1Id: Int!, user2Id: Int!): Chat!
getChatMessages(chatId: Int!, limit: Int!, offset: Int!): [Message!]!
getUserChats(userId: Int!): [Chat!]!
mySessions: [Session!]!
comments(postID: Int!): [Comment!]!
# Получить количество подписчиков
getFollowersCount(userId: Int!): Int!
# Получить количество подписок
getFollowingCount(userId: Int!): Int!
# Проверить подписку
isFollowing(followingId: Int!): Boolean!
# Получить список подписчиков
getFollowers(userId: Int!, limit: Int = 20, offset: Int = 0): FollowersResponse!
# Получить список подписок
getFollowing(userId: Int!, limit: Int = 20, offset: Int = 0): FollowingResponse!
# Получить уведомления о подписках
getSubscriptionNotifications(
unreadOnly: Boolean = false
limit: Int = 20
offset: Int = 0
): NotificationsResponse!
clip(id: Int!): Clip! # Получить клип по ID
clips(limit: Int, offset: Int): [Clip!]! # Получить клипы с пагинацией
userClips(userId: Int!, limit: Int, offset: Int): [Clip!]! # Клипы пользователя
clipComments(clipId: Int!, limit: Int, offset: Int): [ClipComment!]! # Комментарии клипа
clipLikes(clipId: Int!, limit: Int, offset: Int): [ClipLike!]! # Лайки клипа
isLiked(clipId: Int!): Boolean! # Проверить лайк текущего пользователя
}
# Мутации (изменение данных)
type Mutation {
# Регистрация нового пользователя
register(input: RegisterInput!): User!
# Вход в систему
login(input: LoginInput!): Tokens!
# Обновление токенов
refreshTokens(refreshToken: String!): Tokens!
# Создание поста
createPost(title: String!, content: Upload!): Post!
# Создание комментария
createComment(postId: Int!, content: String!): Comment!
# Лайк поста
likePost(postId: Int!): Like!
# Удаление лайка
unlikePost(postId: Int!): Boolean!
updateProfile(username: String!, email: String!, avatar: String!): User!
changePassword(oldPassword: String!, newPassword: String!): Boolean!
terminateSession(sessionId: Int!): Boolean!
renameDevice(deviceId: Int!, name: String!): Device!
# Запрос на подтверждение email
requestEmailConfirmation: Boolean!
createChat(user1Id: Int!, user2Id: Int!): Chat!
sendMessage(chatId: Int!, content: String!): Message!
updateMessageStatus(messageId: Int!, status: MessageStatus!): Message!
# Подтверждение email по токену
confirmEmail(token: String!): Boolean!
# Повторная отправка подтверждения email
resendEmailConfirmation: Boolean!
deletePost(id: Int!): Boolean!
followUser(followingId: Int!): FollowResult!
unfollowUser(followingId: Int!): UnfollowResult!
markNotificationAsRead(notificationId: Int!): MarkNotificationReadResult!
createClip(title: String, video: Upload!): Clip! # Создать клип
deleteClip(id: Int!): Boolean! # Удалить клип
likeClip(clipId: Int!): ClipLike! # Лайкнуть клип
unlikeClip(clipId: Int!): Boolean! # Убрать лайк
createClipComment(clipId: Int!, content: String!): ClipComment! # Создать комментарий
deleteClipComment(commentId: Int!): Boolean! # Удалить комментарий
}
type Subscription {
messageStream(userId: Int!): Message!
clipCreated: Clip! # Новый клип создан
clipLiked(clipId: Int!): ClipLike! # Лайк поставлен клипу
commentClipCreated(clipId: Int!): ClipComment! # Новый комментарий к клипу
}