-
Notifications
You must be signed in to change notification settings - Fork 3
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(four fields): This change add required fields to the submission forms #428
Changes from all commits
4e530c0
dbf249c
638bdad
f3f13b1
cce8d34
9f6889f
188745c
2be10f1
0f11aa3
7a15f2a
767f6af
201a095
47ea779
115b504
cafc5c9
6a7c70b
5b975cf
af13f0f
40fb881
903eeff
ae3ddc0
b62c133
8a65eb4
9137536
57d3e20
e9836f6
8462b97
447f6a8
d195ef4
1d8dade
53b4831
46b9fa6
0f1e9c9
4734e6d
f39bd36
edf25a1
f257e40
959e8e7
e7d31e4
b3701e8
cd9d661
b228305
b999876
7085880
56edac7
93e3c7e
d7aa7c6
b449aa6
b40a930
bf73f2b
5b07656
55e8415
23c04af
40258a5
5328894
bc341a2
e3eb4d8
d2bef91
52e1bf9
d374590
80eca8e
a0f4644
d39a8ac
27d4e4e
0b79b28
60b87ae
56645ef
629bd38
65c9812
267dda8
40462f0
cf00c3e
7d85c79
bded896
eeb4822
0620595
e27ca63
b540a2d
47f4d91
616b35b
18e0e3a
582c635
283395a
c527e8f
5cc774b
ac6f59d
6cc522b
16d98e3
f7a9f07
789fe1d
a1c1505
755f9da
65b9dc5
09b7290
fbe74b6
39658c1
7f94508
78320a2
1cb16a8
d790fc6
9254e9a
299d716
59b07b3
67c4395
a187d9d
f9ad6b1
d40cae1
0d758e6
0b23df2
1f70bfb
8ec549a
b32ec55
4112b04
e7b54af
2f276f2
81b8d0a
2094bc1
6d796cd
6ddcfce
b160c2b
f31b68c
ef7e87c
492aec9
eecf450
3c3c096
c59b8b7
c1ce9b8
03b0765
a300999
0d73be4
1730c05
b004dad
31106c7
3029e10
aed93f5
806cf27
4f79840
8ffeeb7
b24a19f
84afe5e
ded0852
e866b79
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"trailingComma": "all" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,10 +159,24 @@ export const transform = (id: string) => { | |
leadAnalystName, | ||
authorityId: authorityId || null, | ||
authority: getAuthority(authorityId, id) as Authority | null, | ||
typeId: data.STATE_PLAN_SERVICETYPES?.[0]?.SPA_TYPE_ID || null, | ||
typeName: data.STATE_PLAN_SERVICETYPES?.[0]?.SPA_TYPE_NAME || null, | ||
subTypeId: data.STATE_PLAN_SERVICE_SUBTYPES?.[0]?.TYPE_ID || null, | ||
subTypeName: data.STATE_PLAN_SERVICE_SUBTYPES?.[0]?.TYPE_NAME || null, | ||
types: | ||
data.STATE_PLAN_SERVICETYPES?.filter( | ||
(type): type is NonNullable<typeof type> => type != null | ||
).map((type) => { | ||
return { | ||
SPA_TYPE_ID: type.SPA_TYPE_ID, | ||
SPA_TYPE_NAME: type.SPA_TYPE_NAME.replace(/â|â/g, "-"), | ||
}; | ||
}) || null, | ||
subTypes: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
data.STATE_PLAN_SERVICE_SUBTYPES?.filter( | ||
(subType): subType is NonNullable<typeof subType> => subType != null | ||
).map((subType) => { | ||
return { | ||
TYPE_ID: subType.TYPE_ID, | ||
TYPE_NAME: subType.TYPE_NAME.replace(/â|â/g, "-"), | ||
}; | ||
}) || null, | ||
proposedDate: getDateStringOrNullFromEpoc(data.STATE_PLAN.PROPOSED_DATE), | ||
raiReceivedDate, | ||
raiRequestedDate, | ||
|
@@ -217,9 +231,7 @@ export const tombstone = (id: string) => { | |
statusDate: null, | ||
submissionDate: null, | ||
subject: null, | ||
typeId: null, | ||
typeName: null, | ||
subTypeId: null, | ||
subTypeName: null, | ||
types: null, | ||
subTypes: null, | ||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,6 +87,7 @@ describe("getNextBusinessDayTimestamp", () => { | |
expect(nextDate).toEqual(Date.UTC(2024, 0, 16)); // Tuesday, midnight utc | ||
}); | ||
|
||
// TODO: I dont know if its my time zone but this always fails for me in the MST | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test date is created for 3pm local, not explicitly eastern. So, 3pm local for you is 5pm east coast. The logic for getNextBizDay includes "if 5pm or after, go to the next day". 3pm your time is exactly 5pm, and should return the next day. Test isn't accounting for being run in other timezones. Wouldn't hold up merge to fix anything, in addition some of this might be changing or have changed with the unit test effort. |
||
it("identifies valid business days", () => { | ||
let testDate = new Date(2024, 0, 9, 15, 0, 0); // Tuesday 3pm utc, Tuesday 8am eastern | ||
let nextDate = getNextBusinessDayTimestamp(testDate); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { APIGatewayEvent } from "aws-lambda"; | ||
import * as os from "libs/opensearch-lib"; | ||
import { response } from "../libs/handler"; | ||
|
||
type GetTypesBoby = { | ||
authorityId: string; | ||
}; | ||
|
||
export const queryTypes = async (authorityId: string) => { | ||
if (!process.env.osDomain) { | ||
throw new Error("process.env.osDomain must be defined"); | ||
} | ||
|
||
const query = { | ||
size: 200, | ||
query: { | ||
bool: { | ||
must: [ | ||
{ | ||
match: { | ||
authorityId: authorityId, | ||
}, | ||
}, | ||
], | ||
must_not: [ | ||
{ | ||
match_phrase: { | ||
name: { | ||
query: "Do Not Use", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
sort: [ | ||
{ | ||
"name.keyword": { | ||
order: "asc", | ||
}, | ||
}, | ||
], | ||
}; | ||
return await os.search(process.env.osDomain, "types", query); | ||
}; | ||
|
||
export const getTypes = async (event: APIGatewayEvent) => { | ||
if (!event.body) { | ||
return response({ | ||
statusCode: 400, | ||
body: { message: "Event body required" }, | ||
}); | ||
} | ||
const body = JSON.parse(event.body) as GetTypesBoby; | ||
try { | ||
const result = await queryTypes(body.authorityId); | ||
if (!result) | ||
return response({ | ||
statusCode: 400, | ||
body: { message: "No record found for the given authority" }, | ||
}); | ||
|
||
return response({ | ||
statusCode: 200, | ||
body: result, | ||
}); | ||
} catch (err) { | ||
console.error({ err }); | ||
return response({ | ||
statusCode: 500, | ||
body: { message: "Internal server error" }, | ||
}); | ||
} | ||
}; | ||
|
||
export const handler = getTypes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow 👍