merged-isolated-core
Some checks failed
deploy / deploy (push) Failing after 1m46s

This commit is contained in:
2023-10-23 17:47:11 +03:00
parent b675188013
commit bf241a8fbd
56 changed files with 1683 additions and 2784 deletions

242
schemas/auth.graphql Normal file
View File

@@ -0,0 +1,242 @@
scalar Dict
type ConfigType {
authorizerURL: String!
redirectURL: String!
clientID: String!
extraHeaders: [Header]
}
type User {
id: ID!
email: String!
preferred_username: String!
email_verified: Boolean!
signup_methods: String!
given_name: String
family_name: String
middle_name: String
nickname: String
picture: String
gender: String
birthdate: String
phone_number: String
phone_number_verified: Boolean
roles: [String]
created_at: Int!
updated_at: Int!
is_multi_factor_auth_enabled: Boolean
}
type AuthToken {
message: String
access_token: String!
expires_in: Int!
id_token: String!
refresh_token: String
user: User
should_show_email_otp_screen: Boolean
should_show_mobile_otp_screen: Boolean
}
type Response {
message: String!
}
type Header {
key: String!
value: String!
}
input HeaderIn {
key: String!
value: String!
}
input LoginInput {
email: String!
password: String!
roles: [String]
scope: [String]
state: String
}
input SignupInput {
email: String!
password: String!
confirm_password: String!
given_name: String
family_name: String
middle_name: String
nickname: String
picture: String
gender: String
birthdate: String
phone_number: String
roles: [String]
scope: [String]
redirect_uri: String
is_multi_factor_auth_enabled: Boolean
state: String
}
input MagicLinkLoginInput {
email: String!
roles: [String]
scopes: [String]
state: String
redirect_uri: String
}
input VerifyEmailInput {
token: String!
state: String
}
input VerifyOtpInput {
email: String
phone_number: String
otp: String!
state: String
}
input ResendOtpInput {
email: String
phone_number: String
}
input GraphqlQueryInput {
query: String!
variables: Dict
headers: [HeaderIn]
}
type MetaData {
version: String!
client_id: String!
is_google_login_enabled: Boolean!
is_facebook_login_enabled: Boolean!
is_github_login_enabled: Boolean!
is_linkedin_login_enabled: Boolean!
is_apple_login_enabled: Boolean!
is_twitter_login_enabled: Boolean!
is_microsoft_login_enabled: Boolean!
is_email_verification_enabled: Boolean!
is_basic_authentication_enabled: Boolean!
is_magic_link_login_enabled: Boolean!
is_sign_up_enabled: Boolean!
is_strong_password_enabled: Boolean!
}
input UpdateProfileInput {
old_password: String
new_password: String
confirm_new_password: String
email: String
given_name: String
family_name: String
middle_name: String
nickname: String
gender: String
birthdate: String
phone_number: String
picture: String
is_multi_factor_auth_enabled: Boolean
}
input ForgotPasswordInput {
email: String!
state: String
redirect_uri: String
}
input ResetPasswordInput {
token: String!
password: String!
confirm_password: String!
}
input SessionQueryInput {
roles: [String]
}
input IsValidJWTQueryInput {
jwt: String!
roles: [String]
}
type ValidJWTResponse {
valid: String!
message: String!
}
enum OAuthProviders {
Apple
Github
Google
Facebook
LinkedIn
}
enum ResponseTypes {
Code
Token
}
input AuthorizeInput {
response_type: ResponseTypes!
use_refresh_token: Boolean
response_mode: String
}
type AuthorizeResponse {
state: String!
code: String
error: String
error_description: String
}
input RevokeTokenInput {
refresh_token: String!
}
input GetTokenInput {
code: String
grant_type: String
refresh_token: String
}
type GetTokenResponse {
access_token: String!
expires_in: Int!
id_token: String!
refresh_token: String
}
input ValidateJWTTokenInput {
token_type: TokenType!
token: String!
roles: [String]
}
type ValidateJWTTokenResponse {
is_valid: Boolean!
claims: Dict
}
input ValidateSessionInput {
cookie: String
roles: [String]
}
type ValidateSessionResponse {
is_valid: Boolean!
user: User
}
enum TokenType {
access_token
id_token
refresh_token
}

View File

@@ -1,48 +1,181 @@
# Скалярные типы данных
scalar DateTime
type _Service {
sdl: String
# Перечисления
enum ShoutVisibility {
AUTHORS
COMMUNITY
PUBLIC
}
################################### Payload ###################################
type UserFollowings {
unread: Int
topics: [String]
authors: [String]
reactions: [Int]
communities: [String]
enum ReactionStatus {
NEW
UPDATED
CHANGED
EXPLAINED
DELETED
}
type AuthResult {
error: String
token: String
user: User
news: UserFollowings
enum ReactionKind {
LIKE
DISLIKE
AGREE
DISAGREE
PROOF
DISPROOF
COMMENT
QUOTE
PROPOSE
ASK
REMARK
FOOTNOTE
ACCEPT
REJECT
}
enum FollowingEntity {
TOPIC
AUTHOR
COMMUNITY
REACTIONS
}
# Входные типы
input ShoutInput {
slug: String
title: String
body: String
lead: String
description: String
layout: String
media: String
authors: [String]
topics: [TopicInput]
community: Int
mainTopic: TopicInput
subtitle: String
cover: String
}
input ProfileInput {
slug: String
name: String
userpic: String
links: [String]
bio: String
about: String
}
input TopicInput {
id: Int
slug: String!
title: String
body: String
pic: String
}
input ReactionInput {
kind: ReactionKind!
shout: Int!
range: String
body: String
replyTo: Int
}
input AuthorsBy {
lastSeen: DateTime
createdAt: DateTime
slug: String
name: String
topic: String
order: String
days: Int
stat: String
}
input ShoutsFilterBy {
slug: String
title: String
body: String
topic: String
topics: [String]
author: String
authors: [String]
layout: String
visibility: String
days: Int
stat: String
}
input LoadShoutsFilters {
title: String
body: String
topic: String
author: String
layout: String
visibility: String
days: Int
reacted: Boolean
}
input LoadShoutsOptions {
filters: LoadShoutsFilters
with_author_captions: Boolean
limit: Int!
offset: Int
order_by: String
order_by_desc: Boolean
}
input ReactionBy {
shout: String
shouts: [String]
search: String
comment: Boolean
topic: String
createdBy: String
days: Int
sort: String
}
# Типы
type AuthorFollowings {
unread: Int
topics: [String]
authors: [String]
reactions: [Int]
communities: [String]
}
type AuthorStat {
followings: Int
followers: Int
rating: Int
commented: Int
shouts: Int
followings: Int
followers: Int
rating: Int
commented: Int
shouts: Int
}
type Author {
id: Int!
slug: String!
name: String!
userpic: String
caption: String # only for full shout
bio: String
about: String
links: [String]
stat: AuthorStat
roles: [Role] # in different communities
lastSeen: DateTime
createdAt: DateTime
id: Int!
user: Int!
slug: String!
name: String
communities: [Community]
userpic: String
caption: String
bio: String
about: String
links: [String]
stat: AuthorStat
lastSeen: DateTime
}
type Result {
@@ -60,364 +193,149 @@ type Result {
communities: [Community]
}
enum ReactionStatus {
NEW
UPDATED
CHANGED
EXPLAINED
DELETED
}
type ReactionUpdating {
error: String
status: ReactionStatus
reaction: Reaction
}
################################### Inputs ###################################
input ShoutInput {
slug: String
title: String
body: String
lead: String
description: String
layout: String
media: String
authors: [String]
topics: [TopicInput]
community: Int
mainTopic: TopicInput
subtitle: String
cover: String
}
input ProfileInput {
slug: String
name: String
userpic: String
links: [String]
bio: String
about: String
}
input TopicInput {
id: Int,
slug: String!
# community: String!
title: String
body: String
pic: String
# children: [String]
# parents: [String]
}
input ReactionInput {
kind: ReactionKind!
shout: Int!
range: String
body: String
replyTo: Int
}
enum FollowingEntity {
TOPIC
AUTHOR
COMMUNITY
REACTIONS
}
################################### Mutation
type Mutation {
# auth
getSession: AuthResult!
registerUser(email: String!, password: String, name: String): AuthResult!
sendLink(email: String!, lang: String, template: String): Result!
confirmEmail(token: String!): AuthResult!
# shout
createShout(inp: ShoutInput!): Result!
updateShout(shout_id: Int!, shout_input: ShoutInput, publish: Boolean): Result!
deleteShout(shout_id: Int!): Result!
# user profile
rateUser(slug: String!, value: Int!): Result!
updateProfile(profile: ProfileInput!): Result!
# topics
createTopic(input: TopicInput!): Result!
# TODO: mergeTopics(t1: String!, t2: String!): Result!
updateTopic(input: TopicInput!): Result!
destroyTopic(slug: String!): Result!
# reactions
createReaction(reaction: ReactionInput!): Result!
updateReaction(id: Int!, reaction: ReactionInput!): Result!
deleteReaction(id: Int!): Result!
# following
follow(what: FollowingEntity!, slug: String!): Result!
unfollow(what: FollowingEntity!, slug: String!): Result!
}
input AuthorsBy {
lastSeen: DateTime
createdAt: DateTime
slug: String
name: String
topic: String
order: String
days: Int
stat: String
}
input LoadShoutsFilters {
title: String
body: String
topic: String
author: String
layout: String
excludeLayout: String
visibility: String
days: Int
reacted: Boolean
}
input LoadShoutsOptions {
filters: LoadShoutsFilters
with_author_captions: Boolean
limit: Int!
offset: Int
order_by: String
order_by_desc: Boolean
}
input ReactionBy {
shout: String # slug
shouts: [String]
search: String # fts on body
comment: Boolean
topic: String # topic.slug
createdBy: String # user.slug
days: Int # before
sort: String # how to sort, default createdAt
}
type Query {
# auth
isEmailUsed(email: String!): Boolean!
signIn(email: String!, password: String, lang: String): AuthResult!
signOut: AuthResult!
# zine
loadAuthorsBy(by: AuthorsBy, limit: Int, offset: Int): [Author]!
loadShout(slug: String, shout_id: Int): Shout
loadShouts(options: LoadShoutsOptions): [Shout]!
loadDrafts: [Shout]!
loadReactionsBy(by: ReactionBy!, limit: Int, offset: Int): [Reaction]!
userFollowers(slug: String!): [Author]!
userFollowedAuthors(slug: String!): [Author]!
userFollowedTopics(slug: String!): [Topic]!
authorFollowers(author_id: Int!, limit: Int, offset: Int): [Author]!
authorFollowings(author_id: Int!, limit: Int, offset: Int): [Author]!
authorsAll: [Author]!
getAuthorById(author_id: Int!): Author
getAuthor(slug: String!): Author
myFeed(options: LoadShoutsOptions): [Shout]
# migrate
markdownBody(body: String!): String!
# topics
getTopic(slug: String!): Topic
topicsAll: [Topic]!
topicsRandom(amount: Int): [Topic]!
topicsByCommunity(community: String!): [Topic]!
topicsByAuthor(author: String!): [Topic]!
# Apollo SDL
_service: _Service!
}
############################################ Entities
type Resource {
id: Int!
name: String!
}
type Operation {
id: Int!
name: String!
}
type Permission {
operation: Int!
resource: Int!
}
type Role {
id: Int!
name: String!
community: String!
desc: String
permissions: [Permission!]!
error: String
status: ReactionStatus
reaction: Reaction
}
type Rating {
rater: String!
value: Int!
}
type User {
id: Int!
username: String! # to login, ex. email, phone
createdAt: DateTime!
lastSeen: DateTime
slug: String!
name: String # to display
email: String
password: String
oauth: String # provider:token
userpic: String
links: [String]
emailConfirmed: Boolean # should contain all emails too
muted: Boolean
updatedAt: DateTime
ratings: [Rating]
bio: String
about: String
communities: [Int] # user participating communities
oid: String
}
enum ReactionKind {
LIKE
DISLIKE
AGREE
DISAGREE
PROOF
DISPROOF
COMMENT
QUOTE
PROPOSE
ASK
REMARK
FOOTNOTE
ACCEPT
REJECT
rater: String!
value: Int!
}
type Reaction {
id: Int!
shout: Shout!
createdAt: DateTime!
createdBy: User!
updatedAt: DateTime
deletedAt: DateTime
deletedBy: User
range: String # full / 0:2340
kind: ReactionKind!
body: String
replyTo: Int
stat: Stat
old_id: String
old_thread: String
id: Int!
shout: Shout!
createdAt: DateTime!
createdBy: Author!
updatedAt: DateTime
deletedAt: DateTime
deletedBy: Author
range: String
kind: ReactionKind!
body: String
replyTo: Int
stat: Stat
old_id: String
old_thread: String
}
# is publication
type Shout {
id: Int!
slug: String!
body: String!
lead: String
description: String
createdAt: DateTime!
topics: [Topic]
mainTopic: String
title: String
subtitle: String
authors: [Author]
lang: String
community: String
cover: String
layout: String # music video literature image
versionOf: String # for translations and re-telling the same story
visibility: String # owner authors community public
updatedAt: DateTime
updatedBy: User
deletedAt: DateTime
deletedBy: User
publishedAt: DateTime
media: String # json [ { title pic url body }, .. ]
stat: Stat
id: Int!
slug: String!
body: String!
lead: String
description: String
createdAt: DateTime!
topics: [Topic]
authors: [Author]
communities: [Community]
mainTopic: String
title: String
subtitle: String
lang: String
community: String
cover: String
layout: String
versionOf: String
visibility: ShoutVisibility
updatedAt: DateTime
updatedBy: Author
deletedAt: DateTime
deletedBy: Author
publishedAt: DateTime
media: String
stat: Stat
}
type Stat {
viewed: Int
reacted: Int
rating: Int
commented: Int
ranking: Int
viewed: Int
reacted: Int
rating: Int
commented: Int
ranking: Int
}
type Community {
id: Int!
slug: String!
name: String!
desc: String
pic: String!
createdAt: DateTime!
createdBy: User!
id: Int!
slug: String!
name: String!
desc: String
pic: String!
createdAt: DateTime!
createdBy: Author!
}
type Collection {
id: Int!
slug: String!
title: String!
desc: String
amount: Int
publishedAt: DateTime
createdAt: DateTime!
createdBy: User!
id: Int!
slug: String!
title: String!
desc: String
amount: Int
publishedAt: DateTime
createdAt: DateTime!
createdBy: Author!
}
type TopicStat {
shouts: Int!
followers: Int!
authors: Int!
# viewed: Int
# reacted: Int!
# commented: Int
# rating: Int
shouts: Int!
followers: Int!
authors: Int!
}
type Topic {
id: Int!
slug: String!
title: String
body: String
pic: String
# community: Community!
stat: TopicStat
oid: String
id: Int!
slug: String!
title: String
body: String
pic: String
stat: TopicStat
oid: String
}
type Token {
createdAt: DateTime!
expiresAt: DateTime
id: Int!
ownerId: Int!
usedAt: DateTime
value: String!
# Мутации
type Mutation {
createShout(inp: ShoutInput!): Result!
updateShout(shout_id: Int!, shout_input: ShoutInput, publish: Boolean): Result!
deleteShout(shout_id: Int!): Result!
rateAuthor(slug: String!, value: Int!): Result!
updateOnlineStatus: Result!
updateProfile(profile: ProfileInput!): Result!
createTopic(input: TopicInput!): Result!
updateTopic(input: TopicInput!): Result!
destroyTopic(slug: String!): Result!
createReaction(reaction: ReactionInput!): Result!
updateReaction(id: Int!, reaction: ReactionInput!): Result!
deleteReaction(id: Int!): Result!
follow(what: FollowingEntity!, slug: String!): Result!
unfollow(what: FollowingEntity!, slug: String!): Result!
}
# Запросы
type Query {
loadShout(slug: String, shout_id: Int): Shout
loadShouts(options: LoadShoutsOptions): [Shout]
loadFeed(options: LoadShoutsOptions): [Shout]
loadDrafts: [Shout]
loadReactionsBy(by: ReactionBy!, limit: Int, offset: Int): [Reaction]
followedReactions(follower_id: Int!): [Shout]
authorFollowers(slug: String!): [Author]
authorFollowedAuthors(slug: String!): [Author]
authorFollowedTopics(slug: String!): [Topic]
loadAuthorsBy(by: AuthorsBy, limit: Int, offset: Int): [Author]
authorsAll: [Author]
getAuthor(slug: String!): Author
getTopic(slug: String!): Topic
topicsAll: [Topic]
topicsRandom(amount: Int): [Topic]
topicsByCommunity(community: String!): [Topic]
topicsByAuthor(author_id: Int!): [Topic]
}