refactor(pdfgeneration): Switched contract generation over to new document-server
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
This commit is contained in:
@@ -7,7 +7,7 @@ class DocumentServer {
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
|
||||
async generateCards(cards: any[], locale: string, filename: string) {
|
||||
async generateCards(cards: any[], locale: string) {
|
||||
const generateCards = new Array<any>();
|
||||
|
||||
for (let i = 0; i < cards.length; i++) {
|
||||
@@ -44,6 +44,40 @@ class DocumentServer {
|
||||
const blob = await response.blob();
|
||||
return blob;
|
||||
}
|
||||
|
||||
async generateContracts(runners: any[], locale: string) {
|
||||
const generateRunners = new Array<any>();
|
||||
|
||||
for (let i = 0; i < runners.length; i++) {
|
||||
console.log(runners[i])
|
||||
const card = {
|
||||
id: runners[i].id,
|
||||
first_name: runners[i].firstname,
|
||||
middle_name: runners[i].middlename,
|
||||
last_name: runners[i].lastname,
|
||||
group: {
|
||||
id: runners[i].group.id,
|
||||
name: runners[i].group.name,
|
||||
}
|
||||
}
|
||||
generateRunners.push(card)
|
||||
|
||||
}
|
||||
|
||||
const response = await fetch(`${this.baseUrl}/v1/pdfs/contracts?key=${this.apiKey}`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
locale,
|
||||
runners: generateRunners,
|
||||
}),
|
||||
});
|
||||
|
||||
const blob = await response.blob();
|
||||
return blob;
|
||||
}
|
||||
}
|
||||
|
||||
export default DocumentServer;
|
||||
Reference in New Issue
Block a user