generated from ministryofjustice/hmpps-template-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* MAN-82 activity log filter menu ui wip * MAN-82 working draft of filter menu functionality * MAN-82 filter menu date range validation wip * MAN-167 add invalid date format regex validation * MAN-167 redirect url if validation passes * MAN-82 improve type definitions of res.locals vars * MAN-82 activity log filter menu wip * MAN-82 various bug fixes, working pagination * MAN-82 add no results state * MAN-82 add caching for activity log request * MAN-82 update ui for activity log result cards * MAN-226 Add record and outcome filter * MAN-82 fix bug in results caching * MAN-226 rename request body property from 'compliance' to 'filters' * MAN-167 refactor date range validation * MAN-82 add filter menu integration tests wip * MAN-82 filter menu integration tests + bug fixes * MAN-82 pr fixes * MAN-82 fix failing int tests * MAN-82 Sonar fixes * MAN-82 further sonar exception fixes * MAN-82 fix regex sonar exception * MAN-82 update styling of results count * MAN-82 fix sonar code exception issue * MAN-82 fix further sonar code exception issues * MAN-82 fix further sonar code exception issue * MAN-82 fix further sonar code exception issue
- Loading branch information
1 parent
e2e0974
commit 82c0d59
Showing
63 changed files
with
1,946 additions
and
244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { PersonActivity } from '../data/model/activityLog' | ||
import { TierCalculation } from '../data/tierApiClient' | ||
import type { Errors, Option } from './index' | ||
|
||
export interface ActivityLogFilters { | ||
keywords: string | ||
dateFrom: string | ||
dateTo: string | ||
compliance: string[] | ||
} | ||
|
||
export interface ActivityLogRequestBody { | ||
keywords: string | ||
dateFrom: string | ||
dateTo: string | ||
filters: string[] | ||
} | ||
|
||
export interface SelectedFilterItem { | ||
text: string | ||
href: string | ||
} | ||
|
||
export interface ActivityLogFiltersResponse extends ActivityLogFilters { | ||
errors: Errors | ||
selectedFilterItems: SelectedFilterItem[] | ||
complianceOptions: Option[] | ||
baseUrl: string | ||
queryStr: string | ||
queryStrPrefix: string | ||
queryStrSuffix: string | ||
maxDate: string | ||
} | ||
|
||
export interface ActivityLogCache extends ActivityLogFilters { | ||
personActivity: PersonActivity | ||
tierCalculation: TierCalculation | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export interface Option { | ||
text: string | ||
value?: string | ||
checked?: boolean | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,39 @@ | ||
/* eslint-disable import/no-cycle */ | ||
import { Request, Response, NextFunction } from 'express' | ||
import { ActivityLogFiltersResponse, Appointment, AppointmentTypeOption, Errors, Option } from './index' | ||
import { PersonalDetails } from '../data/model/personalDetails' | ||
import { FeatureFlags } from '../data/model/featureFlags' | ||
import { Sentence } from '../data/model/sentenceDetails' | ||
import { Location } from '../data/model/caseload' | ||
import { SentryConfig } from '../config' | ||
|
||
export type Route<T> = (req: Request, res: Response, next?: NextFunction) => T | ||
interface Locals { | ||
filters?: ActivityLogFiltersResponse | ||
user: { token: string; authSource: string; username?: string } | ||
compactView?: boolean | ||
defaultView?: boolean | ||
requirement?: string | ||
appointment?: Appointment | ||
case?: PersonalDetails | ||
message?: string | ||
status?: number | ||
stack?: boolean | number | string | ||
flags?: FeatureFlags | ||
sentences?: Sentence[] | ||
timeOptions?: Option[] | ||
userLocations?: Location[] | ||
sentry?: SentryConfig | ||
csrfToken?: string | ||
cspNonce?: string | ||
errors?: Errors | ||
change?: string | ||
appointmentTypes?: AppointmentTypeOption[] | ||
lastAppointmentDate?: string | ||
version: string | ||
} | ||
|
||
export interface AppResponse extends Response { | ||
locals: Locals | ||
} | ||
|
||
export type Route<T> = (req: Request, res: AppResponse, next?: NextFunction) => T |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
/* eslint-disable import/no-cycle */ | ||
export * from './Route.type' | ||
export * from './Errors.type' | ||
export * from './Data.type' | ||
export * from './Appointment.type' | ||
export * from './ActivityLog.type' | ||
export * from './Option.type' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import type { Request, Response, NextFunction, RequestHandler } from 'express' | ||
import type { Request, NextFunction, RequestHandler } from 'express' | ||
import { AppResponse } from '../@types' | ||
|
||
export default function asyncMiddleware(fn: RequestHandler) { | ||
return (req: Request, res: Response, next: NextFunction): void => { | ||
return (req: Request, res: AppResponse, next: NextFunction): void => { | ||
Promise.resolve(fn(req, res, next)).catch(next) | ||
} | ||
} |
Oops, something went wrong.