Skip to content

Instantly share code, notes, and snippets.

@okomarov
Last active November 5, 2023 20:44
Show Gist options
  • Save okomarov/b1a9b369ff0f77d53c03c154cb0afa49 to your computer and use it in GitHub Desktop.
Save okomarov/b1a9b369ff0f77d53c03c154cb0afa49 to your computer and use it in GitHub Desktop.
Tangled schema
type User {
id: ID!
username: String!
email: String!
profile: Profile
settings: Settings
}
type Profile {
id: ID!
slug: String!
firstName: String
lastName: String
bio: String
avatar: String
}
type Settings {
id: ID!
notify: Boolean!
phoneNumber: String!
privacy: Privacy!
}
enum Privacy {
PUBLIC
PRIVATE
FRIENDS_ONLY
}
type Query {
user(id: ID!): User!
profile(id: ID!): Profile!
settings(id: ID!): Settings!
}
type Mutation {
user: UserMutations!
}
type UserMutations {
create(input: CreateUserInput!): User!
delete(id: ID!): User!
updateUsername(id: ID!, newUsername: String!): User!
updateEmail(id: ID!, newEmail: String!): User!
addProfile(id: ID!, input: CreateProfileInput!): Profile!
removeProfile(id: ID!): Profile!
updateFirstName(id: ID!, newFirstName: String!): Profile!
updateLastName(id: ID!, newLastName: String!): Profile!
updateBio(id: ID!, newBio: String!): Profile!
updateAvatar(id: ID!, newAvatar: String!): Profile!
addSettings(id: ID!, input: CreateSettingsInput!): Settings!
removeSettings(id: ID!): Settings!
updateNotify(id: ID!, newNotify: Boolean!): Settings!
updatePhoneNumber(id: ID!, newPhoneNumber: String!): Settings!
updatePrivacy(id: ID!, newPrivacy: Privacy!): Settings!
}
input CreateUserInput {
username: String!
email: String!
}
input CreateProfileInput {
slug: String!
firstName: String
lastName: String
bio: String
avatar: String
}
input CreateSettingsInput {
notify: Boolean!
phoneNumber: String!
privacy: Privacy = PRIVATE
}
type User {
id: ID!
username: String!
email: String!
profile: Profile
settings: Settings
}
type Profile {
id: ID!
slug: String!
firstName: String
lastName: String
bio: String
avatar: String
}
type Settings {
id: ID!
notify: Boolean!
phoneNumber: String!
privacy: Privacy!
}
enum Privacy {
PUBLIC
PRIVATE
FRIENDS_ONLY
}
type Query {
user(id: ID!): User!
profile(id: ID!): Profile!
settings(id: ID!): Settings!
}
type Mutation {
user: UserMutations!
profile: ProfileMutations!
settings: SettingsMutations!
}
type UserMutations {
create(input: CreateUserInput!): User!
update(id: ID!, input: UpdateUserInput!): User!
delete(id: ID!): User!
}
input CreateUserInput {
username: String!
email: String!
}
input UpdateUserInput {
username: String
email: String
}
type ProfileMutations {
create(input: CreateProfileInput!): Profile!
update(id: ID!, input: UpdateProfileInput!): Profile!
delete(id: ID!): Profile!
}
input CreateProfileInput {
slug: String!
firstName: String
lastName: String
bio: String
avatar: String
}
input UpdateProfileInput {
newSlug: String
newFirstName: String
newLastName: String
newBio: String
newAvatar: String
}
type SettingsMutations {
create(input: CreateSettingsInput!): Settings!
update(id: ID!, input: UpdateSettingsInput!): Settings!
delete(id: ID!): Settings!
}
input CreateSettingsInput {
notify: Boolean!
phoneNumber: String!
privacy: Privacy = PRIVATE
}
input UpdateSettingsInput {
newNotify: Boolean
newPhoneNumber: String
newPrivacy: Privacy
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment