Skip to content

Shiv1202/Q-A-API

Repository files navigation

question-mark

Question Answer Platfrom API

Overview

This is a backend APIs for a Question Answer Platfrom, where question and answers form various users captured.

Q-A-gif

Understanding the System

Entities for the system.

This platfrom would have the following high level entities, with following relationship among them. Boradly 1 entity should correspond to 1 table in Database.

  • Question: Core Entity of the platform.
  • Company: A Company for which question was asked(if any).
  • Topic: Topic for which a question was being asked eg: Data Structures, Algorithms.
  • SubTopic: A topic can have various subtopics Eg: For topic Data Structure, it can have subtopics like Stack, Queues, Lists etc.
  • Answer: A question can have multiple answers.
  • Answer_comments: User can comment on answer, hence an answer can have multiple comments.
  • Question_likes: User have rights to like a question.
  • Question_company_mapping: A question can be asked for many companies. For example, the same question may be asked by Amazon and Microsoft, To capture this information, we need to have this entity.
  • Answer_likes: User may like an answer to question. This data would be stored in this table.
  • Tags: Not all information can be captured using topic and subtopic, For example while subtopics can be Stacks, Queues and Lists, master list of tags may contain complexities of algorithms which could be O(n), O(logn) etc.
  • Question_tags: A Question can be associated with multiple tags. This table will contain this information.
  • Users: And finally the list of users who is posting Questions/Answers/Likes etc.

Various APIs

We are going to build following APIs.

  • CRUD APIs for all master data, which includes following entities/tables.
    • Company
    • Topic
    • Subtopics
    • Tags
  • /POST Questions
    • Input
      • Question Text- Mandatory, Min length 50 char, max length 500 char.
      • CompanyId - Optional
      • SubtopicID - Mandatory
      • Tags - List of tags(Optional)
      • UserId - the ID of user submitting the question.
    • Output
      • ID- id of the question saved in database.
  • /POST Answers
    • Input
      • Question ID - Question for which answer is being submitted
      • Answer text - Mandatory, Min length 50 char, Max length 500 char.
      • User ID - the IS of the user submitting answer.
    • Output
      • ID - ID of answer saved in database
  • /POST comments()post comments for a given answer.
    • Input
      • Answer ID - Answer for which comment is being posted - Mandatory.
      • User ID - User posting the comment - Mandatory
      • Comment Text - Comment text - Mandatory min length = 50char and max length = 500char
    • Output
      • ID - ID of comment saved in database.
  • /POST Question_likes(For a user to like a given question).
    • Input
      • Question ID - Question which is being liked.
      • User ID - Id of user liking th question
  • /POST Answer_likes(For a user to liking a given answer).
    • Input
      • Answer ID - Answer which is being liked.
      • User ID - Id of user liking th question
  • /GET Filter Question Return list of questions based on the combination of following query parameter.
    • Input
      • Companies - List of companies - Optional.
      • Subtopics - List of subtopics - Optional
      • Likes - Questions with more like than likes send as input - Optional
      • Date - Question asked after a given date.
      • Tags - List of tags - Optional.
    • Output
      • Question ID.
      • Question Text.
      • Companies - List of companies for which the question was asked.
      • Likes - No. of likes of the question.
      • Answer - Answer with most like for the given question.
      • Tags - Tags associated with the given question.
  • /GET Question Get following details of a question for a given question id.
    • Question Text
    • List of Answers for the given question with following details.
      • Answer Text
      • User Id of user who answered the question
      • Number of likes for the answer
      • List of all comments of the answer, along with the date and user who made the comment.
    • Number of likes that the question has
    • Companies for which the question was asked
    • Tags for the question
    • Topic for the question

About

This is a Question-Answer platform based api build in Django Rest-Framework(DRF).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages