Skip to content

Commit

Permalink
fix: merge
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgfr committed Sep 26, 2023
2 parents 503d9bf + a590140 commit 05e5cb3
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const ContributionsAnswer = ({
values: answer,
defaultValues: {
content: "",
otherAnswer: "ANSWER",
contentType: "ANSWER",
status: {
status: "TODO",
},
Expand Down Expand Up @@ -100,7 +100,7 @@ export const ContributionsAnswer = ({
await updateAnswer({
content: data.content,
id: answer.id,
otherAnswer: data.otherAnswer,
contentType: data.contentType,
status: newStatus,
userId: user?.id,
contentServicePublicCdtnId:
Expand Down Expand Up @@ -191,13 +191,13 @@ export const ContributionsAnswer = ({
disabled={isNotEditable(answer)}
control={control}
rules={{
required: answer && answer.otherAnswer === "ANSWER",
required: answer && answer.contentType === "ANSWER",
}}
/>
</FormControl>
{answer && (
<FormRadioGroup
name="otherAnswer"
name="contentType"
label="Type de réponse"
control={control}
disabled={isNotEditable(answer)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
} from "./answerReferences";

export const contributionAnswerUpdateMutation = `
mutation contributionAnswerUpdate($id: uuid!, $content: String, $otherAnswer: String, $status: statustype!, $userId: uuid!, $contentServicePublicCdtnId: String, $kaliReferences: [contribution_answer_kali_references_insert_input!]!, $legiReferences: [contribution_answer_legi_references_insert_input!]!, $otherReferences: [contribution_answer_other_references_insert_input!]!, $cdtnReferences: [contribution_answer_cdtn_references_insert_input!]!) {
update_contribution_answers_by_pk(pk_columns: {id: $id}, _set: {content: $content, other_answer: $otherAnswer, content_service_public_cdtn_id: $contentServicePublicCdtnId}) {
mutation contributionAnswerUpdate($id: uuid!, $content: String, $contentType: String, $status: statustype!, $userId: uuid!, $contentServicePublicCdtnId: String, $kaliReferences: [contribution_answer_kali_references_insert_input!]!, $legiReferences: [contribution_answer_legi_references_insert_input!]!, $otherReferences: [contribution_answer_other_references_insert_input!]!, $cdtnReferences: [contribution_answer_cdtn_references_insert_input!]!) {
update_contribution_answers_by_pk(pk_columns: {id: $id}, _set: {content: $content, content_type: $contentType, content_service_public_cdtn_id: $contentServicePublicCdtnId}) {
__typename
}
insert_contribution_answer_statuses_one(object: {status: $status, user_id: $userId, answer_id: $id}) {
Expand Down Expand Up @@ -48,7 +48,7 @@ mutation contributionAnswerUpdate($id: uuid!, $content: String, $otherAnswer: St
export type MutationProps = Pick<
Answer,
| "id"
| "otherAnswer"
| "contentType"
| "contentServicePublicCdtnId"
| "content"
| "kaliReferences"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ query contribution_answer($id: uuid) {
questionId: question_id
agreementId: agreement_id
content
otherAnswer: other_answer
contentType: content_type
updatedAt: updated_at
contentServicePublicCdtnId: content_service_public_cdtn_id
question {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ query SelectQuestion($questionId: uuid) {
order_by: {agreement_id: asc}
) {
id
otherAnswer: other_answer
contentType: content_type
agreement {
id
name
Expand Down
4 changes: 2 additions & 2 deletions targets/frontend/src/components/contributions/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ export type CdtnReference = {
document: Document;
};

export type OtherAnswer = "ANSWER" | "NOTHING" | "UNKNOWN" | "SP";
export type ContentType = "ANSWER" | "NOTHING" | "UNKNOWN" | "SP";

export type Answer = {
id: string;
agreementId: string;
questionId: string;
otherAnswer?: OtherAnswer;
contentType?: ContentType;
contentServicePublicCdtnId?: string;
agreement: Agreement;
statuses: AnswerStatus[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ select_permissions:
- agreement_id
- content
- id
- other_answer
- content_type
- question_id
- updated_at
- content_service_public_cdtn_id
Expand All @@ -76,6 +76,7 @@ update_permissions:
- content
- other_answer
- content_service_public_cdtn_id
- content_type
filter: {}
check: null
set:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "contribution"."answers" rename column "content_type" to "other_answer";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "contribution"."answers" rename column "other_answer" to "content_type";

0 comments on commit 05e5cb3

Please sign in to comment.