-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Azanul <azanulhaque@gmail.com>
- Loading branch information
Showing
12 changed files
with
2,076 additions
and
1,280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# GraphQL schema example | ||
# | ||
# https://gqlgen.com/getting-started/ | ||
|
||
type Movie { | ||
id: ID! | ||
title: String! | ||
genre: String! | ||
year: Int! | ||
wiki: String! | ||
plot: String! | ||
cast: String! | ||
} | ||
|
||
type User { | ||
id: ID! | ||
email: String! | ||
passwordHash: String! | ||
} | ||
|
||
type Rating { | ||
id: ID! | ||
userId: ID! | ||
movieId: ID! | ||
score: Int! | ||
} | ||
|
||
type Query { | ||
movie(id: ID!): Movie | ||
movies: [Movie!]! | ||
recommendations(userId: ID!): [Movie!]! | ||
ratings(userId: ID!): [Rating!]! | ||
|
||
# Admin-only queries | ||
allUsers: [User!]! @hasRole(role: ADMIN) | ||
allRatings: [Rating!]! @hasRole(role: ADMIN) | ||
user(id: ID!): User @hasRole(role: ADMIN) | ||
} | ||
|
||
type Mutation { | ||
rateMovie(movieId: ID!, rating: Int!): Rating! | ||
updateRating(id: ID!, score: Int!): Rating! | ||
deleteRating(id: ID!): Boolean! | ||
|
||
# Admin-only mutations | ||
createMovie(input: MovieInput!): Movie! @hasRole(role: ADMIN) | ||
updateMovie(id: ID!, input: MovieInput!): Movie! @hasRole(role: ADMIN) | ||
deleteMovie(id: ID!): Boolean! @hasRole(role: ADMIN) | ||
|
||
createUser(username: String!, email: String!, password: String!): User! @hasRole(role: ADMIN) | ||
updateUser(id: ID!, username: String, email: String): User! @hasRole(role: ADMIN) | ||
deleteUser(id: ID!): Boolean! @hasRole(role: ADMIN) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,17 @@ | ||
module github.com/Azanul/Next-Watch | ||
|
||
go 1.15 | ||
go 1.22.7 | ||
|
||
require ( | ||
github.com/99designs/gqlgen v0.13.0 | ||
github.com/vektah/gqlparser/v2 v2.1.0 | ||
go.mongodb.org/mongo-driver v1.7.1 | ||
github.com/99designs/gqlgen v0.17.53 | ||
github.com/vektah/gqlparser/v2 v2.5.16 | ||
) | ||
|
||
require ( | ||
github.com/agnivade/levenshtein v1.1.1 // indirect | ||
github.com/google/uuid v1.6.0 // indirect | ||
github.com/gorilla/websocket v1.5.0 // indirect | ||
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect | ||
github.com/mitchellh/mapstructure v1.5.0 // indirect | ||
github.com/sosodev/duration v1.3.1 // indirect | ||
) |
Oops, something went wrong.