-
Notifications
You must be signed in to change notification settings - Fork 49
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
add helpUsImprove field to the backend #615
add helpUsImprove field to the backend #615
Conversation
✅ Tests will run for this PR. Once they succeed it can be merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job!
When changing the prisma schema in order for those changes to be implemented in the database we need to run yarn prisma migrate dev
. This command will automatically generate the SQL query to add the help_us_improve field to the persons table, as well as auto-generating the changes for the Prisma Client.
Once yarn prisma migrate dev
is finished, execute yarn format
, which will run prettier on all generated.
So in summary:
- Run
yarn prisma migrate dev
to generate the SQL query which updates the person table - Run
yarn format
- to prettify the generated Prisma clients. - Commit the changes.
If you have further questions regarding the requested changes, feel free to contact me.
schema.prisma
Outdated
@@ -40,6 +40,7 @@ model Person { | |||
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6) | |||
// Receive marketing notifications | |||
newsletter Boolean? @default(false) | |||
helpUsImporve Boolean? @default(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo. Change to helpUsImprove
We use snake_case for referencing a field via raw SQL query. Would you please add @Map("help_us_improve") at the end of this line.
Example:
helpUsImporve Boolean? @default(false) @map("help_us_improve")
schema.prisma
Outdated
@@ -40,6 +40,7 @@ model Person { | |||
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6) | |||
// Receive marketing notifications | |||
newsletter Boolean? @default(false) | |||
helpUsImporve Boolean? @default(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the typo, as well as add @map("help_us_improve")
, as we use snake_case for referencing db fields directly
helpUsImporve Boolean? @default(false) @map("help_us_improve")
Then re-execute the yarn prisma migrate dev
and yarn format
Edit: Linter is failing due to missing field field in personMock.
After you fix the above typo, please add helpUsImprove field to the personMock.ts
Should I delete the previous migration?
На пн, 18.03.2024 г. в 14:01 Aleksandar Petkov ***@***.***>
написа:
… ***@***.**** requested changes on this pull request.
------------------------------
In schema.prisma
<#615 (comment)>:
> @@ -40,6 +40,7 @@ model Person {
updatedAt DateTime? @updatedAt @Map("updated_at") @db.Timestamptz(6)
// Receive marketing notifications
newsletter Boolean? @default(false)
+ helpUsImporve Boolean? @default(false)
Please fix the typo, as well as add @Map("help_us_improve"), as we use
snake_case for referencing db fields directly
helpUsImporve Boolean? @default(false) @Map("help_us_improve")
Then re-execute the yarn prisma migrate dev and yarn format
—
Reply to this email directly, view it on GitHub
<#615 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BDTQ7QAMKIAKJ4RDPAXGY7DYY3JSBAVCNFSM6AAAAABE2J2UI2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTSNBSG43DCOJVGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
It would be best if you can. As it will keep the migration folder more tidier. Please fix the typo, as well as add helpUsImprove Boolean? @default(false) @map("help_us_improve") Then re-execute the |
Hmm. apparently I forgot to tell you to add the following line: helpUsImprove: registerDto.helpUsImprove ? registerDto.helpUsImprove : false to the person.upsert method here. Do yo mind adding it? Sorry for that. |
Do I need to run new migrations or is it just that?
На пн, 18.03.2024 г. в 19:19 Aleksandar Petkov ***@***.***>
написа:
… Hmm. apparently I forgot to tell you to add the following line:
helpUsImprove: registerDto.helpUsImprove ? registerDto.helpUsImprove : false
to the person.upsert method here
<https://github.com/podkrepi-bg/api/blob/master/apps/api/src/auth/auth.service.ts#L295>.
Do yo mind adding it? Sorry for that.
—
Reply to this email directly, view it on GitHub
<#615 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/BDTQ7QBH5O73GYSGC3Q3C4DYY4O2XAVCNFSM6AAAAABE2J2UI2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBUGUYDMOBXGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Just that change. Everything regarding the migration is OK. |
This ticket is related to the frontend ticket: feature/add-tickbox-to-registration-field
Added the helpUsImprove field to the schema.prisma and register.dto.ts files as requested