Skip to content

Commit

Permalink
fix init sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
DanSchlachter committed Mar 1, 2024
1 parent db87607 commit a226e40
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions xmpls/attachments/db/init.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
const cds = require('@sap/cds/lib')
module.exports = async function () {

// this ensures customers are in the db
cds.once('served', async () => {
const { 'sap.capire.incidents.Customers': Customers } = cds.model.entities
await UPDATE (Customers) .set ('avatar_ID = ID')
})

const attachments = await cds.connect.to('attachments')
const { join } = cds.utils.path
const { createReadStream } = cds.utils.fs
Expand Down Expand Up @@ -28,6 +35,5 @@ module.exports = async function () {
content: createReadStream (join(__dirname, 'content', filename)),
})))

const { 'sap.capire.incidents.Customers': Customers } = cds.model.entities
await UPDATE (Customers) .set ('avatar_ID = ID')

}

0 comments on commit a226e40

Please sign in to comment.