Add active scope to Codium model and set on delete (#11)
continuous-integration/drone/push Build is passing Details

master
Garrett Mills 4 years ago
parent a0b5003087
commit 597c269cd9
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246

@ -88,7 +88,8 @@ class FormCode extends Controller {
const code = await Codium.findOne({UUID: req.params.CodiumId})
if ( !code ) return res.status(404).message('Unable to find code with that ID.').api({})
await code.delete()
code.Active = false
await code.save()
return res.api({})
}
}

@ -1,5 +1,6 @@
const Model = require('flitter-orm/src/model/Model')
const uuid = require('uuid/v4')
const ActiveScope = require('../scopes/Active.scope')
/*
* Codium Model
@ -15,8 +16,11 @@ class Codium extends Model {
PageId: String,
code: String,
UUID: { type: String, default: () => uuid() },
Active: { type: Boolean, default: true },
}
}
static scopes = [new ActiveScope]
// Static and instance methods can go here
get page() {

Loading…
Cancel
Save