Some icons changed, first implementation of contact edit

This commit is contained in:
Torsten Schulz
2024-08-21 23:05:11 +02:00
parent dfdb1660ff
commit c5a72d57d8
21 changed files with 134 additions and 5 deletions

View File

@@ -4,13 +4,11 @@ import InterestType from "../models/type/interest.js"
import InterestTranslationType from "../models/type/interest_translation.js"
import User from "../models/community/user.js";
import UserParamValue from "../models/type/user_param_value.js";
import ContactMessage from "../models/service/contactmessage.js";
class AdminService {
async hasUserAccess(userId, section) {
const userRights = await UserRight.findAll({
/* where: {
userId: userId,
},*/
include: [{
model: UserRightType,
as: 'rightType',
@@ -119,6 +117,18 @@ class AdminService {
}
}
}
async getOpenContacts(userId) {
if (!this.hasUserAccess(userId, 'contacts')) {
throw new Error('noaccess');
}
const openContacts = await ContactMessage.findAll({
where: {
isFinished: false,
}
})
return openContacts;
}
}
export default new AdminService();