-- แก้ไขตรวจสอบ ระบบ interface ให้ใช้งาน ได้ สมบูรแบบ

This commit is contained in:
2025-11-17 14:48:03 +07:00
parent 05dfb9a39e
commit 0185c54fb3
4 changed files with 17 additions and 15 deletions

View File

@@ -8,17 +8,17 @@ export class BdgmstInterface {
this.pk = ['bdgseq']
}
async saveInterface(database, data) {
const method = data.methods.toLowerCase()
const payload = { ...data }
delete payload.method
async saveInterface(database, data) {
const method = data.methods.toLowerCase()
const { methods, ...payload } = data
if (method === 'put') return this.update(database, payload)
if (method === 'post') return this.insert(database, payload)
if (method === 'delete') return this.remove(database, payload)
if (method === 'put') return this.update(database, payload)
if (method === 'post') return this.insert(database, payload)
if (method === 'delete') return this.remove(database, payload)
throw new Error(`Unknown method: ${method}`)
}
throw new Error(`Unknown method: ${method}`)
}
async insert(database, payload) {
const cols = Object.keys(payload)