go-mongo/gql/todo.gql
2025-05-31 18:38:18 +03:00

38 lines
613 B
GraphQL

type Todo implements Base {
id: ID!
title: String
completed: Boolean
createdAt: Time!
updatedAt: Time!
"#bson:ignore"
createdBy: User! @goField(forceResolver: true)
createdById: ID!
"#bson:ignore"
updatedBy: User! @goField(forceResolver: true)
updatedById: ID!
"#bson:ignore"
owner: User @goField(forceResolver: true)
ownerId: ID!
}
input CreateTodoInput {
title: String!
completed: Boolean = false
}
extend type Mutation {
createTodo(input: CreateTodoInput!): Todo
}
extend type Query {
todos: [Todo]
todo(id: ID!): Todo
}
extend type Subscription {
onTodo: Todo
}