Skip to content

Instantly share code, notes, and snippets.

@richartkeil
Created August 8, 2020 03:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richartkeil/f6a1c5d624d98d68a8e1e4440902f11f to your computer and use it in GitHub Desktop.
Save richartkeil/f6a1c5d624d98d68a8e1e4440902f11f to your computer and use it in GitHub Desktop.
interface Event {
public isCritical(): boolean;
public getName(): string;
public getPayload(): object;
}
class UserProcessed implements Event {
constructor(protected user: firestore.DocumentSnapshot) {}
public isCritical() {
return true;
}
public getName() {
return "user.processed";
}
public getPayload() {
return {
id: this.user.id,
name: this.user.data().name,
email: this.user.data().email
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment