-
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.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
37 changed files
with
1,607 additions
and
406 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
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
80 changes: 0 additions & 80 deletions
80
packages/central-server/src/apiV2/utilities/getChangesFilter.js
This file was deleted.
Oops, something went wrong.
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.