-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create an organization schema and use this schema when generating the…
… pdf-file
- Loading branch information
Showing
17 changed files
with
919 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import BaseStore from './baseStore' | ||
import type { Organization } from './schemas' | ||
|
||
export default class OrganizationStore extends BaseStore<Organization> { | ||
find(): Promise<Organization[]> { | ||
return this.databaseInstance.find({}) | ||
} | ||
|
||
delete(id: string): Promise<number> { | ||
// options set to {} since the default for multi is false | ||
return this.databaseInstance.remove({ _id: id }, {}) | ||
} | ||
|
||
async upsert(data: Organization): Promise<number | undefined> { | ||
const isValid: boolean = this.validate(data) | ||
|
||
if (isValid) | ||
return await this.databaseInstance.update({ identifier: data.identifier }, data, { upsert: true }) | ||
|
||
else | ||
return undefined | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.