Skip to content

Built a Full stack Typescript project with GraphQL, PostgreSQL, Typeorm, Chakra UI, Redis and so much more. Users can Login and Register to access the full functionalities of the website. Users can upvote and downvote a particular post. Check it out!

Notifications You must be signed in to change notification settings

ChuksJoshuaa/Reddit-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

Reddit Full Stack Typescript Application

icon.

GraphQL Queries & Mutations

Queries

Get all posts

query Posts($limit: Int!, $cursor: String) {
  posts(cursor: $cursor, limit: $limit) {
    hasMore
    posts {
      id
      title
      points
      descriptionSnippet
      createdAt
      updatedAt
      voteStatus
      author {
        id
        username
        email
      }
    }
  }
}

Get a single post

query Post($id: Int!) {
  post(id: $id) {
    id
    title
    description
    authorId
    points
    createdAt
    updatedAt
  }
}

Get user

query Me {
  me {
    id
    username
  }
}

##Mutations

Create a new post

mutation CreatePost($input: PostInput!) {
  createPost(input: $input) {
    id
    title
    description
    authorId
    points
    createdAt
    updatedAt
  }
}

Update a post

mutation UpdatePost(
  $id: Int!
  $authorId: Int!
  $title: String!
  $description: String!
) {
  updatePost(
    id: $id
    authorId: $authorId
    title: $title
    description: $description
  ) {
    id
    title
    description
    descriptionSnippet
  }
}

Delete Post

mutation DeletePost($id: Int!, $authorId: Int!) {
  deletePost(id: $id, authorId: $authorId)
}

Login


mutation Login($email: String!, $password: String!) {
  login(email: $email, password: $password) {
    errors {
      field
      message
    }
    user{
      id
      username
      email
      createdAt
    }
  }
}


Register

mutation Register($email: String!, $username: String!, $password: String!) {
  register(
    options: { email: $email, username: $username, password: $password }
  ) {
     errors {
      field
      message
    }
    user{
      id
      username
      email
    }
  }
}


Logout

mutation Logout {
  logout
}

vote

mutation Vote($value: Int!, $postId: Int!) {
  vote(value: $value, postId: $postId)
}

Forgot Password

mutation ForgotPassword($email: String!) {
  forgotPassword(email: $email)
}

Change Password

mutation ChangePassword($token: String!, $newPassword: String!) {
  changePassword(token: $token, newPassword: $newPassword) {
     errors {
      field
      message
    }
    user{
      id
      username
      email
    }
  }
}

About

Built a Full stack Typescript project with GraphQL, PostgreSQL, Typeorm, Chakra UI, Redis and so much more. Users can Login and Register to access the full functionalities of the website. Users can upvote and downvote a particular post. Check it out!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published