Browse Source

Fix showing events for a specific user

Signed-off-by: BlackDex <black.dex@gmail.com>
pull/7558/head
BlackDex 2 months ago
parent
commit
361dbab957
No known key found for this signature in database GPG Key ID: 58C80A2AA6C765E1
  1. 10
      src/db/models/event.rs

10
src/db/models/event.rs

@ -298,12 +298,16 @@ impl Event {
) -> Vec<Self> { ) -> Vec<Self> {
conn.run(move |conn| { conn.run(move |conn| {
event::table event::table
.inner_join(users_organizations::table.on(users_organizations::uuid.eq(member_uuid))) .inner_join(
users_organizations::table
.on(users_organizations::uuid.eq(member_uuid).and(users_organizations::org_uuid.eq(org_uuid))),
)
.filter(event::org_uuid.eq(org_uuid)) .filter(event::org_uuid.eq(org_uuid))
.filter(event::event_date.between(start, end)) .filter(event::event_date.between(start, end))
.filter( .filter(
event::user_uuid event::org_user_uuid
.eq(users_organizations::user_uuid.nullable()) .eq(member_uuid)
.or(event::user_uuid.eq(users_organizations::user_uuid.nullable()))
.or(event::act_user_uuid.eq(users_organizations::user_uuid.nullable())), .or(event::act_user_uuid.eq(users_organizations::user_uuid.nullable())),
) )
.select(event::all_columns) .select(event::all_columns)

Loading…
Cancel
Save