forked from baron/baron-sso
조직도 표현 개선
This commit is contained in:
@@ -191,8 +191,8 @@ func BuildWorksmobileUserPayloadForDomainTenants(user domain.User, tenant domain
|
||||
type worksmobileAppointment struct {
|
||||
TenantID string
|
||||
IsPrimary bool
|
||||
IsOwner bool
|
||||
HasOwner bool
|
||||
IsManager bool
|
||||
HasManager bool
|
||||
JobTitle string
|
||||
PositionID string
|
||||
}
|
||||
@@ -247,8 +247,8 @@ func buildWorksmobileUserOrganizations(user domain.User, tenant domain.Tenant, t
|
||||
Primary: appointment.IsPrimary,
|
||||
PositionID: appointment.PositionID,
|
||||
}
|
||||
if appointment.HasOwner {
|
||||
isManager := appointment.IsOwner
|
||||
if appointment.HasManager {
|
||||
isManager := appointment.IsManager
|
||||
orgUnit.IsManager = &isManager
|
||||
}
|
||||
organizations = append(organizations, WorksmobileUserOrganization{
|
||||
@@ -285,9 +285,9 @@ func worksmobileAppointmentsFromMetadata(metadata domain.JSONMap) []worksmobileA
|
||||
JobTitle: metadataString(domain.JSONMap(item), "jobTitle", "job_title", "task"),
|
||||
PositionID: metadataString(domain.JSONMap(item), "worksmobilePositionId", "positionId", "position_id"),
|
||||
}
|
||||
if isOwner, ok := metadataOptionalBool(domain.JSONMap(item), "isOwner", "isManager"); ok {
|
||||
appointment.IsOwner = isOwner
|
||||
appointment.HasOwner = true
|
||||
if isManager, ok := metadataOptionalBool(domain.JSONMap(item), "isManager", "lead", "isLead"); ok {
|
||||
appointment.IsManager = isManager
|
||||
appointment.HasManager = true
|
||||
}
|
||||
appointments = append(appointments, appointment)
|
||||
}
|
||||
|
||||
@@ -150,14 +150,14 @@ func TestBuildWorksmobileUserPayloadMapsAdditionalAppointmentsToOrgUnits(t *test
|
||||
map[string]any{
|
||||
"tenantId": secondaryTenantID,
|
||||
"isPrimary": false,
|
||||
"isOwner": true,
|
||||
"isManager": true,
|
||||
"jobTitle": "PM",
|
||||
"position": "팀장",
|
||||
},
|
||||
map[string]any{
|
||||
"tenantId": primaryTenantID,
|
||||
"isPrimary": true,
|
||||
"isOwner": false,
|
||||
"isOwner": true,
|
||||
"jobTitle": "Engineering",
|
||||
"position": "책임",
|
||||
},
|
||||
@@ -194,8 +194,7 @@ func TestBuildWorksmobileUserPayloadMapsAdditionalAppointmentsToOrgUnits(t *test
|
||||
require.True(t, payload.Organizations[0].Primary)
|
||||
require.Equal(t, "externalKey:"+primaryTenantID, payload.Organizations[0].OrgUnits[0].OrgUnitID)
|
||||
require.True(t, payload.Organizations[0].OrgUnits[0].Primary)
|
||||
require.NotNil(t, payload.Organizations[0].OrgUnits[0].IsManager)
|
||||
require.False(t, *payload.Organizations[0].OrgUnits[0].IsManager)
|
||||
require.Nil(t, payload.Organizations[0].OrgUnits[0].IsManager)
|
||||
require.Equal(t, int64(1002), payload.Organizations[1].DomainID)
|
||||
require.False(t, payload.Organizations[1].Primary)
|
||||
require.Equal(t, "externalKey:"+secondaryTenantID, payload.Organizations[1].OrgUnits[0].OrgUnitID)
|
||||
|
||||
Reference in New Issue
Block a user