Skip to content

Commit

Permalink
Merge branch 'main' of github.com:fraktio/boilerplate-graphql-advance…
Browse files Browse the repository at this point in the history
…d into main
  • Loading branch information
AudioVisuaali committed Nov 4, 2021
2 parents 35ba57e + 50f2230 commit eb59115
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 28 deletions.
44 changes: 25 additions & 19 deletions app/generation/generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,11 @@ export type AddEmployeeSuccess = {
};

export type AddPersonInput = {
person: AddPersonPersonInput;
person: PersonInput;
};

export type AddPersonOutput = AddPersonSuccess | UniqueConstraintViolationFailure;

export type AddPersonPersonInput = {
birthday: Scalars['Date'];
email: Scalars['EmailAddress'];
firstName: Scalars['String'];
gender: Gender;
/** Last name has to be minimum of 1 chracters and maximum of 50 */
lastName: Scalars['String'];
nationality: Scalars['CountryCode'];
personalIdentityCode: Scalars['PersonalIdentityCode'];
phone: Scalars['PhoneNumber'];
};

export type AddPersonSuccess = {
__typename?: 'AddPersonSuccess';
person: Person;
Expand All @@ -93,9 +81,11 @@ export type Adult = Person & {
firstName: Scalars['String'];
gender: Gender;
id: Scalars['UUID'];
/** Requires authentication and ADMIN privileges */
internalId: Scalars['ID'];
lastName: Scalars['String'];
nationality: Scalars['CountryCode'];
/** Requires authentication and ADMIN privileges */
/** Requires authentication and USER privileges */
personalIdentityCode: Scalars['PersonalIdentityCode'];
phone?: Maybe<Scalars['PhoneNumber']>;
timestamp: Timestamp;
Expand Down Expand Up @@ -184,7 +174,7 @@ export type EditCompanySuccess = {

export type EditPersonInput = {
id: Scalars['UUID'];
person: AddPersonPersonInput;
person: PersonInput;
};

export type EditPersonOutput = EditPersonSuccess | NotFoundFailure | UniqueConstraintViolationFailure;
Expand Down Expand Up @@ -359,9 +349,11 @@ export type Person = {
firstName: Scalars['String'];
gender: Gender;
id: Scalars['UUID'];
/** Requires authentication and ADMIN privileges */
internalId: Scalars['ID'];
lastName: Scalars['String'];
nationality: Scalars['CountryCode'];
/** Requires authentication and ADMIN privileges */
/** Requires authentication and USER privileges */
personalIdentityCode: Scalars['PersonalIdentityCode'];
phone?: Maybe<Scalars['PhoneNumber']>;
timestamp: Timestamp;
Expand All @@ -379,7 +371,16 @@ export type PersonFilterOperationInput = {
};

export type PersonInput = {
birthday: Scalars['Date'];
email: Scalars['EmailAddress'];
firstName: Scalars['String'];
gender: Gender;
id: Scalars['UUID'];
/** Last name has to be minimum of 1 chracters and maximum of 50 */
lastName: Scalars['String'];
nationality: Scalars['CountryCode'];
personalIdentityCode: Scalars['PersonalIdentityCode'];
phone: Scalars['PhoneNumber'];
};

export enum PersonSortField {
Expand Down Expand Up @@ -537,9 +538,11 @@ export type Underage = Person & {
firstName: Scalars['String'];
gender: Gender;
id: Scalars['UUID'];
/** Requires authentication and ADMIN privileges */
internalId: Scalars['ID'];
lastName: Scalars['String'];
nationality: Scalars['CountryCode'];
/** Requires authentication and ADMIN privileges */
/** Requires authentication and USER privileges */
personalIdentityCode: Scalars['PersonalIdentityCode'];
phone?: Maybe<Scalars['PhoneNumber']>;
timestamp: Timestamp;
Expand Down Expand Up @@ -637,7 +640,6 @@ export type ResolversTypes = ResolversObject<{
AddEmployeeSuccess: ResolverTypeWrapper<Omit<AddEmployeeSuccess, 'company'> & { company: ResolversTypes['Company'] }>;
AddPersonInput: AddPersonInput;
AddPersonOutput: ResolversTypes['AddPersonSuccess'] | ResolversTypes['UniqueConstraintViolationFailure'];
AddPersonPersonInput: AddPersonPersonInput;
AddPersonSuccess: ResolverTypeWrapper<Omit<AddPersonSuccess, 'person'> & { person: ResolversTypes['Person'] }>;
Adult: ResolverTypeWrapper<AdultModel>;
AuthenticatedUserFailure: ResolverTypeWrapper<AuthenticatedUserFailure>;
Expand Down Expand Up @@ -673,6 +675,7 @@ export type ResolversTypes = ResolversObject<{
FileMetadataSuccess: ResolverTypeWrapper<FileMetadataSuccess>;
FilterOperator: FilterOperator;
Gender: Gender;
ID: ResolverTypeWrapper<Scalars['ID']>;
Int: ResolverTypeWrapper<Scalars['Int']>;
InvalidCursorFailure: ResolverTypeWrapper<InvalidCursorFailure>;
LoginUserFailure: ResolverTypeWrapper<LoginUserFailure>;
Expand Down Expand Up @@ -731,7 +734,6 @@ export type ResolversParentTypes = ResolversObject<{
AddEmployeeSuccess: Omit<AddEmployeeSuccess, 'company'> & { company: ResolversParentTypes['Company'] };
AddPersonInput: AddPersonInput;
AddPersonOutput: ResolversParentTypes['AddPersonSuccess'] | ResolversParentTypes['UniqueConstraintViolationFailure'];
AddPersonPersonInput: AddPersonPersonInput;
AddPersonSuccess: Omit<AddPersonSuccess, 'person'> & { person: ResolversParentTypes['Person'] };
Adult: AdultModel;
AuthenticatedUserFailure: AuthenticatedUserFailure;
Expand Down Expand Up @@ -764,6 +766,7 @@ export type ResolversParentTypes = ResolversObject<{
FileMetadataInvalidFile: FileMetadataInvalidFile;
FileMetadataResponse: ResolversParentTypes['FileMetadataInvalidFile'] | ResolversParentTypes['FileMetadataSuccess'];
FileMetadataSuccess: FileMetadataSuccess;
ID: Scalars['ID'];
Int: Scalars['Int'];
InvalidCursorFailure: InvalidCursorFailure;
LoginUserFailure: LoginUserFailure;
Expand Down Expand Up @@ -865,6 +868,7 @@ export type AdultResolvers<ContextType = Context, ParentType extends ResolversPa
firstName?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
gender?: Resolver<ResolversTypes['Gender'], ParentType, ContextType>;
id?: Resolver<ResolversTypes['UUID'], ParentType, ContextType>;
internalId?: Resolver<ResolversTypes['ID'], ParentType, ContextType>;
lastName?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
nationality?: Resolver<ResolversTypes['CountryCode'], ParentType, ContextType>;
personalIdentityCode?: Resolver<ResolversTypes['PersonalIdentityCode'], ParentType, ContextType>;
Expand Down Expand Up @@ -1052,6 +1056,7 @@ export type PersonResolvers<ContextType = Context, ParentType extends ResolversP
firstName?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
gender?: Resolver<ResolversTypes['Gender'], ParentType, ContextType>;
id?: Resolver<ResolversTypes['UUID'], ParentType, ContextType>;
internalId?: Resolver<ResolversTypes['ID'], ParentType, ContextType>;
lastName?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
nationality?: Resolver<ResolversTypes['CountryCode'], ParentType, ContextType>;
personalIdentityCode?: Resolver<ResolversTypes['PersonalIdentityCode'], ParentType, ContextType>;
Expand Down Expand Up @@ -1142,6 +1147,7 @@ export type UnderageResolvers<ContextType = Context, ParentType extends Resolver
firstName?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
gender?: Resolver<ResolversTypes['Gender'], ParentType, ContextType>;
id?: Resolver<ResolversTypes['UUID'], ParentType, ContextType>;
internalId?: Resolver<ResolversTypes['ID'], ParentType, ContextType>;
lastName?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
nationality?: Resolver<ResolversTypes['CountryCode'], ParentType, ContextType>;
personalIdentityCode?: Resolver<ResolversTypes['PersonalIdentityCode'], ParentType, ContextType>;
Expand Down
24 changes: 15 additions & 9 deletions app/graphql/schema/Person.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ enum Gender {
}

interface Person {
"Requires authentication and ADMIN privileges"
internalId: ID! @auth(requires:ADMIN)
id: UUID!
firstName: String!
lastName: String!
Expand All @@ -14,14 +16,16 @@ interface Person {
birthday: Date!
timestamp: Timestamp!
gender: Gender!
"Requires authentication and ADMIN privileges"
personalIdentityCode: PersonalIdentityCode! @auth(requires:ADMIN)
"Requires authentication and USER privileges"
personalIdentityCode: PersonalIdentityCode! @auth(requires:USER)
}

"""
Adult is over 16 years old Person
"""
type Adult implements Person {
"Requires authentication and ADMIN privileges"
internalId: ID! @auth(requires:ADMIN)
id: UUID!
firstName: String!
lastName: String!
Expand All @@ -32,14 +36,16 @@ type Adult implements Person {
timestamp: Timestamp!
gender: Gender!
employers: [Company!]!
"Requires authentication and ADMIN privileges"
personalIdentityCode: PersonalIdentityCode! @auth(requires:ADMIN)
"Requires authentication and USER privileges"
personalIdentityCode: PersonalIdentityCode! @auth(requires:USER)
}

"""
Underage is under 16 years old Person
"""
type Underage implements Person {
"Requires authentication and ADMIN privileges"
internalId: ID! @auth(requires:ADMIN)
id: UUID!
firstName: String!
lastName: String!
Expand All @@ -49,8 +55,8 @@ type Underage implements Person {
birthday: Date!
timestamp: Timestamp!
gender: Gender!
"Requires authentication and ADMIN privileges"
personalIdentityCode: PersonalIdentityCode! @auth(requires:ADMIN)
"Requires authentication and USER privileges"
personalIdentityCode: PersonalIdentityCode! @auth(requires:USER)
}

type PersonsPaginationEdge {
Expand Down Expand Up @@ -113,7 +119,7 @@ type Mutation {
editPerson(input: EditPersonInput!): EditPersonOutput!
}

input AddPersonPersonInput {
input MutatePersonInput {
firstName: String!
"Last name has to be minimum of 1 chracters and maximum of 50"
lastName: String! @length(max:50 min:1)
Expand All @@ -126,7 +132,7 @@ input AddPersonPersonInput {
}

input AddPersonInput {
person: AddPersonPersonInput!
person: MutatePersonInput!
}

union AddPersonOutput = AddPersonSuccess | UniqueConstraintViolationFailure
Expand All @@ -137,7 +143,7 @@ type AddPersonSuccess {

input EditPersonInput {
id: UUID!
person: AddPersonPersonInput!
person: MutatePersonInput!
}

union EditPersonOutput = EditPersonSuccess | UniqueConstraintViolationFailure | NotFoundFailure
Expand Down
5 changes: 5 additions & 0 deletions cloudbuild-demo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ steps:

'--update-secrets', 'TOKEN_SECRET=TOKEN_SECRET:latest',
'--update-secrets', 'DATABASE_PASSWORD=DATABASE_PASSWORD:latest',

'--update-secrets', 'APOLLO_KEY=APOLLO_KEY:latest',
'--update-env-vars', 'APOLLO_GRAPH_ID=Boiler-test',
'--update-env-vars', 'APOLLO_GRAPH_VARIANT=current',
'--update-env-vars', 'APOLLO_SCHEMA_REPORTING=true',
]

tags: ['$PROJECT_ID-$_IMAGE']
Expand Down

0 comments on commit eb59115

Please sign in to comment.