Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backend Issue Template #2

Open
Mu7ammadAbed opened this issue Oct 11, 2022 · 1 comment
Open

Backend Issue Template #2

Mu7ammadAbed opened this issue Oct 11, 2022 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@Mu7ammadAbed
Copy link
Contributor

#[relates1] #[relates1]
[Unit name]

Acceptance Criteria

  • crit1
  • crit2
  • ..
  • ..

crit1

[Full Description ]

crit2

[Full Description]


@Mu7ammadAbed Mu7ammadAbed added the documentation Improvements or additions to documentation label Oct 11, 2022
@Mu7ammadAbed
Copy link
Contributor Author

Mu7ammadAbed commented Oct 11, 2022

POST /api/v1/teacher/quiz

Description

Through this route, a new quiz will be added to the database with its questions and answers

Acceptance Criteria

  • DB query
  • Request
  • Response
  • Testing

DB query

  • createQuizQuery({ teacher_id, title, descriptoin, mark, time })
  • createQuestionQuery({ quiz_id, question, type, answers })
INSERT INTO quizzes (teacher_id, title, descriptoin, mark, time) VALUES ($1, $2, $3, $4, $5);
INSERT INTO questions (quiz_id, question, type, answers) VALUES ($1, $2, $3, $4);

Request Body

{
  title: string,
  description: string,
  mark: number,
  time: number,
  questions: [
    {
      question: string,
      type: 'mcq' | 'short_answer' | 'true_false',
      answers: [{ answer: string, is_correct: boolean }, ...]
    }, ...
  ]
}

and teacherId from token

Response 201

{
  data: { quiz }
  message: 'Quiz Created Successfully'
}

Testing

Success: 200

{
  message: 'Quiz Created Successfully'
}

Fail: 401

{
  message: 'Unauthorized'
}

@Mu7ammadAbed Mu7ammadAbed pinned this issue Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant