Skip to content

Commit 35030f5

Browse files
Merge branch 'fix/user-status-api-v2' into service-worker-fix
2 parents 45dc416 + f682f9b commit 35030f5

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

src/Pages/GlobalConfigurations/Authorization/authorization.service.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,16 @@ export const getUserById = async (userId: User['id']): Promise<User> => {
3636
}
3737
}
3838

39-
export const createOrUpdateUser = (data: UserCreateOrUpdatePayload) => {
40-
const isUpdate = !!data.id
39+
export const createOrUpdateUser = ({ emailId, ...data }: UserCreateOrUpdatePayload) => {
40+
const _data: UserDto = {
41+
...data,
42+
email_id: emailId,
43+
}
44+
const isUpdate = !!_data.id
4145
const options: APIOptions = {
4246
timeout: window._env_.CONFIGURABLE_TIMEOUT ? parseInt(window._env_.CONFIGURABLE_TIMEOUT, 10) : null,
4347
}
44-
return isUpdate ? put(Routes.USER, data, options) : post(Routes.USER, data, options)
48+
return isUpdate ? put(Routes.USER, _data, options) : post(Routes.USER, _data, options)
4549
}
4650

4751
export const deleteUser = (userId: User['id']) => trash(`${Routes.USER}/${userId}`)
@@ -56,7 +60,9 @@ export const getUserList = async (
5660
try {
5761
const {
5862
result: { users, totalCount },
59-
} = (await get(getUrlWithSearchParams(Routes.USER, queryParams ?? {}), { signal })) as ResponseType<{
63+
} = (await get(getUrlWithSearchParams(`${Routes.USER}/${Routes.API_VERSION_V2}`, queryParams ?? {}), {
64+
signal,
65+
})) as ResponseType<{
6066
users: UserDto[]
6167
totalCount: number
6268
}>
@@ -103,7 +109,10 @@ export const getPermissionGroupList = async (
103109
try {
104110
const {
105111
result: { roleGroups: permissionGroups, totalCount },
106-
} = (await get(getUrlWithSearchParams(Routes.USER_ROLE_GROUP, queryParams ?? {}), { signal })) as ResponseType<{
112+
} = (await get(
113+
getUrlWithSearchParams(`${Routes.USER_ROLE_GROUP}/${Routes.API_VERSION_V2}`, queryParams ?? {}),
114+
{ signal },
115+
)) as ResponseType<{
107116
roleGroups: PermissionGroupDto[]
108117
totalCount: number
109118
}>

src/Pages/GlobalConfigurations/Authorization/types.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export interface UserDto {
5050
/**
5151
* Email of the user
5252
*/
53-
emailId: string
53+
email_id: string
5454
/**
5555
* Status of the user
5656
*
@@ -87,14 +87,15 @@ export interface UserDto {
8787
roleGroups?: Pick<PermissionGroup, 'id' | 'name' | 'description'>
8888
}
8989

90-
export interface User extends Omit<UserDto, 'timeoutWindowExpression'> {
90+
export interface User extends Omit<UserDto, 'timeoutWindowExpression' | 'email_id'> {
9191
/**
9292
* Time until which the user is active
9393
* Note: Only a user with status 'active' can have 'timeToLive'
9494
*
9595
* @default ''
9696
*/
9797
timeToLive?: string
98+
emailId: UserDto['email_id']
9899
}
99100

100101
export type UserCreateOrUpdatePayload = Pick<

src/Pages/GlobalConfigurations/Authorization/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import { PermissionGroup, User, UserDto } from './types'
55
import { LAST_LOGIN_TIME_NULL_STATE } from './UserPermissions/constants'
66

77
export const transformUserResponse = (_user: UserDto): User => {
8-
const { lastLoginTime, timeoutWindowExpression, ...user } = _user
8+
const { lastLoginTime, timeoutWindowExpression, email_id: emailId, ...user } = _user
99

1010
return {
1111
...user,
12+
emailId,
1213
lastLoginTime:
1314
lastLoginTime === ZERO_TIME_STRING || !lastLoginTime
1415
? LAST_LOGIN_TIME_NULL_STATE

src/service-worker.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@ const staticAssetsRoute = new Route(
4747

4848
// Register the route handling static assets
4949
registerRoute(staticAssetsRoute)
50+

0 commit comments

Comments
 (0)