adding stuff for stuff
This commit is contained in:
@@ -30,5 +30,6 @@ module.exports = {
|
||||
rules: {
|
||||
quotes: ["error", "double"],
|
||||
// "import/no-unresolved": 0,
|
||||
// "no-unused-vars": "disabled",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
"start": "npm run shell",
|
||||
"deploy": "firebase deploy --only functions",
|
||||
"logs": "firebase functions:log",
|
||||
"hotReload": "tsc --watch"
|
||||
"hotReload": "tsc --watch",
|
||||
"copyModels": "cp -r ../../web/models /models"
|
||||
},
|
||||
"engines": {
|
||||
"node": "16"
|
||||
|
||||
@@ -9,7 +9,10 @@ admin.initializeApp();
|
||||
export const helloWorld = functions.https.onRequest((request, response) => {
|
||||
functions.logger.info("Hello no!", { structuredData: true });
|
||||
response.send("Hello from woahhhhhh!");
|
||||
});
|
||||
})
|
||||
|
||||
import { agoraToken } from "./agora";
|
||||
exports.agoraToken = agoraToken;
|
||||
|
||||
// import { inviteUserToTeam } from "./notifications";
|
||||
// exports.inviteUserToTeam = inviteUserToTeam;
|
||||
|
||||
@@ -1,17 +1,49 @@
|
||||
// import * as functions from "firebase-functions";
|
||||
/* eslint-disable no-unused-vars */
|
||||
import * as functions from "firebase-functions";
|
||||
import * as sgMail from "@sendgrid/mail";
|
||||
|
||||
import { TeamMember, TeamMemberStatus } from "../../../web/models/teamMember";
|
||||
|
||||
sgMail.setApiKey(
|
||||
"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"
|
||||
);
|
||||
|
||||
// exports.inviteUserToTeam = functions.firestore
|
||||
// .document('teamMembers/{userId}')
|
||||
// .onCreate(async (snap, context) => {
|
||||
// const newTeamMember = snap.data() as TeamMember;
|
||||
enum SendgridTemplateId {
|
||||
inviteTeamMember = "d-4953372ac7b94d3fa9419bad4073840f",
|
||||
}
|
||||
|
||||
// // access a particular field as you would any JS property
|
||||
// const name = newValue.name;
|
||||
class SendGridEmailMessage {
|
||||
to: string;
|
||||
from: string;
|
||||
templateId: SendgridTemplateId;
|
||||
dynamic_template_data: {};
|
||||
|
||||
// // perform desired operations ...
|
||||
// });
|
||||
constructor(
|
||||
_to: string,
|
||||
_from: string,
|
||||
_templateId: SendgridTemplateId,
|
||||
_templateData: {}
|
||||
) {
|
||||
this.to = _to;
|
||||
this.from = _from;
|
||||
this.templateId = _templateId;
|
||||
this.dynamic_template_data = _templateData;
|
||||
}
|
||||
}
|
||||
|
||||
export const inviteUserToTeam = functions.firestore
|
||||
.document("teamMembers/{teamMemberId}")
|
||||
.onCreate(async (snap, context) => {
|
||||
const newTeamMember: TeamMember = snap.data() as TeamMember;
|
||||
if (newTeamMember.status == TeamMemberStatus.invited) {
|
||||
functions.logger.info(
|
||||
"New team member invited...sending email" +
|
||||
newTeamMember.inviteEmailAddress,
|
||||
{ structuredData: true }
|
||||
);
|
||||
|
||||
// send email to people
|
||||
|
||||
return;
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user