-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(metrics): Send isPatient0 property to Google Analytics (#7261)
- Loading branch information
Showing
3 changed files
with
40 additions
and
32 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
14 changes: 12 additions & 2 deletions
14
packages/server/graphql/mutations/helpers/isPatientZero.ts
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 |
---|---|---|
@@ -1,6 +1,16 @@ | ||
import getPatientZeroByDomain from '../../../postgres/queries/getPatientZeroByDomain' | ||
|
||
const isPatientZero = async (userId: string, domain?: string | null) => | ||
domain ? userId === (await getPatientZeroByDomain(domain)).id : false | ||
const isPatientZero = async (userId: string, domain?: string | null) => { | ||
if (domain) { | ||
const patient0 = await getPatientZeroByDomain(domain) | ||
if (!patient0) { | ||
return true | ||
} else { | ||
return userId === patient0.id | ||
} | ||
} else { | ||
return false | ||
} | ||
} | ||
|
||
export default isPatientZero |
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