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

View past access requests in Manage User table #1346

Merged
merged 9 commits into from
Sep 5, 2024
10 changes: 10 additions & 0 deletions api/src/paths/administrative-activities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@ GET.apiDoc = {
create_date: {
type: 'string',
description: 'ISO 8601 date string'
},
updated_by: {
type: 'string',
description: 'Display name of the user who last updated the record',
nullable: true
},
update_date: {
type: 'string',
description: 'Date when the record was last updated',
nullable: true
}
}
}
Expand Down
16 changes: 13 additions & 3 deletions api/src/repositories/administrative-activity-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ export const IAdministrativeActivity = z.object({
description: z.string().nullable(),
data: shallowJsonSchema,
notes: z.string().nullable(),
create_date: z.string()
create_date: z.string(),
updated_by: z.string().nullable(),
update_date: z.string().nullable()
});

export type IAdministrativeActivity = z.infer<typeof IAdministrativeActivity>;
Expand Down Expand Up @@ -66,7 +68,9 @@ export class AdministrativeActivityRepository extends BaseRepository {
aa.description,
aa.data,
aa.notes,
aa.create_date
aa.create_date,
su.display_name as updated_by,
aa.update_date
FROM
administrative_activity aa
LEFT OUTER JOIN
Expand All @@ -77,6 +81,10 @@ export class AdministrativeActivityRepository extends BaseRepository {
administrative_activity_type aat
ON
aa.administrative_activity_type_id = aat.administrative_activity_type_id
LEFT OUTER JOIN
system_user su
ON
su.system_user_id = aa.update_user
WHERE
1 = 1
`;
Expand Down Expand Up @@ -115,7 +123,9 @@ export class AdministrativeActivityRepository extends BaseRepository {
sqlStatement.append(SQL`)`);
}

sqlStatement.append(`;`);
sqlStatement.append(`
ORDER BY create_date DESC;
`);

const response = await this.connection.sql(sqlStatement, IAdministrativeActivity);
return response.rows;
Expand Down
8 changes: 6 additions & 2 deletions api/src/services/administrative-activity-service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ describe('AdministrativeActivityService', () => {
identitySource: 'BCEIDBASIC'
},
notes: null,
create_date: '2023-05-02T02:04:10.751Z'
create_date: '2023-05-02T02:04:10.751Z',
update_date: '2023-05-02T02:04:10.751Z',
updated_by: 'Doe, John WLRS:EX'
}
]);

Expand All @@ -66,7 +68,9 @@ describe('AdministrativeActivityService', () => {
identitySource: 'BCEIDBASIC'
},
notes: null,
create_date: '2023-05-02T02:04:10.751Z'
create_date: '2023-05-02T02:04:10.751Z',
update_date: '2023-05-02T02:04:10.751Z',
updated_by: 'Doe, John WLRS:EX'
}
]);
});
Expand Down
16 changes: 16 additions & 0 deletions app/src/constants/colours.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ const NRM_REGION_COLOUR_MAP = {
'Skeena Natural Resource Region': { colour: red }
};

/**
* Colour map for access request chips.
*
*/
const ACCESS_REQUEST_STATUS_COLOUR_MAP = {
mauberti-bc marked this conversation as resolved.
Show resolved Hide resolved
Pending: { colour: purple },
Actioned: { colour: green },
Rejected: { colour: red }
};

/**
* ColourMap key types
*
Expand All @@ -85,6 +95,12 @@ const generateColourMapGetter = <T extends ColourMap>(colourMap: T, fallbackColo
return (lookup: keyof T) => colourMap[lookup]?.colour ?? fallbackColour;
};

/**
* Get access request status colour mapping.
*
*/
export const getAccessRequestStatusColour = generateColourMapGetter(ACCESS_REQUEST_STATUS_COLOUR_MAP);

/**
* Get survey progress colour mapping.
*
Expand Down
2 changes: 1 addition & 1 deletion app/src/features/admin/AdminUsersRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Redirect, Route, Switch } from 'react-router';
import RouteWithTitle from 'utils/RouteWithTitle';
import { getTitle } from 'utils/Utils';
import ManageUsersPage from './users/ManageUsersPage';
import UsersDetailPage from './users/UsersDetailPage';
import UsersDetailPage from './users/projects/UsersDetailPage';

/**
* Router for all `/admin/users/*` pages.
Expand Down
Loading
Loading