Improve infra as code support (#4867)

* Fix: enable creating of documentstores with the loaders

* Feature: Support posting credentials with a specific id to enabled infrastructure as code
This commit is contained in:
Karl Stoney 2025-07-21 16:49:21 +02:00 committed by GitHub
parent e8c36b6894
commit d77919ba50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -299,8 +299,8 @@ export class DocumentStoreDTO {
static toEntity(body: any): DocumentStore { static toEntity(body: any): DocumentStore {
const docStore = new DocumentStore() const docStore = new DocumentStore()
Object.assign(docStore, body) Object.assign(docStore, body)
docStore.loaders = '[]' docStore.loaders = body.loaders ?? '[]'
docStore.whereUsed = '[]' docStore.whereUsed = body.whereUsed ?? '[]'
// when a new document store is created, it is empty and in sync // when a new document store is created, it is empty and in sync
docStore.status = DocumentStoreStatus.EMPTY_SYNC docStore.status = DocumentStoreStatus.EMPTY_SYNC
return docStore return docStore

View File

@ -14,6 +14,11 @@ const createCredential = async (requestBody: any) => {
try { try {
const appServer = getRunningExpressApp() const appServer = getRunningExpressApp()
const newCredential = await transformToCredentialEntity(requestBody) const newCredential = await transformToCredentialEntity(requestBody)
if (requestBody.id) {
newCredential.id = requestBody.id
}
const credential = await appServer.AppDataSource.getRepository(Credential).create(newCredential) const credential = await appServer.AppDataSource.getRepository(Credential).create(newCredential)
const dbResponse = await appServer.AppDataSource.getRepository(Credential).save(credential) const dbResponse = await appServer.AppDataSource.getRepository(Credential).save(credential)
return dbResponse return dbResponse