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

GET cohort by id #41

Merged
merged 16 commits into from
Apr 1, 2020
Merged

GET cohort by id #41

merged 16 commits into from
Apr 1, 2020

Conversation

Mu7ammadAbed
Copy link
Member

I created query function which search for cohort based on id which came from params, and I created the necessary middleware for this function to work in addition to handling the required /cohort/:cohortid route

Relates #19

I created query function which search for cohort based on id which came from params, and I created the necessary middleware for this function to work in addition to handling the required /cohort/:cohortid route

Relates #19
I created query function which search for cohort based on id which came from params, and I created the necessary middleware for this function to work in addition to handling the required /cohort/:cohortid route

Relates #19
@Mu7ammadAbed Mu7ammadAbed marked this pull request as ready for review March 29, 2020 00:36
@Mu7ammadAbed Mu7ammadAbed added Awaiting Review This PR is ready and waiting for review and removed in progress labels Mar 29, 2020
@ranasobeid95 ranasobeid95 changed the title 19 get chortid GET cohort by id Mar 29, 2020
@ranasobeid95 ranasobeid95 added Changes Requested This PR has some mandatory changes to be done in order for it to be accepted and removed Awaiting Review This PR is ready and waiting for review labels Mar 29, 2020
test/index.test.js Outdated Show resolved Hide resolved
server/controllers/index.js Outdated Show resolved Hide resolved
server/controllers/routes/user/cohort/getSpecificCohort.js Outdated Show resolved Hide resolved
server/controllers/routes/user/cohort/getSpecificCohort.js Outdated Show resolved Hide resolved
test/index.test.js Outdated Show resolved Hide resolved
test/index.test.js Outdated Show resolved Hide resolved
test/index.test.js Outdated Show resolved Hide resolved
@Mu7ammadAbed Mu7ammadAbed added Awaiting Review This PR is ready and waiting for review and removed Changes Requested This PR has some mandatory changes to be done in order for it to be accepted labels Mar 29, 2020
@@ -0,0 +1,21 @@
const {
cohort: { getSpecificCohort },
Copy link
Member

@MohammedAlghazali MohammedAlghazali Mar 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest making destructure of getSpecificCohort in /database/queries/index as :

const { getSpecificCohort } = require('./cohort');

module.exports = { getSpecificCohort };

as you make in server/database/queries/cohort/index.js file,

and here in this file you can make require to getSpecificCohort as

Suggested change
cohort: { getSpecificCohort },
const { getSpecificCohort } = require('../../../../database/queries');

so we get more benefit from /database/queries/index file.

Copy link
Member

@MohammedAlghazali MohammedAlghazali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I Add a comment in server/controllers/routes/user/cohort/getSpecificCohort.js and in
server/controllers/index.js
note that destructure point exists in more than one file

@MohammedAlghazali MohammedAlghazali mentioned this pull request Mar 31, 2020
@MohammedAlghazali MohammedAlghazali added Changes Requested This PR has some mandatory changes to be done in order for it to be accepted and removed Awaiting Review This PR is ready and waiting for review labels Mar 31, 2020
@Mu7ammadAbed Mu7ammadAbed added Awaiting Review This PR is ready and waiting for review and removed Changes Requested This PR has some mandatory changes to be done in order for it to be accepted labels Mar 31, 2020

const app = require('../server/app');

beforeAll(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need return here 😉

Suggested change
beforeAll(() => {
beforeAll(() => dbBuild());

} catch (err) {
res.status(404).json({
statusCode: 404,
message: "Sorry There's no cohort for this id",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we need to handle server error

AlaaSaadeddin
AlaaSaadeddin previously approved these changes Mar 31, 2020
@ranasobeid95 ranasobeid95 merged commit 29c7014 into master Apr 1, 2020
@ranasobeid95 ranasobeid95 deleted the 19-GET-chortid branch April 1, 2020 09:56
@ranasobeid95 ranasobeid95 added Done and removed Awaiting Review This PR is ready and waiting for review labels Apr 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants