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

feat(launch darkly perform intake): add launch darkly logic to label mappers #485

Closed
wants to merge 162 commits into from
Closed
Show file tree
Hide file tree
Changes from 155 commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
a384efc
integrate legacy package actions
mdial89f Mar 4, 2024
35c41cb
fix test, but i think its sort of self defeating now. need to levera…
mdial89f Mar 4, 2024
cd3e604
devOrigin add
mdial89f Mar 4, 2024
1be22af
fix changeDate
mdial89f Mar 4, 2024
c6c304e
Merge branch 'master' into juliet
mdial89f Mar 5, 2024
545de03
Merge branch 'master' into juliet
mdial89f Mar 6, 2024
b1387b8
a
mdial89f Mar 8, 2024
3218c99
Merge branch 'master' into juliet
mdial89f Mar 11, 2024
4b54473
Merge branch 'master' into juliet
mdial89f Mar 14, 2024
67ebbf7
make it faster
mdial89f Mar 15, 2024
188e778
legacyinsishgts
mdial89f Mar 15, 2024
16d3070
move maprole out of reindex for speed
mdial89f Mar 15, 2024
f2ac67a
retry bulk update with exponential backoff
mdial89f Mar 15, 2024
bb11bc2
Merge branch 'master' into juliet
mdial89f Mar 15, 2024
44f73a6
Merge branch 'master' into juliet
mdial89f Mar 15, 2024
2d426ea
Merge branch 'master' into juliet
mdial89f Mar 16, 2024
601a09f
correct legacy insights
mdial89f Mar 16, 2024
58fb795
functional. however, deletes in legacy are not knocking out their ol…
mdial89f Mar 16, 2024
6323fca
Remove... not safe to do, and its actuallys lower than just letting o…
mdial89f Mar 16, 2024
0113929
solution for hard deletes from legacy
mdial89f Mar 16, 2024
4123264
im on the fence on this... id like an event that shows the hard delet…
mdial89f Mar 16, 2024
05cee16
handle legacy hard deletes in main
mdial89f Mar 16, 2024
871d9b6
cover more events
mdial89f Mar 16, 2024
9b41aa5
hold
mdial89f Mar 17, 2024
d68345a
move back to package view for main
mdial89f Mar 17, 2024
04607ce
ok
mdial89f Mar 17, 2024
426fa04
add TE support to main
mdial89f Mar 17, 2024
ba7eb13
Means of marking a record as deleted
mdial89f Mar 18, 2024
35c043e
fix up legacy insights... TEs are now identifal counts
mdial89f Mar 18, 2024
a7e0aba
FOLLOWUP... why
mdial89f Mar 18, 2024
6ec35ef
comments
mdial89f Mar 18, 2024
d9ed253
Fix unit test
mdial89f Mar 18, 2024
3ebe605
rm debug
mdial89f Mar 18, 2024
eb7ccc7
rm debug
mdial89f Mar 18, 2024
b72ea1b
Merge branch 'master' into juliet
mdial89f Mar 18, 2024
3f04e87
Remove double function call for readability
mdial89f Mar 18, 2024
16d57e5
updating the status so im less confused later
mdial89f Mar 18, 2024
d7c42e1
Removing line for good
mdial89f Mar 18, 2024
b58a002
remove uneeded else
mdial89f Mar 18, 2024
26cbade
abstract some props
mdial89f Mar 18, 2024
a164d79
test
mdial89f Mar 18, 2024
0db4ccd
Walk back updating new=-submission to actions... i want to take our t…
mdial89f Mar 18, 2024
b6ba242
bump
mdial89f Mar 18, 2024
554b15e
Merge branch 'master' into juliet
mdial89f Mar 18, 2024
4c62faa
only use timestamp filter for legacy, since its the only one with har…
mdial89f Mar 19, 2024
d4931d0
Merge branch 'master' into juliet
mdial89f Mar 19, 2024
377c6d7
typo
mdial89f Mar 19, 2024
ccf31a3
separate action for rai withd rae request
mdial89f Mar 19, 2024
5adac66
Merge branch 'master' into juliet
mdial89f Mar 20, 2024
dcc367d
deduplicate
mdial89f Mar 20, 2024
873c5e1
yut
mdial89f Mar 20, 2024
4d61224
update creds
mdial89f Mar 20, 2024
5ea2021
fix
mdial89f Mar 20, 2024
4f4a1be
hold
mdial89f Mar 20, 2024
4a6557d
func
mdial89f Mar 20, 2024
2393223
Merge branch 'master' into juliet
mdial89f Mar 20, 2024
e019b7e
Update filter to return onemac or seatool
mdial89f Mar 20, 2024
6bb684c
Updates, including moving all adminChange support to the materialize bit
mdial89f Mar 21, 2024
3e9df76
unneeded
mdial89f Mar 21, 2024
8abb18a
unneeded
mdial89f Mar 21, 2024
8658522
Refactor some
mdial89f Mar 21, 2024
b38e971
Rm
mdial89f Mar 21, 2024
bc4c0c1
Add types
mdial89f Mar 21, 2024
85086d8
remove devOrigin and use legacy withdraw rai request
mdial89f Mar 21, 2024
04f4812
Add TE_PENDING as a new seatool status
mdial89f Mar 21, 2024
9b7fd08
lint... why is my linter hot than its cold, yes than its no.
mdial89f Mar 21, 2024
13d1e65
fix logic so when component type is not defined it behaves correctly
mdial89f Mar 21, 2024
3b0c088
Conditionally render Changed Reason
mdial89f Mar 22, 2024
35c21ce
Fix status
mdial89f Mar 22, 2024
58961b5
rm unused
mdial89f Mar 23, 2024
14c34cb
rm unused
mdial89f Mar 23, 2024
e666117
rm unused
mdial89f Mar 23, 2024
294ead5
rm unused
mdial89f Mar 23, 2024
1be59a8
save
mdial89f Mar 24, 2024
11ff9f8
a
mdial89f Mar 24, 2024
9e0fab8
f
mdial89f Mar 24, 2024
12b7fc4
workin
mdial89f Mar 24, 2024
4e379e6
fix routing and stuff, idky this is like this, will elmo
mdial89f Mar 24, 2024
022ad36
dup
mdial89f Mar 24, 2024
6e6c030
update rais
mdial89f Mar 24, 2024
968e17b
add a means of inexing early
mdial89f Mar 24, 2024
4e7d9ac
rm throw
mdial89f Mar 24, 2024
c884b2e
sinkMain updates
mdial89f Mar 24, 2024
1f3856d
unneeded
mdial89f Mar 24, 2024
4c72d71
unneeded
mdial89f Mar 24, 2024
f78d0f8
functional
mdial89f Mar 25, 2024
c136f9c
bare minimum to knock out the old
mdial89f Mar 25, 2024
2efbf26
yea
mdial89f Mar 25, 2024
c05598d
remove duplicates
mdial89f Mar 25, 2024
6cb3249
tighten
mdial89f Mar 25, 2024
51693a3
tighten
mdial89f Mar 25, 2024
1442728
status memo updates
mdial89f Mar 25, 2024
f63ad49
add some validation
mdial89f Mar 25, 2024
d91ae89
Merge branch 'master' into juliet-inflight
mdial89f Mar 26, 2024
fd2a082
Fix
mdial89f Mar 27, 2024
71dc4a1
add TE support
mdial89f Mar 27, 2024
27b77ad
fix
mdial89f Mar 27, 2024
1763198
fixes, tes, validation, etc
mdial89f Mar 27, 2024
c83c3ef
other"
mdial89f Mar 27, 2024
c155ab4
styling fix
mdial89f Mar 27, 2024
edea3d2
bounce back tod ashboard after id update
mdial89f Mar 27, 2024
3ff7a10
rm
mdial89f Mar 27, 2024
5c49892
Add new attr
mdial89f Mar 27, 2024
96755c9
Update rules and postAuth to allow for manually added roles to federa…
mdial89f Mar 27, 2024
7e34a01
allow any format, just check it doesnt exist
mdial89f Mar 27, 2024
66ae9e3
Update regex
mdial89f Mar 27, 2024
c3686d5
Revert "rm unused"
mdial89f Mar 27, 2024
33119dd
Revert "rm unused"
mdial89f Mar 27, 2024
9dfb58f
Revert "rm unused"
mdial89f Mar 27, 2024
cc12ed7
Revert "rm unused"
mdial89f Mar 27, 2024
ffaee56
Update dev users given name
mdial89f Mar 27, 2024
e93a5c6
Preserve ZZ state if it exists
mdial89f Mar 27, 2024
1904259
Update state codes
mdial89f Mar 27, 2024
3ce6f32
update warning message
mdial89f Mar 27, 2024
5d71f9c
add appk support
mdial89f Mar 27, 2024
f896597
Update to avoid leading comma
mdial89f Mar 27, 2024
4667e06
updates
mdial89f Mar 28, 2024
c6da52e
bump
mdial89f Mar 28, 2024
6ef62ef
base form, rules, etc... api action missing, also cpoc index
mdial89f Mar 29, 2024
80f4678
Add packageAction support
mdial89f Mar 29, 2024
3f74ea3
Add stuff for cpoc
benjaminpaige Mar 29, 2024
61f5e67
Fixing things
benjaminpaige Mar 29, 2024
3140982
Merge pull request #477 from Enterprise-CMCS/skipci-kilo
mdial89f Mar 29, 2024
802e690
move files about the cabin. we'll soon have a state officer represen…
mdial89f Mar 29, 2024
88c9950
Fixing small things
benjaminpaige Mar 29, 2024
2b20817
Merging and fixing
benjaminpaige Mar 29, 2024
34854e1
we have cpocs
mdial89f Mar 29, 2024
2cc7117
Merge branch 'kilo' of github.com:Enterprise-CMCS/macpro-om-template …
mdial89f Mar 29, 2024
680ceac
Fixes and upgrade os
mdial89f Mar 29, 2024
746d8a4
Populate dropdown
mdial89f Mar 29, 2024
2989860
Removing sub/desc from forms
benjaminpaige Mar 29, 2024
bc0ee39
Merge branch 'juliet' of github.com:Enterprise-CMCS/macpro-mako into …
benjaminpaige Mar 29, 2024
b98326a
Debugging form results
benjaminpaige Mar 29, 2024
4b4392c
require updated ids to be within the same state. require additional …
mdial89f Mar 30, 2024
7a103f4
put additional information labeled as Change Reason in the admin acti…
mdial89f Mar 30, 2024
fa84cc2
Dont allow id updates for records in a final disposition status
mdial89f Mar 30, 2024
cec470b
tighten regex
mdial89f Mar 30, 2024
b1312d5
Copy types and subtypes when updating the id
mdial89f Mar 30, 2024
0b61e40
rm sizing specific to juliet
mdial89f Mar 30, 2024
0efabf9
Updated perform intake logic to validate
benjaminpaige Mar 30, 2024
5b502a5
remove some logs
benjaminpaige Mar 30, 2024
005c717
comment out status memo
benjaminpaige Mar 31, 2024
97235a0
keep the shared type as the event schema.
mdial89f Mar 31, 2024
99b7bc8
add missing base properties and remove a redundant thing
mdial89f Mar 31, 2024
25f17f4
almost made me drop my croissant
mdial89f Apr 1, 2024
e3f93ed
Add status memo
mdial89f Apr 1, 2024
87d0728
add subitter to notes
benjaminpaige Apr 1, 2024
692e5dd
add action to admin activity
mdial89f Apr 1, 2024
eee9753
handle deletes of officers
mdial89f Apr 1, 2024
51e27fd
tweak status memo. also use the safe parse object instead of body
mdial89f Apr 1, 2024
b6be374
Merge branch 'master' into juliet
mdial89f Apr 1, 2024
cd2b86c
Alert
benjaminpaige Apr 1, 2024
0e407e5
add LD to perform intake logic
jdinh8124 Apr 1, 2024
7865f41
Small stuff
benjaminpaige Apr 1, 2024
6903452
Update labelMappers.ts
jdinh8124 Apr 2, 2024
36c6cf9
Add logic
jdinh8124 Apr 2, 2024
6861574
Complete Intake
benjaminpaige Apr 2, 2024
d8c4968
fix appk issue
mdial89f Apr 3, 2024
1c33551
Delete records from main when updating the ID
mdial89f Apr 3, 2024
e88ce1a
remove unneeded param
mdial89f Apr 3, 2024
74b4ff6
Copy submission review team (SRT)
mdial89f Apr 3, 2024
b9be40a
Merge branch 'juliet' into juliet-james
jdinh8124 Apr 3, 2024
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
15 changes: 11 additions & 4 deletions src/libs/opensearch-lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,17 @@ export async function bulkUpdateData(

client = client || (await getClient(host));

const body: any[] = arrayOfDocuments.flatMap((doc) => [
{ update: { _index: index, _id: doc.id } }, // Action and metadata
{ doc: doc, doc_as_upsert: true }, // Document to update or upsert
]);
const body: any[] = [];
for (const doc of arrayOfDocuments) {
if (doc.delete) {
body.push({ delete: { _index: index, _id: doc.id } });
} else {
body.push(
{ update: { _index: index, _id: doc.id } },
{ doc: doc, doc_as_upsert: true },
);
}
}

async function attemptBulkUpdate(
retries: number = 5,
Expand Down
2 changes: 2 additions & 0 deletions src/packages/shared-types/action-types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ export * from "./legacy-package-view";
export * from "./legacy-admin-change";
export * from "./seatool";
export * from "./remove-appk-child";
export * from "./update-id";
export * from "./perform-intake";
17 changes: 17 additions & 0 deletions src/packages/shared-types/action-types/perform-intake.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { z } from "zod";

// This is the event schema for intake performed from our system
export const performIntakeSchema = z.object({
id: z.string(),
authority: z.string(),
origin: z.string(),
submitterName: z.string(),
submitterEmail: z.string(),
subject: z.string(),
description: z.string(),
typeIds: z.array(z.number()),
subTypeIds: z.array(z.number()),
cpoc: z.number(),
});

export type PerformIntake = z.infer<typeof performIntakeSchema>;
15 changes: 15 additions & 0 deletions src/packages/shared-types/action-types/update-id.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { z } from "zod";
import { attachmentSchema } from "../attachments";

// This is the event schema for ne submissions from our system
export const updateIdSchema = z.object({
newId: z.string(),
timestamp: z.string().optional(), // Used by waivers and chip spas
origin: z.string(),
additionalInformation: z.string().nullable().default(null),
submitterName: z.string(),
submitterEmail: z.string(),
attachments: z.array(attachmentSchema).nullish(),
});

export type UpdateId = z.infer<typeof updateIdSchema>;
4 changes: 3 additions & 1 deletion src/packages/shared-types/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ export enum Action {
WITHDRAW_PACKAGE = "withdraw-package",
REMOVE_APPK_CHILD = "remove-appk-child",
TEMP_EXTENSION = "temporary-extension",
UPDATE_ID = "update-id",
PERFORM_INTAKE = "perform-intake",
LEGACY_ADMIN_CHANGE = "legacy-admin-change",
LEGACY_WITHDRAW_RAI_REQUEST = "legacy-withdraw-rai-request"
LEGACY_WITHDRAW_RAI_REQUEST = "legacy-withdraw-rai-request",
}

export type ActionRule = {
Expand Down
3 changes: 2 additions & 1 deletion src/packages/shared-types/opensearch/_.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,5 @@ export type Index =
| "changelog"
| "types"
| "subtypes"
| "legacyinsights";
| "legacyinsights"
| "cpocs"
6 changes: 5 additions & 1 deletion src/packages/shared-types/opensearch/changelog/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
RaiWithdraw,
WithdrawPackage,
ToggleWithdrawRaiEnabled,
UpdateId,
} from "../../action-types";
import { legacyAdminChange, legacyEvent } from "./transforms";

Expand All @@ -22,11 +23,14 @@ export type Document = OneMac &
RaiResponse &
RaiIssue &
RaiWithdraw &
ToggleWithdrawRaiEnabled & {
ToggleWithdrawRaiEnabled &
UpdateId & {
actionType: string;
timestamp: string;
packageId: string;
appkChildId: string;
oldPackageId: string;
newPackageId: string;
} & z.infer<legacyEvent.Schema> &
z.infer<legacyAdminChange.Schema>;

Expand Down
23 changes: 23 additions & 0 deletions src/packages/shared-types/opensearch/cpocs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import {
Response as Res,
Hit,
Filterable as FIL,
QueryState,
AggQuery,
} from "./../_";
import { z } from "zod";
import { Officers } from "./transforms";

export type Document = z.infer<Officers.Schema>;

export type Response = Res<Document>;
export type ItemResult = Hit<Document> & {
found: boolean;
};

export type Field = keyof Document | `${keyof Document}.keyword`;
export type Filterable = FIL<Field>;
export type State = QueryState<Field>;
export type Aggs = AggQuery<Field>;

export * from "./transforms";
15 changes: 15 additions & 0 deletions src/packages/shared-types/opensearch/cpocs/transforms/Officers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { seaOfficersSchema } from "../../..";

export const transform = () => {
return seaOfficersSchema.transform((data) => {
const transformedData = {
id: data.Officer_ID,
firstName: data.First_Name,
lastName: data.Last_Name,
email: data.Email,
};
return transformedData;
});
};

export type Schema = ReturnType<typeof transform>;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * as Officers from "./Officers";
1 change: 1 addition & 0 deletions src/packages/shared-types/opensearch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export * as changelog from "./changelog";
export * as main from "./main";
export * as types from "./types";
export * as subtypes from "./subtypes";
export * as cpocs from "./cpocs";
export * from "./_";
24 changes: 13 additions & 11 deletions src/packages/shared-types/seatool-statics/Plan_Types.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
//
//
//
//
// Be advised: This plan_types file holds the authorities; the authroity id and its corresponding name.
// Be advised: The seatool table is called Plan_Types, hence this file's name.
//
//
//
//

export const SEATOOL_AUTHORITIES: { [key: string]: string } = {
"121": "1115",
"122": "1915(b)",
Expand All @@ -21,3 +10,16 @@ export const SEATOOL_AUTHORITIES: { [key: string]: string } = {
"129": "ADM",
"130": "UPL",
};

export const SEATOOL_AUTHORITIES_MAP_TO_ID: { [key: string]: number } = {
["1115"]: 121,
["1915(b)"]: 122,
["1915(c)"]: 123,
["CHIP SPA"]: 124,
["Medicaid SPA"]: 125,
["1115 Indep. Plus"]: 126,
["1915(c) Indep. Plus"]: 127,
["APD"]: 128,
["ADM"]: 129,
["UPL"]: 130,
};
9 changes: 9 additions & 0 deletions src/packages/shared-types/seatool-tables/Officers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { z } from "zod";

export const seaOfficersSchema = z.object({
Officer_ID: z.number(),
First_Name: z.string(),
Last_Name: z.string(),
Email: z.string().nullish(),
});
export type SeaOfficersSchema = z.infer<typeof seaOfficersSchema>;
3 changes: 2 additions & 1 deletion src/packages/shared-types/seatool-tables/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from "./Type";
export * from "./SPA_Type";
export * from "./State_Plan";
export * from "./State_Plan";
export * from "./Officers";
8 changes: 7 additions & 1 deletion src/packages/shared-types/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export enum UserRoles {
CMS_REVIEWER = "onemac-micro-reviewer",
HELPDESK = "onemac-micro-helpdesk",
STATE_SUBMITTER = "onemac-micro-statesubmitter",
CMS_SUPER_USER = "onemac-micro-super",
}

export type UserRolesString = `${UserRoles}${"," | ""}` | "";
Expand All @@ -22,9 +23,13 @@ export const CMS_ROLES = [
UserRoles.CMS_READ_ONLY,
UserRoles.CMS_REVIEWER,
UserRoles.HELPDESK,
UserRoles.CMS_SUPER_USER,
];

export const CMS_WRITE_ROLES = [UserRoles.CMS_REVIEWER];
export const CMS_WRITE_ROLES = [
UserRoles.CMS_REVIEWER,
UserRoles.CMS_SUPER_USER,
];

export const CMS_READ_ONLY_ROLES = [
UserRoles.CMS_READ_ONLY,
Expand All @@ -38,4 +43,5 @@ export const RoleDescriptionStrings: { [key: string]: string } = {
[UserRoles.CMS_REVIEWER]: "Reviewer",
[UserRoles.HELPDESK]: "Helpdesk",
[UserRoles.STATE_SUBMITTER]: "State Submitter",
[UserRoles.CMS_SUPER_USER]: "Super User",
};
8 changes: 8 additions & 0 deletions src/packages/shared-utils/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,12 @@ export const featureFlags = {
flag: "clear-data-button",
defaultValue: false,
},

/**
* Toggles Performance Intake
*/
PERFORM_INTAKE: {
flag: "perform-intake",
defaultValue: false,
},
} as const;
18 changes: 17 additions & 1 deletion src/packages/shared-utils/package-actions/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import {
SEATOOL_STATUS,
finalDispositionStatuses,
} from "shared-types";
import { isStateUser, isCmsWriteUser, isIDM } from "../user-helper";
import {
isStateUser,
isCmsWriteUser,
isIDM,
isCmsSuperUser,
} from "../user-helper";

const arIssueRai: ActionRule = {
action: Action.ISSUE_RAI,
Expand Down Expand Up @@ -84,6 +89,15 @@ const arWithdrawPackage: ActionRule = {
!checker.hasStatus(finalDispositionStatuses) &&
isStateUser(user),
};
const arUpdateId: ActionRule = {
action: Action.UPDATE_ID,
check: (checker, user) =>
isCmsSuperUser(user) && !checker.hasStatus(finalDispositionStatuses),
};
const arPerformIntake: ActionRule = {
action: Action.PERFORM_INTAKE,
check: (checker, user) => isCmsWriteUser(user) && checker.needsIntake,
};

// TODO: Add rule for remove-appk-child

Expand All @@ -95,4 +109,6 @@ export default [
arWithdrawRaiResponse,
arWithdrawPackage,
arTempExtension,
arUpdateId,
arPerformIntake,
];
6 changes: 6 additions & 0 deletions src/packages/shared-utils/package-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const PackageCheck = ({
authority,
actionType,
appkParentId,
initialIntakeNeeded,
}: opensearch.main.Document) => {
const planChecks = {
isSpa: checkAuthority(authority, [Authority.MED_SPA, Authority.CHIP_SPA]),
Expand Down Expand Up @@ -62,6 +63,10 @@ export const PackageCheck = ({
hasStatus: (authorizedStatuses: string | string[]) =>
checkStatus(seatoolStatus, authorizedStatuses),
};
const subStatusChecks = {
/** Is in any of our pending statuses, sans Pending-RAI **/
needsIntake: initialIntakeNeeded,
};
const raiChecks = {
/** There is an RAI and it does not have a response **/
hasRequestedRai: !!raiRequestedDate && !raiReceivedDate,
Expand All @@ -86,6 +91,7 @@ export const PackageCheck = ({
return {
...planChecks,
...statusChecks,
...subStatusChecks,
...raiChecks,
...actionTypeChecks,
};
Expand Down
3 changes: 3 additions & 0 deletions src/packages/shared-utils/user-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export const isCmsReadonlyUser = (user: CognitoUserAttributes) =>
/** Confirms user is a State user */
export const isStateUser = (user: CognitoUserAttributes | null) =>
userHasAuthorizedRole(user, STATE_ROLES);
/** Confirms user is a State user */
export const isCmsSuperUser = (user: CognitoUserAttributes | null) =>
userHasAuthorizedRole(user, [UserRoles.CMS_SUPER_USER]);
/** Confirms user is an IDM user */
export const isIDM = (user: CognitoUserAttributes | null) =>
user?.username.startsWith("IDM_");
12 changes: 10 additions & 2 deletions src/services/api/handlers/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import {
removeAppkChild,
respondToRai,
toggleRaiResponseWithdraw,
updateId,
withdrawPackage,
withdrawRai,
performIntake,
} from "./packageActions";

export const handler = async (event: APIGatewayEvent) => {
Expand Down Expand Up @@ -53,7 +55,7 @@ export const handler = async (event: APIGatewayEvent) => {
const authDetails = getAuthDetails(event);
const userAttr = await lookupUserAttributes(
authDetails.userId,
authDetails.poolId
authDetails.poolId,
);

if (actionType === Action.REMOVE_APPK_CHILD) {
Expand All @@ -74,7 +76,7 @@ export const handler = async (event: APIGatewayEvent) => {
},
});
}

console.log(actionType);
// Call package action
switch (actionType) {
case Action.WITHDRAW_PACKAGE:
Expand All @@ -95,6 +97,12 @@ export const handler = async (event: APIGatewayEvent) => {
case Action.WITHDRAW_RAI:
await withdrawRai(body, result._source);
break;
case Action.UPDATE_ID:
await updateId(body);
break;
case Action.PERFORM_INTAKE:
await performIntake(body);
break;
default:
throw `No ${actionType} action available`;
}
Expand Down
Loading
Loading