Skip to content

Commit

Permalink
ar(fix) type nit
Browse files Browse the repository at this point in the history
  • Loading branch information
angeloreale committed Aug 30, 2024
1 parent bfcf11f commit 1e34ea7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/auth/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,17 @@ export const GetSession = async ({ cookies = '' }) => {
// schema sanitizer
const allUsersSideEffects = async ({ user }: any) => {
if (!user) return;
const userServices = user.servicesIds || [];
const userAbilities = user.abilitiesIds || [];
const services = await GetPrivateCommonServices({});
const abilities = await GetPrivateCommonAbilities({});
const commonServices = services.map((service: any) => service?.id).map((el: any) => el);
const commonAbilities = abilities.map((ability: any) => ability?.id).map((el: any) => el);

const [dpcpAbility] = await GetPrivateAbilities({ type: 'R', target: 'dpcp-vibemodulator', action: 'view-listings' });

const nextAbilities = _.uniq([...commonAbilities, ...user.abilitiesIds, dpcpAbility?.id]);
const nextServices = _.uniq([...commonServices, ...user.servicesIds]);
const nextAbilities = _.uniq([...commonAbilities, userAbilities, dpcpAbility?.id]);
const nextServices = _.uniq([...commonServices, userServices]);

await UpdatePrivateUserServices({ user, services: nextServices, upsert: false });
await UpdatePrivateUserAbilities({
Expand Down

0 comments on commit 1e34ea7

Please sign in to comment.