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

Feature/save agent form #119

Merged
merged 28 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
126ddf4
generate graphql
lukavdplas Aug 27, 2024
022a69b
correct links in episode preview
lukavdplas Aug 27, 2024
14e165b
save agent ID data
lukavdplas Aug 27, 2024
bde5968
show error messages
lukavdplas Aug 27, 2024
4014f77
show validation in form
lukavdplas Aug 27, 2024
522d9c0
refetch queries
lukavdplas Aug 27, 2024
9052822
use filler text if no description
lukavdplas Aug 27, 2024
06c4d33
move mutation definition
lukavdplas Aug 27, 2024
7c59dbf
save agent description info
lukavdplas Aug 27, 2024
0d21328
save on change
lukavdplas Aug 27, 2024
bfd6786
add delete button
lukavdplas Aug 29, 2024
4b97719
add confirmation modal
lukavdplas Aug 29, 2024
2ce9355
send mutation on delete
lukavdplas Aug 29, 2024
105c015
refetch source query after deleting agent
lukavdplas Aug 29, 2024
76834a5
use source.name in source overview
lukavdplas Aug 29, 2024
c6d4ed6
add formService
lukavdplas Aug 29, 2024
06c2a3c
generate form status component
lukavdplas Aug 29, 2024
4d84dcd
show form status in agent form
lukavdplas Aug 29, 2024
df1e25b
pretty status message
lukavdplas Aug 29, 2024
7df9aba
prevent status flickering
lukavdplas Aug 29, 2024
5aceee8
use agentFormService in delete component
lukavdplas Aug 29, 2024
6e0b755
AgentFormService -> FormService
lukavdplas Aug 29, 2024
1ac11c3
better validation feedback
lukavdplas Aug 29, 2024
023ed2e
no saving on form init
lukavdplas Aug 29, 2024
222a6b3
fix test modules
lukavdplas Aug 30, 2024
295f7f0
remove unused query elements
lukavdplas Sep 18, 2024
7f241b4
code formatting
lukavdplas Sep 18, 2024
18f9e74
Merge branch 'develop' into feature/save-agent-form
lukavdplas Sep 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
175 changes: 174 additions & 1 deletion frontend/generated/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,48 @@ export type AgentDescriptionType = {
sourceMention?: Maybe<PersonAgentDescriptionSourceMentionChoices>;
};

/** An enumeration. */
export enum Certainty {
Certain = 'CERTAIN',
SomewhatCertain = 'SOMEWHAT_CERTAIN',
Uncertain = 'UNCERTAIN'
}

export type CreateAgentInput = {
name: Scalars['String']['input'];
source: Scalars['ID']['input'];
};

export type CreateAgentMutation = {
__typename?: 'CreateAgentMutation';
agent?: Maybe<AgentDescriptionType>;
errors: Array<LettercraftErrorType>;
ok: Scalars['Boolean']['output'];
};

export type CreatePersonReferenceInput = {
description: Scalars['ID']['input'];
person: Scalars['ID']['input'];
};

export type CreatePersonReferenceMutation = {
__typename?: 'CreatePersonReferenceMutation';
errors: Array<LettercraftErrorType>;
ok: Scalars['Boolean']['output'];
};

export type DeleteAgentMutation = {
__typename?: 'DeleteAgentMutation';
errors: Array<LettercraftErrorType>;
ok: Scalars['Boolean']['output'];
};

export type DeletePersonReferenceMutation = {
__typename?: 'DeletePersonReferenceMutation';
errors: Array<LettercraftErrorType>;
ok: Scalars['Boolean']['output'];
};

export type EpisodeCategoryType = {
__typename?: 'EpisodeCategoryType';
/** Longer description to help identify this object */
Expand Down Expand Up @@ -123,6 +165,15 @@ export enum EventEpisodeSourceMentionChoices {
Implied = 'IMPLIED'
}

/** An enumeration. */
export enum Gender {
Female = 'FEMALE',
Male = 'MALE',
Mixed = 'MIXED',
Other = 'OTHER',
Unknown = 'UNKNOWN'
}

export type GiftCategoryType = {
__typename?: 'GiftCategoryType';
/** Longer description to help identify this object */
Expand Down Expand Up @@ -288,9 +339,34 @@ export type LettercraftErrorType = {

export type Mutation = {
__typename?: 'Mutation';
createAgent?: Maybe<CreateAgentMutation>;
createPersonReference?: Maybe<CreatePersonReferenceMutation>;
deleteAgent?: Maybe<DeleteAgentMutation>;
deletePersonReference?: Maybe<DeletePersonReferenceMutation>;
updateAgent?: Maybe<UpdateAgentMutation>;
updateEpisode?: Maybe<UpdateEpisodeMutation>;
updateOrCreateSource?: Maybe<UpdateOrCreateSourceMutation>;
updatePersonReference?: Maybe<UpdatePersonReferenceMutation>;
};


export type MutationCreateAgentArgs = {
agentData: CreateAgentInput;
};


export type MutationCreatePersonReferenceArgs = {
referenceData: CreatePersonReferenceInput;
};


export type MutationDeleteAgentArgs = {
id: Scalars['ID']['input'];
};


export type MutationDeletePersonReferenceArgs = {
id: Scalars['ID']['input'];
};


Expand All @@ -308,6 +384,11 @@ export type MutationUpdateOrCreateSourceArgs = {
input: UpdateCreateSourceInput;
};


export type MutationUpdatePersonReferenceArgs = {
referenceData: UpdatePersonReferenceInput;
};

/** An enumeration. */
export enum PersonAgentDescriptionGenderCertaintyChoices {
/** uncertain */
Expand Down Expand Up @@ -592,6 +673,12 @@ export type SourceContentsDateType = {
yearUpper: Scalars['Int']['output'];
};

/** An enumeration. */
export enum SourceMention {
Direct = 'DIRECT',
Implied = 'IMPLIED'
}

export type SourceType = {
__typename?: 'SourceType';
contentsDate?: Maybe<SourceContentsDateType>;
Expand Down Expand Up @@ -767,17 +854,33 @@ export type StructureType = {
settlement?: Maybe<SettlementType>;
};

export type UpdateAgentGenderInput = {
gender?: InputMaybe<Gender>;
note?: InputMaybe<Scalars['String']['input']>;
sourceMention?: InputMaybe<SourceMention>;
};

export type UpdateAgentInput = {
description?: InputMaybe<Scalars['String']['input']>;
designators?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
gender?: InputMaybe<UpdateAgentGenderInput>;
id: Scalars['ID']['input'];
isGroup?: InputMaybe<Scalars['Boolean']['input']>;
location?: InputMaybe<UpdateAgentLocationInput>;
name?: InputMaybe<Scalars['String']['input']>;
};

export type UpdateAgentLocationInput = {
location?: InputMaybe<Scalars['ID']['input']>;
note?: InputMaybe<Scalars['String']['input']>;
sourceMention?: InputMaybe<SourceMention>;
};

export type UpdateAgentMutation = {
__typename?: 'UpdateAgentMutation';
agent?: Maybe<AgentDescriptionType>;
error?: Maybe<Scalars['String']['output']>;
errors: Array<LettercraftErrorType>;
ok: Scalars['Boolean']['output'];
};

export type UpdateCreateSourceInput = {
Expand Down Expand Up @@ -812,6 +915,18 @@ export type UpdateOrCreateSourceMutation = {
source?: Maybe<SourceType>;
};

export type UpdatePersonReferenceInput = {
certainty?: InputMaybe<Certainty>;
id: Scalars['ID']['input'];
note?: InputMaybe<Scalars['String']['input']>;
};

export type UpdatePersonReferenceMutation = {
__typename?: 'UpdatePersonReferenceMutation';
errors: Array<LettercraftErrorType>;
ok: Scalars['Boolean']['output'];
};

export type UserType = {
__typename?: 'UserType';
firstName: Scalars['String']['output'];
Expand Down Expand Up @@ -847,6 +962,20 @@ export type DataEntryAgentQueryVariables = Exact<{

export type DataEntryAgentQuery = { __typename?: 'Query', agentDescription?: { __typename?: 'AgentDescriptionType', id: string, name: string, description: string, isGroup: boolean, source: { __typename?: 'SourceType', id: string, name: string } } | null };

export type DataEntryUpdateAgentMutationVariables = Exact<{
input: UpdateAgentInput;
}>;


export type DataEntryUpdateAgentMutation = { __typename?: 'Mutation', updateAgent?: { __typename?: 'UpdateAgentMutation', ok: boolean, errors: Array<{ __typename?: 'LettercraftErrorType', field: string, messages: Array<string> }> } | null };

export type DataEntryDeleteAgentMutationVariables = Exact<{
id: Scalars['ID']['input'];
}>;


export type DataEntryDeleteAgentMutation = { __typename?: 'Mutation', deleteAgent?: { __typename?: 'DeleteAgentMutation', ok: boolean, errors: Array<{ __typename?: 'LettercraftErrorType', messages: Array<string>, field: string }> } | null };

export type DataEntryEpisodeContentsQueryVariables = Exact<{
id: Scalars['ID']['input'];
}>;
Expand Down Expand Up @@ -1013,6 +1142,50 @@ export const DataEntryAgentDocument = gql`
export class DataEntryAgentGQL extends Apollo.Query<DataEntryAgentQuery, DataEntryAgentQueryVariables> {
override document = DataEntryAgentDocument;

constructor(apollo: Apollo.Apollo) {
super(apollo);
}
}
export const DataEntryUpdateAgentDocument = gql`
mutation DataEntryUpdateAgent($input: UpdateAgentInput!) {
updateAgent(agentData: $input) {
ok
errors {
field
messages
}
}
}
`;

@Injectable({
providedIn: 'root'
})
export class DataEntryUpdateAgentGQL extends Apollo.Mutation<DataEntryUpdateAgentMutation, DataEntryUpdateAgentMutationVariables> {
override document = DataEntryUpdateAgentDocument;

constructor(apollo: Apollo.Apollo) {
super(apollo);
}
}
export const DataEntryDeleteAgentDocument = gql`
mutation DataEntryDeleteAgent($id: ID!) {
deleteAgent(id: $id) {
ok
errors {
messages
field
}
}
}
`;

@Injectable({
providedIn: 'root'
})
export class DataEntryDeleteAgentGQL extends Apollo.Mutation<DataEntryDeleteAgentMutation, DataEntryDeleteAgentMutationVariables> {
override document = DataEntryDeleteAgentDocument;

constructor(apollo: Apollo.Apollo) {
super(apollo);
}
Expand Down
87 changes: 86 additions & 1 deletion frontend/generated/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,44 @@ type AgentDescriptionType {
sourceMention: PersonAgentDescriptionSourceMentionChoices
}

"""An enumeration."""
enum Certainty {
CERTAIN
SOMEWHAT_CERTAIN
UNCERTAIN
}

input CreateAgentInput {
name: String!
source: ID!
}

type CreateAgentMutation {
agent: AgentDescriptionType
errors: [LettercraftErrorType!]!
ok: Boolean!
}

input CreatePersonReferenceInput {
description: ID!
person: ID!
}

type CreatePersonReferenceMutation {
errors: [LettercraftErrorType!]!
ok: Boolean!
}

type DeleteAgentMutation {
errors: [LettercraftErrorType!]!
ok: Boolean!
}

type DeletePersonReferenceMutation {
errors: [LettercraftErrorType!]!
ok: Boolean!
}

type EpisodeCategoryType {
"""Longer description to help identify this object"""
description: String!
Expand Down Expand Up @@ -135,6 +173,15 @@ enum EventEpisodeSourceMentionChoices {
IMPLIED
}

"""An enumeration."""
enum Gender {
FEMALE
MALE
MIXED
OTHER
UNKNOWN
}

type GiftCategoryType {
"""Longer description to help identify this object"""
description: String!
Expand Down Expand Up @@ -331,9 +378,14 @@ type LettercraftErrorType {
}

type Mutation {
createAgent(agentData: CreateAgentInput!): CreateAgentMutation
createPersonReference(referenceData: CreatePersonReferenceInput!): CreatePersonReferenceMutation
deleteAgent(id: ID!): DeleteAgentMutation
deletePersonReference(id: ID!): DeletePersonReferenceMutation
updateAgent(agentData: UpdateAgentInput!): UpdateAgentMutation
updateEpisode(input: UpdateEpisodeMutationInput!): UpdateEpisodeMutation
updateOrCreateSource(input: UpdateCreateSourceInput!): UpdateOrCreateSourceMutation
updatePersonReference(referenceData: UpdatePersonReferenceInput!): UpdatePersonReferenceMutation
}

"""An enumeration."""
Expand Down Expand Up @@ -602,6 +654,12 @@ type SourceContentsDateType {
yearUpper: Int!
}

"""An enumeration."""
enum SourceMention {
DIRECT
IMPLIED
}

type SourceType {
contentsDate: SourceContentsDateType

Expand Down Expand Up @@ -816,16 +874,32 @@ type StructureType {
settlement: SettlementType
}

input UpdateAgentGenderInput {
gender: Gender
note: String
sourceMention: SourceMention
}

input UpdateAgentInput {
description: String
designators: [String]
gender: UpdateAgentGenderInput
id: ID!
isGroup: Boolean
location: UpdateAgentLocationInput
name: String
}

input UpdateAgentLocationInput {
location: ID
note: String
sourceMention: SourceMention
}

type UpdateAgentMutation {
agent: AgentDescriptionType
error: String
errors: [LettercraftErrorType!]!
ok: Boolean!
}

input UpdateCreateSourceInput {
Expand Down Expand Up @@ -858,6 +932,17 @@ type UpdateOrCreateSourceMutation {
source: SourceType
}

input UpdatePersonReferenceInput {
certainty: Certainty
id: ID!
note: String
}

type UpdatePersonReferenceMutation {
errors: [LettercraftErrorType!]!
ok: Boolean!
}

type UserType {
firstName: String!
id: ID!
Expand Down
Loading