implement global update
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
async function update(options) {
|
||||
const {
|
||||
global: globalSlug,
|
||||
depth,
|
||||
locale,
|
||||
fallbackLocale,
|
||||
data,
|
||||
} = options;
|
||||
|
||||
const globalConfig = this.globals.config.find((config) => config.slug === globalSlug);
|
||||
|
||||
return this.operations.globals.update({
|
||||
slug: globalSlug,
|
||||
data,
|
||||
depth,
|
||||
globalConfig,
|
||||
overrideAccess: true,
|
||||
req: {
|
||||
payloadAPI: 'local',
|
||||
locale,
|
||||
fallbackLocale,
|
||||
payload: this,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = update;
|
||||
|
||||
@@ -97,6 +97,7 @@ class Payload {
|
||||
this.create = this.create.bind(this);
|
||||
this.find = this.find.bind(this);
|
||||
this.findGlobal = this.findGlobal.bind(this);
|
||||
this.updateGlobal = this.updateGlobal.bind(this);
|
||||
this.findByID = this.findByID.bind(this);
|
||||
this.update = this.update.bind(this);
|
||||
this.register = this.register.bind(this);
|
||||
@@ -136,6 +137,12 @@ class Payload {
|
||||
return findOne(options);
|
||||
}
|
||||
|
||||
async updateGlobal(options) {
|
||||
let { update } = localGlobalOperations;
|
||||
update = update.bind(this);
|
||||
return update(options);
|
||||
}
|
||||
|
||||
async findByID(options) {
|
||||
let { findByID } = localOperations;
|
||||
findByID = findByID.bind(this);
|
||||
|
||||
Reference in New Issue
Block a user