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 ExerciseComment database table #2404

Merged
merged 11 commits into from
Oct 19, 2022

Conversation

HS-90
Copy link
Collaborator

@HS-90 HS-90 commented Oct 6, 2022

Description: relates to #2400

This PR creates the backend data structure in prisma/PostgreSQL.

This sets up the relational database between Discussions, Exercises, and Users. This also includes a self relation for the replies property.

@HS-90 HS-90 added enhancement New feature or request DB labels Oct 6, 2022
@vercel
Copy link

vercel bot commented Oct 6, 2022

@HS-90 is attempting to deploy a commit to the c0d3-prod Team on Vercel.

A member of the Team first needs to authorize it.

@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Discussion" ALTER COLUMN "userPic" DROP NOT NULL;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Setting userPic to not null, since not every user may have uploaded a profile picture

@codecov
Copy link

codecov bot commented Oct 6, 2022

Codecov Report

Merging #2404 (f62ccc2) into master (c0e1f96) will not change coverage.
The diff coverage is n/a.

❗ Current head f62ccc2 differs from pull request most recent head 9bacfc3. Consider uploading reports for the commit 9bacfc3 to get more accurate results

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #2404   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          185       185           
  Lines         3292      3292           
  Branches       874       888   +14     
=========================================
  Hits          3292      3292           

@@ -207,3 +209,19 @@ model ExerciseSubmission {

@@map("exerciseSubmissions")
}

model Discussion {
Copy link
Member

Choose a reason for hiding this comment

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

I'm a little bit confused by naming this table Discussion. Wouldn't Comment make more sense?

Copy link
Member

Choose a reason for hiding this comment

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

I feel Discussion refer to the feature whilst a Comment refer to the comments in the Discussion.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

image

Open to suggestions about naming it something different but there's already a Comment table.

Copy link
Member

Choose a reason for hiding this comment

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

What about DiscussionComment?

Copy link
Collaborator

@anthonykhoa anthonykhoa Oct 6, 2022

Choose a reason for hiding this comment

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

Lets finalize all these details before implementation. After implementing this model, we should not have to be touching this model in the backend anymore to finish implementing a MVP for the discussions flow

Copy link
Member

@flacial flacial Oct 6, 2022

Choose a reason for hiding this comment

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

Lets finalize all these details before implementation. After implementing this model, we should not have to be touching this model in the backend anymore to finish implementing a MVP for the discussions flow

What do you mean by "finalize"? And when is a design doc is considered complete?

Copy link
Collaborator

@anthonykhoa anthonykhoa Oct 7, 2022

Choose a reason for hiding this comment

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

If we are following a design doc, all of the architecture should be decided upon before implementation. By finalized details I mean complete design doc. What a complete design doc looks like will differ depending on what feature the design doc was made for. Here are good tips on design docs, it's also in our engineering practices
https://www.industrialempathy.com/posts/design-docs-at-google/

For this discussions flow design doc, enough should be outlined such that the backend and frontend can start work in parallel. If we are still deciding on how the backend should be setup, then that means the frontend can't be worked on yet since the frontend relies on how the backend is setup

@anthonykhoa
Copy link
Collaborator

Are we certain that this discussions table model in the backend will not have to be changed anymore in order to complete the Discussions flow?

@HS-90
Copy link
Collaborator Author

HS-90 commented Oct 6, 2022

Are we certain that this discussions table model in the backend will not have to be changed anymore in order to complete the Discussions flow?

I think we will have to add an isMain, but otherwise it has what we would need.
It has unique identifiers, self relation with the ability to nest responses, relational database with Exercise and User(author).

Although do we want the replies to automatically inherit the exerciseId from it's parent? Or is that something we would do with a resolver in GraphQL?

Also, would it be better to have a username property? Or just get the username from author(User)

@anthonykhoa
Copy link
Collaborator

anthonykhoa commented Oct 6, 2022

I think we will have to add an isMain, but otherwise it has what we would need. It has unique identifiers, self relation with the ability to nest responses, relational database with Exercise and User(author).

Although do we want the replies to automatically inherit the exerciseId from it's parent? Or is that something we would do with a resolver in GraphQL?

Also, would it be better to have a username property? Or just get the username from author(User)

Looks like the architecture hasn't been finalized yet. Let's get answers to all the open questions you have before implementation.

@vercel
Copy link

vercel bot commented Oct 14, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
c0d3-app ✅ Ready (Inspect) Visit Preview Oct 19, 2022 at 8:56PM (UTC)

prisma/schema.prisma Outdated Show resolved Hide resolved
prisma/schema.prisma Outdated Show resolved Hide resolved
Copy link
Member

@flacial flacial left a comment

Choose a reason for hiding this comment

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

Looks good to me. Apply the comments before merging.

@HS-90 HS-90 merged commit ccb6f47 into garageScript:master Oct 19, 2022
@flacial flacial changed the title Create Discussions table in Prisma Create ExerciseComment table in Prisma Oct 23, 2022
@flacial flacial changed the title Create ExerciseComment table in Prisma Create ExerciseComment database table Oct 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DB enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants