requested changes
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
45d4ab80d5
commit
a55d007655
|
@ -14,7 +14,7 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.remoteMethod('deleteNotification', {
|
Self.remoteMethod('deleteNotification', {
|
||||||
description: 'Gets the current user data',
|
description: 'Deletes a notification subscription',
|
||||||
accepts: [
|
accepts: [
|
||||||
{
|
{
|
||||||
arg: 'ctx',
|
arg: 'ctx',
|
||||||
|
@ -22,15 +22,11 @@ module.exports = Self => {
|
||||||
http: {source: 'context'}
|
http: {source: 'context'}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'userId',
|
arg: 'userFk',
|
||||||
type: 'string'
|
type: 'string'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'notificationId',
|
arg: 'notificationFk',
|
||||||
type: 'number'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
arg: 'authorId',
|
|
||||||
type: 'number'
|
type: 'number'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -44,18 +40,16 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.deleteNotification = async function(ctx) {
|
Self.deleteNotification = async function(ctx, userFk, notificationFk) {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const user = await ctx.args.authorId;
|
const user = ctx.req.accessToken.userId;
|
||||||
const notificationId = await ctx.args.notificationId;
|
const modifiedUser = await getUserToModify(userFk, models);
|
||||||
const userId = await ctx.args.userId;
|
|
||||||
const modifiedUser = await getUserToModify(userId, models);
|
|
||||||
|
|
||||||
if (user == modifiedUser.id || modifiedUser.bossFk == user) {
|
if (user == modifiedUser.id || modifiedUser.bossFk == user) {
|
||||||
const query = `DELETE FROM util.notificationSubscription
|
const query = `DELETE FROM util.notificationSubscription
|
||||||
WHERE notificationFk = ? AND userFk = ?`;
|
WHERE notificationFk = ? AND userFk = ?`;
|
||||||
|
|
||||||
await Self.rawSql(query, [notificationId, userId]);
|
await Self.rawSql(query, [notificationFk, userFk]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -1,11 +1,4 @@
|
||||||
INSERT INTO
|
INSERT INTO `salix`.`ACL` (model,property,accessType,principalId)
|
||||||
`salix`.`ACL` (
|
VALUES ('NotificationSubscription','*','*','employee');
|
||||||
`model`,
|
INSERT INTO `salix`.`ACL` (model,property,accessType,principalId)
|
||||||
`property`,
|
VALUES ('NotificationAcl','*','*','employee');
|
||||||
`accessType`,
|
|
||||||
`permission`,
|
|
||||||
`principalId`
|
|
||||||
)
|
|
||||||
VALUES
|
|
||||||
('NotificationSubscription', '*', '*', 'employee'),
|
|
||||||
('NotificationAcl', '*', '*', 'employee');
|
|
||||||
|
|
Loading…
Reference in New Issue