Skip to content

Commit

Permalink
Merge branch 'main' into cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-vogel authored Jul 17, 2024
2 parents 6097eb1 + bfd67a5 commit 5df1c76
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
9 changes: 0 additions & 9 deletions lib/resolvers/crud/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ module.exports = async ({ req, res }, service, entity, selection) => {
const entries = entriesStructureToEntityStructure(service, entity, astToEntries(input))
query.entries(entries)

if (cds.env.features.cds_validate) {
const assertOptions = { mandatories: true }
const errs = cds.validate(entries, entity, assertOptions)
if (errs) {
if (errs.length === 1) throw errs[0]
throw Object.assign(new Error('MULTIPLE_ERRORS'), { statusCode: 400, details: errs })
}
}

const result = await service.dispatch(new GraphQLRequest({ req, res, query }))

return formatResult(entity, selection, result, false)
Expand Down
9 changes: 0 additions & 9 deletions lib/resolvers/crud/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@ module.exports = async ({ req, res }, service, entity, selection) => {
const entries = entriesStructureToEntityStructure(service, entity, astToEntries(input))
query.with(entries)

if (cds.env.features.cds_validate) {
const assertOptions = { mandatories: true }
const errs = cds.validate(entries, entity, assertOptions)
if (errs) {
if (errs.length === 1) throw errs[0]
throw Object.assign(new Error('MULTIPLE_ERRORS'), { statusCode: 400, details: errs })
}
}

let resultBeforeUpdate
const result = await service.tx(async tx => {
// read needs to be done before the update, otherwise the where clause might become invalid (case that properties in where clause are updated by the mutation)
Expand Down

0 comments on commit 5df1c76

Please sign in to comment.