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

Create Posting CRUD Methods and GraphQL Resolvers #64

Merged
merged 21 commits into from
Dec 18, 2021

Conversation

albertlai431
Copy link
Contributor

@albertlai431 albertlai431 commented Dec 4, 2021

Ticket link

Closes #50

Implementation description

  • Implement CRUD methods:
    • getPosting
    • getPostings
    • createPosting
    • updatePosting
    • deletePosting
  • Create corresponding GraphQL resolvers and DTOs
  • Modified Postings Model in schema as requested in ticket and generated associated prisma migration file

Steps to test

  1. Start docker and run docker-compose up --build
  2. We need row(s) in the skills, branches, and employees tables for testing and will need to create those with raw SQL for now. Run the following commands:
docker exec -it sistering_db /bin/bash
psql -U postgres -d sistering
INSERT INTO branches (name) VALUES ('Branch1');
INSERT INTO skills (name) VALUES ('Skill1');
INSERT INTO employees (userId, branch_id) VALUES ('1','1');
  1. Run docker exec -it sistering_backend /bin/bash -c "npx prisma generate" and run the lastest migration files using npx prisma migrate deploy
  2. Go to http://localhost:5000/graphql and verify that all GraphQL queries and mutations introduced in this ticket work as expected

What should reviewers focus on?

  • Verify that GraphQL endpoints work as expected

Checklist

  • My PR name is descriptive and in imperative tense
  • My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits
  • I have run the appropriate linter(s)
  • I have requested a review from the PL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR

Copy link
Member

@sherryhli sherryhli left a comment

Choose a reason for hiding this comment

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

Looking good so far! Will do a second review once this set of comments is addressed

backend/types.ts Outdated Show resolved Hide resolved
backend/types.ts Outdated Show resolved Hide resolved
backend/services/implementations/postingService.ts Outdated Show resolved Hide resolved
backend/services/implementations/postingService.ts Outdated Show resolved Hide resolved
backend/services/implementations/postingService.ts Outdated Show resolved Hide resolved
backend/services/implementations/postingService.ts Outdated Show resolved Hide resolved
backend/services/implementations/postingService.ts Outdated Show resolved Hide resolved
backend/prisma/schema.prisma Show resolved Hide resolved
backend/prisma/schema.prisma Outdated Show resolved Hide resolved
@briantu briantu requested a review from sherryhli December 11, 2021 01:18
Copy link
Member

@sherryhli sherryhli left a comment

Choose a reason for hiding this comment

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

Almost there, just a couple of minor things left!

backend/services/implementations/postingService.ts Outdated Show resolved Hide resolved
backend/services/implementations/postingService.ts Outdated Show resolved Hide resolved
backend/services/implementations/postingService.ts Outdated Show resolved Hide resolved
backend/graphql/types/postingType.ts Outdated Show resolved Hide resolved
backend/graphql/types/postingType.ts Outdated Show resolved Hide resolved
backend/services/interfaces/IPostingService.ts Outdated Show resolved Hide resolved
backend/graphql/index.ts Outdated Show resolved Hide resolved
backend/prisma/schema.prisma Outdated Show resolved Hide resolved
backend/prisma/schema.prisma Show resolved Hide resolved
sherryhli
sherryhli previously approved these changes Dec 16, 2021
Copy link
Member

@sherryhli sherryhli left a comment

Choose a reason for hiding this comment

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

LGTM! 🚢
(please coordinate the order of merging with the rest of the team as described in Slack)

@sherryhli
Copy link
Member

Extra nit: can we rename these files to keep consistency with the other interface files?

backend/services/interfaces/IPostingService.ts -> backend/services/interfaces/postingService.ts
backend/services/interfaces/ISkillService.ts -> backend/services/interfaces/skillService.ts
backend/services/interfaces/IEntityService.ts -> backend/services/interfaces/entityService.ts

@albertlai431 albertlai431 merged commit 2425eb3 into main Dec 18, 2021
@albertlai431 albertlai431 deleted the albert-brian/posting-crud-resolvers branch December 18, 2021 18:31
sherryhli pushed a commit that referenced this pull request Jan 6, 2022
* Modify schema and create types

Co-authored-by: Brian Tu <brianptu2@gmail.com>

* Finish IPostingService interface

Co-authored-by: Brian Tu <brianptu2@gmail.com>

* add posting services and resolvers

* progress on posting service and types changes

* Modify schema and create types

Co-authored-by: Brian Tu <brianptu2@gmail.com>

* Finish IPostingService interface

Co-authored-by: Brian Tu <brianptu2@gmail.com>

* add posting services and resolvers

* progress on posting service and types changes

* finished posting service

* posting service changes

* Fix postingService errors
- fix types
- change to implicit relations and migration

Co-authored-by: Brian Tu <brianptu2@gmail.com>

* added PostingWithRelations type

* helper function cleanup

* pr review changes

* PR review changes part 2

* lint errors

* create migration file for unique skill names

* Rename interface files for consistency

Co-authored-by: Brian Tu <brianptu2@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create CRUD services and GraphQL resolvers for Postings
3 participants