-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4099 from beyondessential/dev
Sima create instance
- Loading branch information
Showing
142 changed files
with
4,605 additions
and
1,242 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
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,30 @@ | ||
/** | ||
* Tupaia | ||
* Copyright (c) 2017 - 2022 Beyond Essential Systems Pty Ltd | ||
*/ | ||
|
||
import { respond } from '@tupaia/utils'; | ||
import { buildPermissionsBasedMeditrakSyncQuery } from './utilities'; | ||
import { allowNoPermissions } from '../permissions'; | ||
|
||
/** | ||
* Permissions based sync metadata | ||
* { | ||
* changeCount: number of changes since last sync | ||
* countries: countries included in the sync | ||
* permissionGroups: permissions groups included in the sync | ||
* } | ||
* Responds to GET requests to the /changes/metadata endpoint | ||
*/ | ||
export async function changesMetadata(req, res) { | ||
const { models } = req; | ||
|
||
await req.assertPermissions(allowNoPermissions); | ||
|
||
const { query, countries, permissionGroups } = await buildPermissionsBasedMeditrakSyncQuery(req, { | ||
select: 'count(*)', | ||
}); | ||
const queryResult = await query.executeOnDatabase(models.database); | ||
const changeCount = parseInt(queryResult[0].count); | ||
respond(res, { changeCount, countries, permissionGroups }); | ||
} |
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
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
Oops, something went wrong.