Implemented bulk import of persons

This commit is contained in:
Murat Özkorkmaz
2025-11-04 12:29:32 +01:00
parent 60dc35961a
commit d85406f0c7
19 changed files with 1134 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
meta {
name: Auth
name: Auth App
type: http
seq: 2
seq: 1
}
post {

View File

@@ -0,0 +1,47 @@
meta {
name: Auth Bruno
type: http
seq: 2
}
post {
url: {{KEYCLOAK_BASE_URL}}/realms/{{KEYCLOAK_REALM}}/protocol/openid-connect/token
body: formUrlEncoded
auth: inherit
}
headers {
Content-Type: application/x-www-form-urlencoded
}
body:form-urlencoded {
grant_type: client_credentials
client_id: {{KEYCLOAK_BRUNO_CLIENT_ID}}
client_secret: {{KEYCLOAK_BRUNO_CLIENT_SECRET}}
}
script:post-response {
// Parse die JSON-Antwort
const jsonResponse = res.body;
if (jsonResponse.access_token) {
// Schreibe den access_token in eine Umgebungsvariable
// oder in eine collection-Variable
// Option 1: In eine Umgebungsvariable schreiben
// (z.B. für eine bestimmte Umgebung wie "Development")
bru.setEnvVar("BEARER_TOKEN", jsonResponse.access_token);
// Option 2: In eine Collection-Variable schreiben
// (Diese Variable ist global für alle Anfragen in deiner Collection)
// bru.setVar("bearerToken", "Bearer " + jsonResponse.access_token);
} else {
// optional: Error Handling, falls der Token nicht in der Antwort ist
console.log("Error: access_token not found in the response.");
}
}
settings {
encodeUrl: false
}

View File

@@ -0,0 +1,39 @@
meta {
name: Upload files
type: http
seq: 1
}
post {
url: {{API_BASE_URL}}/api/{{API_VERSION}}/data-import/persons
body: multipartForm
auth: bearer
}
auth:bearer {
token: {{BEARER_TOKEN}}
}
body:json {
{
"name": "Bungalow",
"street": "Hebbelstraße",
"houseNumber": "30",
"zipCode": "55127",
"city": "Mainz",
"country": "DE",
"notes": "Lorem ipsum"
}
}
body:multipart-form {
file: @file(/Users/muratoezkorkmaz/projects/misc/skamp/init_data/people-17911945-22.xlsx)
}
body:file {
file: @file(/Users/murat/Pictures/IMG_0229.jpeg) @contentType(image/jpeg)
}
settings {
encodeUrl: true
}

View File

@@ -0,0 +1,8 @@
meta {
name: DataImport
seq: 6
}
auth {
mode: inherit
}

View File

@@ -1,13 +1,15 @@
vars {
API_BASE_URL: http://localhost:8080
API_BASE_URL: http://localhost:8180
API_VERSION: v1
KEYCLOAK_BASE_URL: http://localhost:8280
KEYCLOAK_BASE_URL: https://kc.dev.localhost
DEV_USERNAME: dev@example.com
DEV_PASSWORD: dev
ADMIN_USERNAME: admin@example.com
ADMIN_PASSWORD: admin
KEYCLOAK_CLIENT_ID: skamp-app
KEYCLOAK_REALM: skamp
KEYCLOAK_BRUNO_CLIENT_ID: skamp-bruno
KEYCLOAK_BRUNO_CLIENT_SECRET: sNQpCVyVckGo5AZw7FqeW0POtgWuXzJt
}
vars:secret [
BEARER_TOKEN