Skip to content

Commit

Permalink
Update after changes in design + finish TODO comments
Browse files Browse the repository at this point in the history
  • Loading branch information
johannaagma committed Dec 13, 2024
1 parent 8d23a08 commit 95d403e
Show file tree
Hide file tree
Showing 48 changed files with 2,831 additions and 1,021 deletions.
5 changes: 5 additions & 0 deletions apps/application-system/api/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@
"glob": "*",
"input": "libs/application/template-api-modules/src/lib/modules/templates/aosh/transfer-of-machine-ownership/emailGenerators/assets",
"output": "./aosh-transfer-of-machine-ownership-assets"
},
{
"glob": "*",
"input": "libs/application/template-api-modules/src/lib/modules/templates/secondary-school/emailGenerators/assets",
"output": "./secondary-school-assets"
}
],
"webpackConfig": "apps/application-system/api/webpack.config.js",
Expand Down
1 change: 1 addition & 0 deletions apps/application-system/form/src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ if (userMocked) {
ApiScope.vinnueftirlitid,
ApiScope.signatureCollection,
ApiScope.licenses,
ApiScope.menntamalastofnun,
],
post_logout_redirect_uri: `${window.location.origin}`,
userStorePrefix: 'as.',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import { Args, Query, Resolver } from '@nestjs/graphql'
import { ApiScope } from '@island.is/auth/scopes'
import { UseGuards } from '@nestjs/common'
import { IdsUserGuard, Scopes, ScopesGuard } from '@island.is/auth-nest-tools'
import { SecondarySchoolApi } from '../secondarySchool.service'
import { SecondarySchoolProgram } from './models'

@UseGuards(IdsUserGuard, ScopesGuard)
@Resolver()
export class MainResolver {
constructor(private readonly secondarySchoolApi: SecondarySchoolApi) {}

@Scopes(ApiScope.menntamalastofnun)
@Query(() => [SecondarySchoolProgram])
async secondarySchoolProgramsBySchoolId(
@Args('schoolId', { type: () => String }) schoolId: string,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { SecondarySchoolAnswers } from '@island.is/application/templates/secondary-school'
import { Message } from '@island.is/email-service'
import { EmailTemplateGeneratorProps } from '../../../../types'
import { EmailRecipient } from '../types'
import { pathToAsset } from '../utils'
import { ApplicationConfigurations } from '@island.is/application/types'

export type ApplicationRejectedEmail = (
props: EmailTemplateGeneratorProps,
recipient: EmailRecipient,
) => Message

export const generateApplicationRejectedEmail: ApplicationRejectedEmail = (
props,
recipient,
): Message => {
const {
application,
options: { email, clientLocationOrigin },
} = props
const answers = application.answers as SecondarySchoolAnswers

if (!recipient.email) throw new Error('Recipient email was undefined')

const applicantName = answers.applicant.name
const applicantNationalId = answers.applicant.nationalId

const subject = 'Umsókn um framhaldsskóla - Umsókn eydd'

const message =
`<span>Umsókn nemandans</span><br/>` +
`<span>${applicantName}, kt. ${applicantNationalId}</span><br/>` +
`<span>um nám í framhaldsskóla hefur verið eytt.</span><br/>` +
`<span>Þú getur farið inn á mínar síður og skoðað sögu umsóknarinnar.</span>`

return {
from: {
name: email.sender,
address: email.address,
},
to: [{ name: recipient.name, address: recipient.email }],
subject,
template: {
title: subject,
body: [
{
component: 'Image',
context: {
src: pathToAsset('logo.jpg'),
alt: 'Ísland.is logo',
},
},
{
component: 'Image',
context: {
src: pathToAsset('computerIllustration.jpg'),
alt: 'Kaffi við skjá myndskreyting',
},
},
{
component: 'Heading',
context: { copy: subject },
},
{
component: 'Copy',
context: {
copy: message,
},
},
{
component: 'Button',
context: {
copy: 'Skoða umsókn',
href: `${clientLocationOrigin}/${ApplicationConfigurations.SecondarySchool.slug}/${application.id}`,
},
},
],
},
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { SecondarySchoolAnswers } from '@island.is/application/templates/secondary-school'
import { Message } from '@island.is/email-service'
import { EmailTemplateGeneratorProps } from '../../../../types'
import { EmailRecipient } from '../types'
import { pathToAsset } from '../utils'
import { ApplicationConfigurations } from '@island.is/application/types'

export type ApplicationSubmittedEmail = (
props: EmailTemplateGeneratorProps,
recipient: EmailRecipient,
) => Message

export const generateApplicationSubmittedEmail: ApplicationSubmittedEmail = (
props,
recipient,
): Message => {
const {
application,
options: { email, clientLocationOrigin },
} = props
const answers = application.answers as SecondarySchoolAnswers

if (!recipient.email) throw new Error('Recipient email was undefined')

const applicantName = answers.applicant.name
const applicantNationalId = answers.applicant.nationalId

const subject = 'Umsókn um framhaldsskóla - Umsókn send'

const message =
`<span>Umsókn nemandans</span><br/>` +
`<span>${applicantName}, kt. ${applicantNationalId}</span><br/>` +
`<span>í framhaldsskóla hefur verið móttekin.</span><br/>` +
`<span>Þú getur farið inn á mínar síður og fylgst með framgangi umsóknarinnar.</span>`

return {
from: {
name: email.sender,
address: email.address,
},
to: [{ name: recipient.name, address: recipient.email }],
subject,
template: {
title: subject,
body: [
{
component: 'Image',
context: {
src: pathToAsset('logo.jpg'),
alt: 'Ísland.is logo',
},
},
{
component: 'Image',
context: {
src: pathToAsset('computerIllustration.jpg'),
alt: 'Kaffi við skjá myndskreyting',
},
},
{
component: 'Heading',
context: { copy: subject },
},
{
component: 'Copy',
context: {
copy: message,
},
},
{
component: 'Button',
context: {
copy: 'Skoða umsókn',
href: `${clientLocationOrigin}/${ApplicationConfigurations.SecondarySchool.slug}/${application.id}`,
},
},
],
},
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './applicationSubmittedEmail'
export * from './applicationRejectedEmail'
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { Module } from '@nestjs/common'
import { SharedTemplateAPIModule } from '../../shared'
import { SecondarySchoolService } from './secondary-school.service'
import { SecondarySchoolClientModule } from '@island.is/clients/secondary-school'
import { AwsModule } from '@island.is/nest/aws'

@Module({
imports: [SharedTemplateAPIModule, SecondarySchoolClientModule],
imports: [SharedTemplateAPIModule, SecondarySchoolClientModule, AwsModule],
providers: [SecondarySchoolService],
exports: [SecondarySchoolService],
})
Expand Down
Loading

0 comments on commit 95d403e

Please sign in to comment.