feat: Webhooks configuration, all events support, refactoring

This commit is contained in:
Maksim Eltyshev
2024-06-12 00:51:36 +02:00
parent 3779bdb053
commit c065566c15
96 changed files with 1280 additions and 509 deletions

View File

@@ -71,6 +71,8 @@ module.exports = {
},
async fn(inputs) {
const { currentUser } = this.req;
if (sails.config.custom.oidcEnforced) {
throw Errors.NOT_ENOUGH_RIGHTS;
}
@@ -89,6 +91,7 @@ module.exports = {
const user = await sails.helpers.users.createOne
.with({
values,
actorUser: currentUser,
request: this.req,
})
.intercept('emailAlreadyInUse', () => Errors.EMAIL_ALREADY_IN_USE)

View File

@@ -26,6 +26,8 @@ module.exports = {
},
async fn(inputs) {
const { currentUser } = this.req;
let user = await sails.helpers.users.getOne(inputs.id);
if (!user) {
@@ -38,6 +40,7 @@ module.exports = {
user = await sails.helpers.users.deleteOne.with({
record: user,
actorUser: currentUser,
request: this.req,
});

View File

@@ -91,7 +91,7 @@ module.exports = {
values: {
avatar: fileData,
},
user: currentUser,
actorUser: currentUser,
request: this.req,
});

View File

@@ -82,7 +82,7 @@ module.exports = {
.with({
values,
record: user,
user: currentUser,
actorUser: currentUser,
request: this.req,
})
.intercept('emailAlreadyInUse', () => Errors.EMAIL_ALREADY_IN_USE);

View File

@@ -80,7 +80,7 @@ module.exports = {
user = await sails.helpers.users.updateOne.with({
values,
record: user,
user: currentUser,
actorUser: currentUser,
request: this.req,
});

View File

@@ -83,7 +83,7 @@ module.exports = {
.with({
values,
record: user,
user: currentUser,
actorUser: currentUser,
request: this.req,
})
.intercept('usernameAlreadyInUse', () => Errors.USERNAME_ALREADY_IN_USE);

View File

@@ -95,7 +95,7 @@ module.exports = {
user = await sails.helpers.users.updateOne.with({
values,
record: user,
user: currentUser,
actorUser: currentUser,
request: this.req,
});