Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: 0.0.1 #47

Open
wants to merge 27 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5f7eeb2
feat: added ses mailer config
sheikhshack Jan 25, 2022
927e178
feat: implement sending of email route for applications
sheikhshack Jan 25, 2022
b83d9cd
chore: remove aws sdk bloat
sheikhshack Jan 25, 2022
3eb1dde
Merge branch 'develop' into feat/ses-mailing-service
sheikhshack Jan 26, 2022
c255dea
Merge pull request #40 from datagovsg/feat/ses-mailing-service
sheikhshack Jan 26, 2022
3a4c75e
feat: added proper email templating
sheikhshack Jan 26, 2022
ffbc8a1
chore: fix mailer service to include subject
sheikhshack Jan 26, 2022
3eff539
fix: simplified viewheader, sync with design master
sheikhshack Jan 26, 2022
1a4379f
fix: fix viewer page to look slightly better
sheikhshack Jan 26, 2022
40db7f9
chore: added form handling components
sheikhshack Jan 27, 2022
aebb4fb
fix: modal aesthetics
sheikhshack Jan 27, 2022
b20cb60
chore: remove old Admin header
sheikhshack Jan 27, 2022
c043846
fix: temp quickfix for broken route
sheikhshack Jan 27, 2022
e450758
chore: updated sendEmail endpoints
sheikhshack Jan 27, 2022
9c3d53a
chore(backend): updated email template
sheikhshack Jan 27, 2022
e8b34e6
fix: route changes, api calls, modal and page viewer logic
sheikhshack Jan 27, 2022
36681fc
feat: jpeg to pdf converter (#45)
junchernwu Jan 27, 2022
2d71a61
chore: init context hook for viewer
sheikhshack Jan 27, 2022
1e99849
chore: fix viewer kinks
sheikhshack Jan 27, 2022
032bde3
chore: clean up confusing types
sheikhshack Jan 27, 2022
0036917
feat: added file title to viewer
sheikhshack Jan 27, 2022
459b56f
feat: added form display on submission
sheikhshack Jan 27, 2022
1293156
chore: fix ui excess padding, fix root route
sheikhshack Jan 27, 2022
e8207b7
fix: complete status, fix viewer display to block button operations
sheikhshack Jan 27, 2022
81874e3
fix: favicons
sheikhshack Jan 28, 2022
76dbf92
chore: swap over to SES for mailling
sheikhshack Jan 28, 2022
3c5e77d
feat: public page (#46)
sheikhshack Jan 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
build
coverage
**/templates/**
1 change: 1 addition & 0 deletions backend/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports = {
rules: {
'no-console': 'warn',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/member-delimiter-style': [
'error',
{
Expand Down
145 changes: 143 additions & 2 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"convict": "^6.2.1",
"express-session": "^1.17.2",
"helmet": "^4.6.0",
"jspdf": "^2.5.0",
"mongoose": "^6.1.7",
"nodemailer": "^6.7.0",
"otplib": "^12.0.1",
Expand Down
1 change: 1 addition & 0 deletions backend/src/S3/s3.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ import { ConfigModule } from '../config/config.module'
imports: [ConfigModule],
controllers: [AttachmentController],
providers: [AttachmentService],
exports: [AttachmentService],
})
export class AttachmentModule {}
53 changes: 51 additions & 2 deletions backend/src/applications/applications.controller.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,65 @@
import { Controller, Get, Post, Body, Param, Query } from '@nestjs/common'
import {
Controller,
Get,
Post,
Body,
Param,
Query,
NotFoundException,
} from '@nestjs/common'
import { ApplicationsService } from './applications.service'
import { CreateApplicationDto } from './dto/create-application.dto'
import { FormsService } from '../forms/forms.service'
import { Application } from './schemas/application.schema'
import { MailerService } from '../mailer/mailer.service'
import { MarkSubmissionRequestDto, MarkSubmissionResponse } from './types'

@Controller('applications')
export class ApplicationsController {
constructor(
private readonly applicationsService: ApplicationsService,
private readonly formsService: FormsService
private readonly formsService: FormsService,
private readonly mailService: MailerService
) {}

@Post(':id/markStatus')
async sendEmailToApplicant(
@Body() markSubmissionRequest: MarkSubmissionRequestDto,
@Param('id') id: string
): Promise<MarkSubmissionResponse> {
const applicantEmail = (
await this.applicationsService.updateApplicationStatus(
id,
markSubmissionRequest.status
)
).email

if (!applicantEmail && markSubmissionRequest.emailParams) {
throw new NotFoundException('applicant email not found')
}

if (
markSubmissionRequest.status === 'Incomplete' &&
markSubmissionRequest.emailParams
) {
// TODO: Consider fire and forget
await this.mailService.sendMail(
{
subject: markSubmissionRequest.emailParams?.subject,
to: applicantEmail,
},
markSubmissionRequest.emailParams?.content
)
}

return {
status: 'success',
...(markSubmissionRequest.status === 'Incomplete'
? { email: applicantEmail }
: undefined),
}
}

// TODO: Resolve this anti pattern. Ideally formId shouldn't be a param
@Post(':formId')
async createApplicationFromForm(
Expand Down
Loading