Skip to content

Commit

Permalink
feat: correct update one
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Smith committed Dec 6, 2023
1 parent 4985af2 commit e1165b0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion appsync.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export type LocalAuthorityUser = {
firstName: Scalars['String']['output'];
jobTitle: Scalars['String']['output'];
lastName: Scalars['String']['output'];
localAuthorityName: Scalars['String']['output'];
name: Scalars['String']['output'];
notes?: Maybe<Scalars['String']['output']>;
phone: Scalars['String']['output'];
};
Expand Down
2 changes: 1 addition & 1 deletion schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type School {
}

type LocalAuthorityUser {
localAuthorityName: String!
name: String!
firstName: String!
lastName: String!
jobTitle: String!
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const handler: AppSyncResolverHandler<
params as MutationRegisterLocalAuthorityArgs;
const register = await localAuthorityDataRepository.setToRegistered(name);
const insert = await localAuthorityRepository.insert({
localAuthorityName: name,
name,
firstName,
lastName,
email,
Expand Down
2 changes: 1 addition & 1 deletion src/repository/localAuthorityDataRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ export class LocalAuthorityDataRepository {
}

public async setToRegistered(name: string): Promise<boolean> {
return (await this.collection.updateOne({ name }, { registered: true })).acknowledged;
return (await this.collection.updateOne({ name }, { $set: { registered: true } })).acknowledged;
}
}

0 comments on commit e1165b0

Please sign in to comment.