(core) set up a trialing list and a call scheduled flag for Grist SaaS

Summary:
This adds support for the automation described in
https://grist.quip.com/rt3tAoEH4kuy/Automate-Sprouts-outreach-email

Test Plan: added tests; will need manual testing and iterative integration work

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D3804
This commit is contained in:
Paul Fitzpatrick
2023-02-20 10:45:55 -05:00
parent bc43e16bc7
commit 3aba7f6208
4 changed files with 14 additions and 2 deletions

View File

@@ -83,6 +83,8 @@ export const NotifierEvents = StringUnion(
'addBillingManager',
'teamCreator',
'trialPeriodEndingSoon',
'trialingSubscription',
'scheduledCall',
);
export type NotifierEvent = typeof NotifierEvents.type;
@@ -467,6 +469,10 @@ export class HomeDBManager extends EventEmitter {
return await User.findOne({where: {apiKey}, relations: ["logins"]}) || undefined;
}
public async getUserByRef(ref: string): Promise<User|undefined> {
return await User.findOne({where: {ref}, relations: ["logins"]}) || undefined;
}
public async getUser(userId: number): Promise<User|undefined> {
return await User.findOne({where: {id: userId}, relations: ["logins"]}) || undefined;
}