Initial commit

This commit is contained in:
s4luorth
2026-02-07 13:04:04 +01:00
commit 5e0fceab15
82 changed files with 30348 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
meta {
name: 1 Health Check
type: http
seq: 1
}
get {
url: {{baseUrl}}/health
body: none
auth: none
}
tests {
test("Status is 200", function() {
expect(res.status).to.equal(200);
});
test("Scriptalizer is configured", function() {
expect(res.body.scriptalizer).to.equal("configured");
});
}

View File

@@ -0,0 +1,51 @@
meta {
name: 2 Preview Batch - Single Letter
type: http
seq: 2
}
post {
url: {{baseUrl}}/api/preview/batch
body: json
auth: none
}
body:json {
{
"sessionId": "{{sessionId}}",
"batchIndex": 0,
"forceRegenerate": false,
"config": {
"font": "tilda",
"letters": [
{
"index": 0,
"format": "a4",
"text": "Hallo [[Vorname]] [[Nachname]],\n\ndein persönlicher Gutscheincode lautet: [[Gutscheincode]]\n\nEr ist gültig bis zum [[Ablaufdatum]].\n\nViele Grüße,\nDein Skrift-Team",
"placeholders": {
"Vorname": "Max",
"Nachname": "Mustermann",
"Gutscheincode": "SAVE20",
"Ablaufdatum": "31.12.2026"
}
}
],
"envelopes": []
}
}
}
tests {
test("Status is 200", function() {
expect(res.status).to.equal(200);
});
test("Returns session ID", function() {
expect(res.body.sessionId).to.be.a("string");
});
test("Returns files array", function() {
expect(res.body.files).to.be.an("array");
expect(res.body.files.length).to.be.greaterThan(0);
});
}

View File

@@ -0,0 +1,60 @@
meta {
name: 3 Preview Batch - With Envelope
type: http
seq: 3
}
post {
url: {{baseUrl}}/api/preview/batch
body: json
auth: none
}
body:json {
{
"sessionId": "{{sessionId}}",
"batchIndex": 0,
"forceRegenerate": false,
"config": {
"font": "alva",
"letters": [
{
"index": 0,
"format": "a6p",
"text": "Liebe [[Vorname]],\n\nvielen Dank für deine Bestellung!\n\nHerzliche Grüße",
"placeholders": {
"Vorname": "Anna",
"Nachname": "Schmidt",
"Strasse": "Bahnhofstr. 5",
"PLZ": "80331",
"Ort": "München"
}
}
],
"envelopes": [
{
"index": 0,
"format": "c6",
"type": "recipient",
"data": {
"Vorname": "Anna",
"Nachname": "Schmidt",
"Strasse": "Bahnhofstr. 5",
"PLZ": "80331",
"Ort": "München"
}
}
]
}
}
}
tests {
test("Returns letter and envelope", function() {
const files = res.body.files;
const hasLetter = files.some(f => f.type === "letter");
const hasEnvelope = files.some(f => f.type === "envelope");
expect(hasLetter).to.be.true;
expect(hasEnvelope).to.be.true;
});
}

View File

@@ -0,0 +1,39 @@
meta {
name: 4 Preview Batch - Custom Envelope Text
type: http
seq: 4
}
post {
url: {{baseUrl}}/api/preview/batch
body: json
auth: none
}
body:json {
{
"sessionId": "{{sessionId}}-custom",
"batchIndex": 0,
"config": {
"font": "ellie",
"letters": [
{
"index": 0,
"format": "a6l",
"text": "Alles Gute zum Geburtstag!",
"placeholders": {}
}
],
"envelopes": [
{
"index": 0,
"format": "din_lang",
"type": "custom",
"data": {
"customText": "Für meine großartige Freundin Caro"
}
}
]
}
}
}

View File

@@ -0,0 +1,39 @@
meta {
name: 5 Order Finalize
type: http
seq: 5
}
post {
url: {{baseUrl}}/api/order/finalize
body: json
auth: none
}
body:json {
{
"sessionId": "{{sessionId}}",
"orderNumber": "{{orderNumber}}"
}
}
docs {
Finalisiert eine Bestellung aus dem Preview-Cache.
WICHTIG: Vorher muss ein Preview Batch generiert worden sein!
Run "2 Preview Batch - Single Letter" first.
}
tests {
test("Status is 200", function() {
expect(res.status).to.equal(200);
});
test("Returns order number", function() {
expect(res.body.orderNumber).to.equal(bru.getEnvVar("orderNumber"));
});
test("Has output path", function() {
expect(res.body.outputPath).to.be.a("string");
});
}

View File

@@ -0,0 +1,96 @@
meta {
name: 6 Order Generate
type: http
seq: 6
}
post {
url: {{baseUrl}}/api/order/generate
body: json
auth: none
}
body:json {
{
"orderNumber": "SK-2026-01-15-002",
"config": {
"font": "tilda",
"letters": [
{
"index": 0,
"format": "a4",
"text": "Sehr geehrte/r [[Vorname]] [[Nachname]],\n\nhiermit bestätigen wir Ihre Bestellung.\n\nMit freundlichen Grüßen",
"placeholders": {
"Vorname": "Thomas",
"Nachname": "Müller",
"Strasse": "Lindenweg 12",
"PLZ": "50667",
"Ort": "Köln"
}
},
{
"index": 1,
"format": "a4",
"text": "Sehr geehrte/r [[Vorname]] [[Nachname]],\n\nhiermit bestätigen wir Ihre Bestellung.\n\nMit freundlichen Grüßen",
"placeholders": {
"Vorname": "Julia",
"Nachname": "Weber",
"Strasse": "Kastanienallee 7",
"PLZ": "60311",
"Ort": "Frankfurt"
}
}
],
"envelopes": [
{
"index": 0,
"format": "c6",
"type": "recipient",
"data": {
"Vorname": "Thomas",
"Nachname": "Müller",
"Strasse": "Lindenweg 12",
"PLZ": "50667",
"Ort": "Köln"
}
},
{
"index": 1,
"format": "c6",
"type": "recipient",
"data": {
"Vorname": "Julia",
"Nachname": "Weber",
"Strasse": "Kastanienallee 7",
"PLZ": "60311",
"Ort": "Frankfurt"
}
}
]
}
}
}
docs {
Generiert eine Bestellung direkt (ohne Preview-Cache).
Use case: Retry nach Fehler oder manuelles Regenerieren.
}
tests {
test("Status is 200", function() {
expect(res.status).to.equal(200);
});
test("Generated 2 letters", function() {
expect(res.body.files.letters).to.equal(2);
});
test("Generated 2 envelopes", function() {
expect(res.body.files.envelopes).to.equal(2);
});
test("Has CSV", function() {
expect(res.body.files.csv).to.be.a("string");
});
}

View File

@@ -0,0 +1,5 @@
{
"version": "1",
"name": "Skrift Backend API",
"type": "collection"
}

View File

@@ -0,0 +1,5 @@
vars {
baseUrl: http://localhost:4000
sessionId: test-session-{{$timestamp}}
orderNumber: SK-2026-01-15-001
}