SELECT
    assignment.eventId,
    assignment.availabilityId,
    assignment.function AS "function: Function",
    assignment.startTimestamp,
    assignment.endTimestamp
FROM assignment
JOIN
    availability ON assignment.availabilityId = availability.id
WHERE
    assignment.starttimestamp::date >= $1
    AND assignment.starttimestamp::date <= $2
    AND availability.userId = $3
ORDER BY assignment.starttimestamp;
