Skip to content

Commit

Permalink
fix: korjaa vuorovaikutustilaisuuden paikka ja postitoimipaikka valin…
Browse files Browse the repository at this point in the history
…naisiksi kentiksi myös backendissä (#581)
  • Loading branch information
haapamakim committed Feb 2, 2023
1 parent 9dceb47 commit f3671c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 6 additions & 1 deletion backend/src/asiakirja/lambda/pdfGeneratorClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ class PdfGeneratorClient {

const result = await invokeLambda(config.pdfGeneratorLambdaArn, true, JSON.stringify(event));
if (result) {
return JSON.parse(result);
const response = JSON.parse(result);
if (!response.errorType) {
return response;
} else {
log.error("PDF-generointi ei onnistunut", { response });
}
}
log.error(event);
throw new Error("PDF-generointi ei onnistunut");
Expand Down
8 changes: 2 additions & 6 deletions backend/src/asiakirja/suunnittelunAloitus/Kutsu20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,11 @@ export class Kutsu20 extends CommonPdf<SuunnitteluVaiheKutsuAdapter> {
continued: true,
});
this.doc.font("ArialMT");

// tilaisuus.paikka on oltava, koska tilaisuustyyppi on PAIKALLA
assertIsDefined(tilaisuus.paikka);
// tilaisuus.osoite, tilaisuus.postinumero on oltava, koska tilaisuustyyppi on PAIKALLA
assertIsDefined(tilaisuus.postinumero);
assertIsDefined(tilaisuus.postitoimipaikka);
const place = safeConcatStrings(", ", [
tilaisuus.paikka,
[tilaisuus.osoite, safeConcatStrings(" ", [tilaisuus.postinumero, tilaisuus.postitoimipaikka])].join(", "),
tilaisuus.paikka || undefined,
[tilaisuus.osoite, safeConcatStrings(" ", [tilaisuus.postinumero, tilaisuus.postitoimipaikka || undefined])].join(", "),
]);
this.doc
.text(place, {
Expand Down

0 comments on commit f3671c3

Please sign in to comment.