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

#3124: first drafts of schema models #3127

Merged

Conversation

Zwendle
Copy link
Contributor

@Zwendle Zwendle commented Jan 19, 2025

Changes

Added models for cad review data structures

Notes

We are now using the pre-existing FAQ model for two different types of FAQs. Because of this, there are two relations in the organization model to two arrays of FAQs. This means every FAQ will have either a regularFaqOrg field or a partReviewFaqOrg field. This can't be enforced in prisma so it is enforced in the migration. The migration also changes the name of the primary key for the original faqs.

-- DropForeignKey
ALTER TABLE "FrequentlyAskedQuestion" DROP CONSTRAINT "FrequentlyAskedQuestion_organizationId_fkey";
ALTER TABLE "FrequentlyAskedQuestion" RENAME COLUMN "organizationId" TO "regularFaqOrgId";
ALTER TABLE "FrequentlyAskedQuestion" ADD COLUMN     "partReviewFaqOrgId" TEXT;
ALTER TABLE "FrequentlyAskedQuestion" ADD CONSTRAINT "FrequentlyAskedQuestion_regularFaqOrgId_fkey" FOREIGN KEY ("regularFaqOrgId") REFERENCES "Organization"("organizationId") ON DELETE SET NULL ON UPDATE CASCADE;
ALTER TABLE "FrequentlyAskedQuestion" ADD CONSTRAINT "FrequentlyAskedQuestion_partReviewFaqOrgId_fkey" FOREIGN KEY ("partReviewFaqOrgId") REFERENCES "Organization"("organizationId") ON DELETE SET NULL ON UPDATE CASCADE;
-- Add constriant so every faq is either a reulage faq or a part review faq
ALTER TABLE "FrequentlyAskedQuestion" ADD CONSTRAINT "at_least_one_field_required" CHECK ("regularFaqOrgId" IS NOT NULL OR "partReviewFaqOrgId" IS NOT NULL);

Checklist

It can be helpful to check the Checks and Files changed tabs.
Please review the contributor guide and reach out to your Tech Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.

  • All commits are tagged with the ticket number
  • No linting errors / newline at end of file warnings
  • All code follows repository-configured prettier formatting
  • No merge conflicts
  • All checks passing
  • Screenshots of UI changes (see Screenshots section)
  • Remove any non-applicable sections of this template
  • Assign the PR to yourself
  • No yarn.lock changes (unless dependencies have changed)
  • Request reviewers & ping on Slack
  • PR is linked to the ticket (fill in the closes line below)

Closes #3124

@Zwendle Zwendle requested review from gcooper407 and chpy04 January 19, 2025 16:49
@Zwendle Zwendle self-assigned this Jan 19, 2025
@chpy04 chpy04 force-pushed the #3124-create-cad-review-models branch from fffdd16 to d7e6e97 Compare January 20, 2025 15:32
@gcooper407 gcooper407 changed the base branch from develop to feature/cad-project-file-review January 22, 2025 23:57
@gcooper407 gcooper407 requested review from Peyton-McKee and walker-sean and removed request for Peyton-McKee January 23, 2025 00:03
Copy link
Contributor

@chpy04 chpy04 left a comment

Choose a reason for hiding this comment

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

LGTM

src/backend/src/prisma/schema.prisma Outdated Show resolved Hide resolved
src/backend/src/prisma/schema.prisma Outdated Show resolved Hide resolved
src/backend/src/prisma/schema.prisma Show resolved Hide resolved
src/backend/src/prisma/schema.prisma Outdated Show resolved Hide resolved
src/backend/src/prisma/schema.prisma Outdated Show resolved Hide resolved
src/backend/src/prisma/schema.prisma Outdated Show resolved Hide resolved
src/backend/src/prisma/schema.prisma Show resolved Hide resolved
src/backend/src/prisma/schema.prisma Outdated Show resolved Hide resolved
src/backend/src/prisma/schema.prisma Outdated Show resolved Hide resolved
src/backend/src/prisma/schema.prisma Outdated Show resolved Hide resolved
@chpy04 chpy04 requested a review from walker-sean January 24, 2025 19:45
src/backend/src/prisma/schema.prisma Outdated Show resolved Hide resolved
src/backend/src/prisma/schema.prisma Outdated Show resolved Hide resolved
src/backend/src/prisma/schema.prisma Outdated Show resolved Hide resolved
src/backend/src/prisma/schema.prisma Outdated Show resolved Hide resolved
src/backend/src/prisma/schema.prisma Outdated Show resolved Hide resolved
src/backend/src/prisma/schema.prisma Outdated Show resolved Hide resolved
src/backend/src/prisma/schema.prisma Show resolved Hide resolved
@chpy04 chpy04 requested a review from walker-sean January 25, 2025 18:03
@walker-sean walker-sean merged commit ad895f0 into feature/cad-project-file-review Jan 27, 2025
4 checks passed
@walker-sean walker-sean deleted the #3124-create-cad-review-models branch January 27, 2025 00:04
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.

[CAD Review] - Create/Update Part, Submission, Review, and Project Models
4 participants