feat(branches): add director assignment status and update overview view
Some checks failed
Deploy to production / deploy (push) Failing after 1m18s
Some checks failed
Deploy to production / deploy (push) Failing after 1m18s
This commit is contained in:
@@ -1055,6 +1055,20 @@ class FalukantService extends BaseService {
|
||||
if (u.certificate == null) {
|
||||
u.setDataValue('certificate', 1);
|
||||
}
|
||||
const directors = await Director.findAll({
|
||||
where: { employerUserId: u.id },
|
||||
attributes: [],
|
||||
include: [{
|
||||
model: FalukantCharacter,
|
||||
as: 'character',
|
||||
attributes: ['regionId'],
|
||||
required: true,
|
||||
}],
|
||||
});
|
||||
const directorRegionIds = new Set(directors.map((director) => director.character.regionId));
|
||||
for (const branch of u.branches ?? []) {
|
||||
branch.setDataValue('hasDirector', directorRegionIds.has(branch.regionId));
|
||||
}
|
||||
// Load UserHouse and HouseType in separate queries to avoid EagerLoadingError
|
||||
let userHouse = null;
|
||||
if (u.id != null) {
|
||||
|
||||
Reference in New Issue
Block a user