From a3f19462c37556611d64dc99501786dee9158483 Mon Sep 17 00:00:00 2001 From: Simon Oberzier Date: Thu, 11 Jun 2026 08:30:02 +0200 Subject: [PATCH] Better test script and api changes --- api.yaml | 12 ++++++------ src/copybooks/student.cpy | 5 +++++ src/fetch_account.cbl | 0 src/fetch_student.cbl | 20 ++++++++++++++++++++ src/structures/account_res.cpy | 0 5 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 src/copybooks/student.cpy delete mode 100644 src/fetch_account.cbl create mode 100644 src/fetch_student.cbl delete mode 100644 src/structures/account_res.cpy diff --git a/api.yaml b/api.yaml index e887d19..636c202 100644 --- a/api.yaml +++ b/api.yaml @@ -1,14 +1,14 @@ version: "1.0" -project: "legacy-finance-api" +project: "legacy-student-api" endpoints: - - path: "/accounts/{id}" + - path: "/students/{id}" method: "GET" - cobol_source: "src/fetch_account.cbl" - procedure: "GET-ACCOUNT-DATA" + cobol_source: "src/fetch_student.cbl" + procedure: "FETCH-STUDENT" arguments: - name: "id" target: "LK-ID" - type: "PIC X(10)" + type: "PIC 9(5)" source: "path" - response_copybook: "src/structures/account_res.cpy" \ No newline at end of file + response_copybook: "src/copybooks/student_res.cpy" \ No newline at end of file diff --git a/src/copybooks/student.cpy b/src/copybooks/student.cpy new file mode 100644 index 0000000..51ea826 --- /dev/null +++ b/src/copybooks/student.cpy @@ -0,0 +1,5 @@ + 01 STUDENT. + 05 ST-ID PIC 9(5). + 05 FIRST-NAME PIC X(20). + 05 LAST-NAME PIC X(20). + \ No newline at end of file diff --git a/src/fetch_account.cbl b/src/fetch_account.cbl deleted file mode 100644 index e69de29..0000000 diff --git a/src/fetch_student.cbl b/src/fetch_student.cbl new file mode 100644 index 0000000..99dc2c9 --- /dev/null +++ b/src/fetch_student.cbl @@ -0,0 +1,20 @@ + IDENTIFICATION DIVISION. + PROGRAM-ID. FETCH-STUDENT. + AUTHOR. OBERZIER. + + DATA DIVISION. + LINKAGE SECTION. + 01 LK-ID PIC 9(5). + COPY "copybooks/student". + + PROCEDURE DIVISION USING LK-ID STUDENT. + 0001-FETCH-STUDENT. + IF LK-ID = 34401 + MOVE 34401 TO ST-ID + MOVE "Lukas" TO FIRST-NAME + MOVE "King" TO LAST-NAME + ELSE + MOVE 0 TO ST-ID + MOVE "Not" TO FIRST-NAME + MOVE "Found" TO LAST-NAME + END-IF. diff --git a/src/structures/account_res.cpy b/src/structures/account_res.cpy deleted file mode 100644 index e69de29..0000000