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', {
|
||||
description: 'Gets the current user data',
|
||||
description: 'Deletes a notification subscription',
|
||||
accepts: [
|
||||
{
|
||||
arg: 'ctx',
|
||||
|
@ -22,15 +22,11 @@ module.exports = Self => {
|
|||
http: {source: 'context'}
|
||||
},
|
||||
{
|
||||
arg: 'userId',
|
||||
arg: 'userFk',
|
||||
type: 'string'
|
||||
},
|
||||
{
|
||||
arg: 'notificationId',
|
||||
type: 'number'
|
||||
},
|
||||
{
|
||||
arg: 'authorId',
|
||||
arg: 'notificationFk',
|
||||
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 user = await ctx.args.authorId;
|
||||
const notificationId = await ctx.args.notificationId;
|
||||
const userId = await ctx.args.userId;
|
||||
const modifiedUser = await getUserToModify(userId, models);
|
||||
const user = ctx.req.accessToken.userId;
|
||||
const modifiedUser = await getUserToModify(userFk, models);
|
||||
|
||||
if (user == modifiedUser.id || modifiedUser.bossFk == user) {
|
||||
const query = `DELETE FROM util.notificationSubscription
|
||||
WHERE notificationFk = ? AND userFk = ?`;
|
||||
|
||||
await Self.rawSql(query, [notificationId, userId]);
|
||||
await Self.rawSql(query, [notificationFk, userFk]);
|
||||
|
||||
return;
|
||||
} else
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
INSERT INTO
|
||||
`salix`.`ACL` (
|
||||
`model`,
|
||||
`property`,
|
||||
`accessType`,
|
||||
`permission`,
|
||||
`principalId`
|
||||
)
|
||||
VALUES
|
||||
('NotificationSubscription', '*', '*', 'employee'),
|
||||
('NotificationAcl', '*', '*', 'employee');
|
||||
INSERT INTO `salix`.`ACL` (model,property,accessType,principalId)
|
||||
VALUES ('NotificationSubscription','*','*','employee');
|
||||
INSERT INTO `salix`.`ACL` (model,property,accessType,principalId)
|
||||
VALUES ('NotificationAcl','*','*','employee');
|
||||
|
|
Loading…
Reference in New Issue