Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rajoitetaan uuden työntekijän näkemiä ryhmäpostilaatikon viestejä #5885

Merged
merged 7 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions frontend/src/e2e-test/dev-api/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,11 @@ export class FamilyBuilder extends FixtureBuilder<Family> {

export class EmployeeBuilder extends FixtureBuilder<DevEmployee> {
daycareAcl: { unitId: string; role: ScopedRole }[]
groupAcl: string[]
groupAcl: {
groupId: string
created?: HelsinkiDateTime
updated?: HelsinkiDateTime
}[]

constructor(data: DevEmployee) {
super(data)
Expand Down Expand Up @@ -1370,8 +1374,12 @@ export class EmployeeBuilder extends FixtureBuilder<DevEmployee> {
return this
}

withGroupAcl(groupId: string): this {
this.groupAcl.push(groupId)
withGroupAcl(
groupId: string,
created?: HelsinkiDateTime,
updated?: HelsinkiDateTime
): this {
this.groupAcl.push({ groupId, created, updated })
return this
}

Expand All @@ -1387,9 +1395,11 @@ export class EmployeeBuilder extends FixtureBuilder<DevEmployee> {
}
if (this.groupAcl.length > 0) {
await createDaycareGroupAclRows({
body: this.groupAcl.map((groupId) => ({
body: this.groupAcl.map(({ groupId, created, updated }) => ({
groupId,
employeeId: this.data.id
employeeId: this.data.id,
created: created ?? HelsinkiDateTime.now(),
updated: updated ?? HelsinkiDateTime.now()
}))
})
}
Expand Down
11 changes: 11 additions & 0 deletions frontend/src/e2e-test/generated/api-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,10 @@ export interface DevDaycareGroup {
* Generated from fi.espoo.evaka.shared.dev.DevDaycareGroupAcl
*/
export interface DevDaycareGroupAcl {
created: HelsinkiDateTime
employeeId: UUID
groupId: UUID
updated: HelsinkiDateTime
}

/**
Expand Down Expand Up @@ -1316,6 +1318,15 @@ export function deserializeJsonDevDaycareGroup(json: JsonOf<DevDaycareGroup>): D
}


export function deserializeJsonDevDaycareGroupAcl(json: JsonOf<DevDaycareGroupAcl>): DevDaycareGroupAcl {
return {
...json,
created: HelsinkiDateTime.parseIso(json.created),
updated: HelsinkiDateTime.parseIso(json.updated)
}
}


export function deserializeJsonDevDaycareGroupPlacement(json: JsonOf<DevDaycareGroupPlacement>): DevDaycareGroupPlacement {
return {
...json,
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/e2e-test/specs/6_mobile/messages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ beforeEach(async () => {
roles: []
})
.withDaycareAcl(testDaycare.id, 'STAFF')
.withGroupAcl(daycareGroup.id)
.withGroupAcl(daycareGroup2.id)
.withGroupAcl(daycareGroup3.id)
.withGroupAcl(daycareGroup.id, mockedDateAt10)
.withGroupAcl(daycareGroup2.id, mockedDateAt10)
.withGroupAcl(daycareGroup3.id, mockedDateAt10)
.save()

const staff2 = await Fixture.employee({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ beforeEach(async () => {

staff = await Fixture.employee()
.staff(testDaycare.id)
.withGroupAcl(testDaycareGroup.id)
.withGroupAcl(testDaycareGroup.id, mockedDateAt10, mockedDateAt10)
.save()

unitSupervisor = await Fixture.employee()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ beforeEach(async () => {
messenger = await Fixture.employee().messenger().save()
staff = await Fixture.employee()
.staff(testDaycare.id)
.withGroupAcl(testDaycareGroup.id)
.withGroupAcl(testDaycareGroup.id, messageSendTime, messageSendTime)
.save()
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareAclRow(testDaycare2.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare2.id, employee.id, listOf(groupId2))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
tx.insertDaycareGroupAcl(testDaycare2.id, employee.id, listOf(groupId2), now)

tx.markStaffArrival(
employee.id,
Expand All @@ -110,7 +110,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
}

val arrivalTime = HelsinkiDateTime.of(today, LocalTime.of(8, 0))
Expand Down Expand Up @@ -146,7 +146,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
}

val arrivalTime = HelsinkiDateTime.of(today, LocalTime.of(8, 0))
Expand Down Expand Up @@ -176,7 +176,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
}

val arrivalTime = HelsinkiDateTime.of(today, LocalTime.of(8, 0))
Expand Down Expand Up @@ -211,7 +211,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
tx.insert(
DevStaffAttendancePlan(
employeeId = employee.id,
Expand Down Expand Up @@ -243,7 +243,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
tx.insert(
DevStaffAttendancePlan(
employeeId = employee.id,
Expand Down Expand Up @@ -276,7 +276,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
tx.insert(
DevStaffAttendancePlan(
employeeId = employee.id,
Expand Down Expand Up @@ -309,7 +309,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
tx.insert(
DevStaffAttendancePlan(
employeeId = employee.id,
Expand Down Expand Up @@ -351,7 +351,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
tx.insert(
DevStaffAttendancePlan(
employeeId = employee.id,
Expand All @@ -376,7 +376,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
}

val lastLoginBeforeArrival = db.read { db -> db.getEmployeeLastLogin(employee.id) }
Expand All @@ -402,7 +402,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
tx.insert(
DevStaffAttendancePlan(
employeeId = employee.id,
Expand Down Expand Up @@ -438,7 +438,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
tx.insert(
DevStaffAttendancePlan(
employeeId = employee.id,
Expand All @@ -464,7 +464,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
tx.insert(
DevStaffAttendancePlan(
employeeId = employee.id,
Expand All @@ -488,7 +488,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
tx.insert(
DevStaffAttendancePlan(
employeeId = employee.id,
Expand Down Expand Up @@ -531,7 +531,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
tx.insert(
DevStaffAttendancePlan(
employeeId = employee.id,
Expand Down Expand Up @@ -570,7 +570,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
tx.insert(
DevStaffAttendancePlan(
employeeId = employee.id,
Expand All @@ -596,7 +596,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
tx.insert(
DevStaffAttendancePlan(
employeeId = employee.id,
Expand Down Expand Up @@ -629,7 +629,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
tx.insert(
DevStaffAttendancePlan(
employeeId = employee.id,
Expand Down Expand Up @@ -671,7 +671,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
tx.insert(
DevStaffAttendancePlan(
employeeId = employee.id,
Expand Down Expand Up @@ -708,7 +708,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
tx.insert(
DevStaffAttendancePlan(
employeeId = employee.id,
Expand Down Expand Up @@ -757,7 +757,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
tx.insert(
DevStaffAttendancePlan(
employeeId = employee.id,
Expand Down Expand Up @@ -792,7 +792,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
tx.insert(
DevStaffAttendancePlan(
employeeId = employee.id,
Expand Down Expand Up @@ -828,7 +828,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
tx.insert(
DevStaffAttendancePlan(
employeeId = employee.id,
Expand Down Expand Up @@ -873,7 +873,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
tx.insert(
DevStaffAttendancePlan(
employeeId = employee.id,
Expand Down Expand Up @@ -908,7 +908,7 @@ class MobileRealtimeStaffAttendanceControllerIntegrationTest :
tx.insert(employee)
tx.insert(DevEmployeePin(userId = employee.id, pin = pinCode))
tx.insertDaycareAclRow(testDaycare.id, employee.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId))
tx.insertDaycareGroupAcl(testDaycare.id, employee.id, listOf(groupId), now)
tx.insert(
DevStaffAttendancePlan(
employeeId = employee.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class RealtimeStaffAttendanceControllerIntegrationTest :
tx.insertDaycareAclRow(testDaycare2.id, supervisor.id, UserRole.UNIT_SUPERVISOR)
tx.insertDaycareAclRow(testDaycare.id, staff.id, UserRole.STAFF)
tx.insertDaycareAclRow(testDaycare2.id, staff.id, UserRole.STAFF)
tx.insertDaycareGroupAcl(testDaycare.id, staff.id, listOf(groupId1))
tx.insertDaycareGroupAcl(testDaycare.id, staff.id, listOf(groupId1), now)

tx.upsertOccupancyCoefficient(
OccupancyCoefficientUpsert(testDaycare.id, staff.id, BigDecimal(7))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class MessageAccountQueriesTest : PureJdbiTest(resetDbBeforeEach = true) {
it.insertDaycareAclRow(daycareId, supervisorId, UserRole.UNIT_SUPERVISOR)

it.insertDaycareAclRow(daycareId, employee1Id, UserRole.STAFF)
it.insertDaycareGroupAcl(daycareId, employee1Id, listOf(groupId))
it.insertDaycareGroupAcl(daycareId, employee1Id, listOf(groupId), clock.now())

// employee2 has no groups
it.insertDaycareAclRow(daycareId, employee2Id, UserRole.STAFF)
Expand Down
Loading
Loading