Skip to content

hsnice16/interview-experience-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

interview experience logo

✨ Interview Experience Backend

Backend for Interview Experience

Forks Stars GraphQL Node.JS TypeScript


👀 Query

1. Get all the blogs.
query Query {
  blogs {
    _id
    author {
      name
      profile
    }
    forOrganization
    link
    title
  }
}
2. Get all the blogs for an organization.
query Query($filter: BlogFilter) {
  blogs(filter: $filter) {
    author {
      name
      profile
    }
    _id
    forOrganization
    link
    title
  }
}

{
  "filter": {
    "forOrganization": "Google"
  }
}
3. Get paginated blogs.
query Query($limit: Int!, $offset: Int!) {
  blogs(limit: $limit, offset: $offset) {
    author {
      name
      profile
    }
    _id
    forOrganization
    link
    title
  }
}

{
  "limit": 4,
  "offset": 2
}
4. Get all the organizations.
query Query {
  organizations {
    _id
    blogCount
    name
  }
}
5. Get paginated organizations.
query Query($offset: Int!, $limit: Int!) {
  organizations(offset: $offset, limit: $limit) {
    _id
    blogCount
    name
  }
}

{
  "limit": 4,
  "offset": 2
}
6. Get staging blogs.
query Query($status: String!) {
  stagingBlogs(status: $status) {
    _id
    author {
      name
      profile
    }
    forOrganization
    status
    link
    title
  }
}

{
  "status": "pending"
}

🏗️ Mutation

1. Create a new blog.
mutation Mutation(
  $title: String!
  $link: String!
  $forOrganization: String!
  $author: NewAuthor!
) {
  createBlog(
    title: $title
    link: $link
    forOrganization: $forOrganization
    author: $author
  ) {
    _id
    status
    author {
      name
      profile
    }
    forOrganization
    link
    title
  }
}

{
  "title": "blog-title",
  "link": "blog-link",
  "forOrganization": "blog-forOrganization",
  "author": {
    "name": "author-name",
    "profile": "author-profile"
  }
}
2. Update the new blog status.
mutation Mutation($id: ID!, $status: String!) {
  updateBlogStatus(_id: $id, status: $status) {
    _id
    author {
      name
      profile
    }
    forOrganization
    link
    status
    title
  }
}

{
  "id": "new_blog_000",
  "status": "rejected"
}

🔌 Getting Started

  1. Clone the repository on your local machine with the command below in your terminal, and cd into the interview-experience-backend folder.
git clone https://github.com/hsnice16/interview-experience-backend.git

cd interview-experience-backend
  1. Install dependencies (if you are using yarn then do with that).
npm install
  1. Start the development server.
npm run watch