This file contains hidden or 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
class Command { | |
execute() {} | |
} | |
class Transactional { | |
constructor(command) { | |
this.command = command; | |
} | |
execute() { |
This file contains hidden or 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
class Roman { | |
constructor(private readonly str: string) {} | |
private static LOOKUP = { | |
I: 1, | |
V: 5, | |
X: 10, | |
L: 50, | |
C: 100, | |
D: 500, |
This file contains hidden or 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
async generateIDToken(uid: string) { | |
const customToken = await this.admin.auth().createCustomToken(uid); | |
const res = await rp({ | |
url: `https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyCustomToken?key=${this.apikey}`, | |
method: 'POST', | |
body: { | |
token: customToken, | |
returnSecureToken: true, | |
}, | |
json: true, |
This file contains hidden or 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
import { BullModule } from '@nestjs/bull'; | |
import { Module } from '@nestjs/common'; | |
import { EventEmitterModule } from '@nestjs/event-emitter'; | |
import { AppController } from './app.controller'; | |
import { AppService } from './app.service'; | |
import { CommentEmailGenerator } from './comment.email-generator'; | |
import { CommentNotifier } from './comment.notifier'; | |
import { EmailProcessor } from './email.processor'; | |
import { EmailService } from './email.service'; |
This file contains hidden or 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
import { InjectQueue } from '@nestjs/bull'; | |
import { Injectable } from '@nestjs/common'; | |
import { OnEvent } from '@nestjs/event-emitter'; | |
import { Queue } from 'bull'; | |
import { CommentEvents, NewCommentEvent } from './comment.events'; | |
import { CommentEmailGenerator } from './comment.email-generator'; | |
import { createEmailJob } from './email.processor'; | |
@Injectable() |
This file contains hidden or 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
import { Injectable } from '@nestjs/common'; | |
import * as nodemailer from 'nodemailer'; | |
import Mail from 'nodemailer/lib/mailer'; | |
export type SendEmailData = { | |
subject: string; | |
from: string; | |
to: string; | |
body: string; | |
}; |
This file contains hidden or 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
import { Process, Processor } from '@nestjs/bull'; | |
import { Job } from 'bull'; | |
import { EmailService, SendEmailData } from './email.service'; | |
// We create an intermediary type EmailJob in case our EmailProcessor | |
// needs more information than the actual e-mail service. | |
// Just a level of indirection for now. | |
export type EmailJob = SendEmailData; | |
export const createEmailJob = (data: EmailJob): EmailJob => data; |
This file contains hidden or 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
import * as React from 'react'; | |
import { Injectable } from '@nestjs/common'; | |
import { | |
render, | |
MjmlBody, | |
Mjml, | |
MjmlHead, | |
MjmlFont, | |
MjmlPreview, | |
MjmlSection, |
This file contains hidden or 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
import { Body, Controller, Post } from '@nestjs/common'; | |
import { AppService } from './app.service'; | |
import { CommentDTO } from './comment.interfaces'; | |
@Controller() | |
export class AppController { | |
constructor(private readonly appService: AppService) {} | |
@Post() | |
addComment(@Body() data: CommentDTO) { |
This file contains hidden or 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
version: '3' | |
services: | |
mailcatcher: | |
image: 'schickling/mailcatcher' | |
ports: | |
- '7001:1080' # UI | |
- '7002:1025' # SMTP | |
redis: | |
image: 'redis' | |
ports: |
NewerOlder