Skip to content

Commit

Permalink
feat: regen graphql server
Browse files Browse the repository at this point in the history
Signed-off-by: Azanul <azanulhaque@gmail.com>
  • Loading branch information
Azanul committed Sep 19, 2024
1 parent 05bd357 commit c2b1485
Show file tree
Hide file tree
Showing 12 changed files with 2,076 additions and 1,280 deletions.
53 changes: 53 additions & 0 deletions schema.graphqls
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)
}
15 changes: 0 additions & 15 deletions server/Dockerfile

This file was deleted.

97 changes: 0 additions & 97 deletions server/db/db.go

This file was deleted.

16 changes: 12 additions & 4 deletions server/go.mod
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
)
Loading

0 comments on commit c2b1485

Please sign in to comment.