Some icons changed, first implementation of contact edit
This commit is contained in:
@@ -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();
|
||||
Reference in New Issue
Block a user