Skip to content

Commit

Permalink
graphile#9 "Select Google “sheet” when creating new Questionary"
Browse files Browse the repository at this point in the history
  • Loading branch information
Ondřej Všetička authored and heracek committed Aug 22, 2024
1 parent fcc50ab commit 90245f7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions @app/db/migrations/current/0020-drops.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ drop function if exists app_public.get_live_document(text, text, boolean) cascad
drop type if exists app_public.live_document cascade;

drop table if exists app_public.questionary;
drop type if exists app_public.questionary_connected_google_sheet;
drop type if exists app_public.questionary_shape;
drop type if exists app_public.questionary_shape_option;

Expand Down
11 changes: 8 additions & 3 deletions @app/db/migrations/current/0050-questionary.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ create type app_public.questionary_shape as (
required boolean,
day text
);

comment on column app_public.questionary_shape.id is E'@notNull';
comment on column app_public.questionary_shape.type is E'@notNull';

create type app_public.questionary_connected_google_sheet as (
sheet_id text,
spreadsheet_id text
);


create table app_public.questionary (
id uuid primary key default gen_random_uuid(),
Expand All @@ -33,6 +37,7 @@ create table app_public.questionary (
answers_live_document_id text not null unique default gen_random_uuid(),
questionary_shape questionary_shape[],
questionary_shape_version int not null,
connected_google_sheet questionary_connected_google_sheet,
created_at timestamptz not null default now(),
updated_at timestamptz not null default now()
);
Expand All @@ -47,8 +52,8 @@ create trigger _100_timestamps before insert or update on app_public.questionary

grant
select,
update (title, description, is_public, questionary_shape, questionary_shape_version),
insert (project_id, title, description, is_public, questionary_shape, questionary_shape_version),
update (title, description, is_public, questionary_shape, questionary_shape_version, connected_google_sheet),
insert (project_id, title, description, is_public, questionary_shape, questionary_shape_version, connected_google_sheet),
delete
on app_public.questionary to :DATABASE_VISITOR;

Expand Down
14 changes: 14 additions & 0 deletions data/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1619,6 +1619,7 @@ enum QuestionariesOrderBy {

type Questionary {
answersLiveDocument: LiveDocument
connectedGoogleSheet: QuestionaryConnectedGoogleSheet
createdAt: Datetime!
description: String
id: UUID!
Expand Down Expand Up @@ -1755,8 +1756,20 @@ input QuestionaryCondition {
updatedAt: Datetime
}

type QuestionaryConnectedGoogleSheet {
sheetId: String
spreadsheetId: String
}

"""An input for mutations affecting `QuestionaryConnectedGoogleSheet`"""
input QuestionaryConnectedGoogleSheetInput {
sheetId: String
spreadsheetId: String
}

"""An input for mutations affecting `Questionary`"""
input QuestionaryInput {
connectedGoogleSheet: QuestionaryConnectedGoogleSheetInput
description: String
isPublic: Boolean
projectId: UUID!
Expand All @@ -1769,6 +1782,7 @@ input QuestionaryInput {
Represents an update to a `Questionary`. Fields that are set will be updated.
"""
input QuestionaryPatch {
connectedGoogleSheet: QuestionaryConnectedGoogleSheetInput
description: String
isPublic: Boolean
questionaryShape: [QuestionaryShapeInput]
Expand Down

0 comments on commit 90245f7

Please sign in to comment.