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:
parent
e8c36b6894
commit
d77919ba50
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue