Skip to content

Commit 21d25ec

Browse files
nihil2501ojbucaoamprokop
authored
2: [ART] POA requests: define POA form schema (#19994)
* (fix) Remove NOT NULL constraint from encrypted_kms_key in ar_power_of_attorney_requests_resolutions and ar_power_of_attorney_forms * (fix) Update schema.rb to reflect removal of NOT NULL constraint from encrypted_kms_key * (fix) Remove mock encrypted_kms_keys from power_of_attorney_form and power_of_attorney_request_resolution factories * Add PowerOfAttorneyRequestSerializer and accompanying spec - Implement PowerOfAttorneyRequestSerializer to handle resolution attributes: - Includes `id`, `type`, `created_at`, `reason`, and conditional `creator_id` - Ensure safe handling of nil values with safe navigation (`&.`) and `try` - Add RSpec tests to validate: - Resolution serialization for decisions, expirations, and declinations - Handling of `reason` and `creator_id` conditionally - Nil resolution scenarios * Add serializer for PowerOfAttorneyRequest with controller and tests - Implement `PowerOfAttorneyRequestSerializer` to standardize JSON:API output - Add request specs for controller endpoints (`index` and `show`) - Add serializer specs to ensure proper formatting of resolution details - Normalize response keys for consistency in test expectations * (feat): Add serializers for PowerOfAttorneyRequest and Resolution with specs - Implement `PowerOfAttorneyRequestSerializer` to handle serialization of power of attorney requests, including nested resolution data. - Implement `PowerOfAttorneyRequestResolutionSerializer` to serialize resolution details, accommodating various resolution subtypes. - Add comprehensive specs for both serializers to ensure accurate and dynamic handling of attributes. - Adjust model factories accordingly * (fix) Refactor AR PowerOfAttorneyRequestController includes for improved query performance - Updated `includes` to reference `resolving` instead of just `resolution` - Added a limit of 100 records in the `index` action to optimize data retrieval * [ART-98710] Spike ARP POA request list and show endpoints * [ART-98710] Inline compound POA request response document * [ART] POA requests: define POA form schema * [ART] (fix) Minor rubocop issue: trailing whitespace --------- Co-authored-by: OJ Bucao <[email protected]> Co-authored-by: OJ Bucao <[email protected]> Co-authored-by: Alex Prokop <[email protected]>
1 parent cc75916 commit 21d25ec

File tree

1 file changed

+278
-0
lines changed

1 file changed

+278
-0
lines changed

modules/accredited_representative_portal/app/models/accredited_representative_portal/power_of_attorney_form.rb

+278
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,283 @@ class PowerOfAttorneyForm < ApplicationRecord
1313
blind_index :city
1414
blind_index :state
1515
blind_index :zipcode
16+
17+
##
18+
# TODO: Can couple this to the schema involved in user input during POA
19+
# request creation.
20+
#
21+
# Currently, it is a small-ish transformation of the most closely related
22+
# schema in existence at the time of writing:
23+
# [The schema for 2122 PDF generation](https://github.com/department-of-veterans-affairs/vets-api/blob/124adcfbeb4cba0d17f69e392d2af6189acd4809/modules/representation_management/app/swagger/v0/swagger.json#L749-L948)
24+
#
25+
# Of note:
26+
# - Optional `dependent` property for the non-Veteran claimant (NVC) case
27+
# - Does NVC necessarily mean a claimant that is a dependent of the Veteran?
28+
# - If so, using the name `dependent` lets us use the word `claimant` more straightforwardly
29+
# - `poa_request.claimant_type` is `{ veteran | dependent }`
30+
# - All properties required but some nullable
31+
# - Rather than representing optionality by omission from `required` properties
32+
#
33+
SCHEMA = <<~JSON
34+
{
35+
"type": "object",
36+
"properties": {
37+
"authorizations": {
38+
"type": "object",
39+
"properties": {
40+
"record_disclosure": {
41+
"type": "boolean",
42+
"example": true
43+
},
44+
"record_disclosure_limitations": {
45+
"type": "array",
46+
"items": {
47+
"type": "string",
48+
"enum": [
49+
"ALCOHOLISM",
50+
"DRUG_ABUSE",
51+
"HIV",
52+
"SICKLE_CELL"
53+
]
54+
},
55+
"example": [
56+
"ALCOHOLISM",
57+
"DRUG_ABUSE",
58+
"HIV",
59+
"SICKLE_CELL"
60+
]
61+
},
62+
"address_change": {
63+
"type": "boolean",
64+
"example": false
65+
}
66+
},
67+
"required": [
68+
"record_disclosure",
69+
"record_disclosure_limitations",
70+
"address_change"
71+
]
72+
},
73+
"dependent": {
74+
"type": ["object", "null"],
75+
"properties": {
76+
"name": {
77+
"type": "object",
78+
"properties": {
79+
"first": {
80+
"type": "string",
81+
"example": "John"
82+
},
83+
"middle": {
84+
"type": ["string", "null"],
85+
"example": "Middle"
86+
},
87+
"last": {
88+
"type": "string",
89+
"example": "Doe"
90+
}
91+
},
92+
"required": [
93+
"first",
94+
"middle",
95+
"last"
96+
]
97+
},
98+
"address": {
99+
"type": "object",
100+
"properties": {
101+
"address_line1": {
102+
"type": "string",
103+
"example": "123 Main St"
104+
},
105+
"address_line2": {
106+
"type": ["string", "null"],
107+
"example": "Apt 1"
108+
},
109+
"city": {
110+
"type": "string",
111+
"example": "Springfield"
112+
},
113+
"state_code": {
114+
"type": "string",
115+
"example": "IL"
116+
},
117+
"country": {
118+
"type": "string",
119+
"example": "US"
120+
},
121+
"zip_code": {
122+
"type": "string",
123+
"example": "62704"
124+
},
125+
"zip_code_suffix": {
126+
"type": ["string", "null"],
127+
"example": "6789"
128+
}
129+
},
130+
"required": [
131+
"address_line1",
132+
"address_line2",
133+
"city",
134+
"state_code",
135+
"country",
136+
"zip_code",
137+
"zip_code_suffix"
138+
]
139+
},
140+
"date_of_birth": {
141+
"type": "string",
142+
"format": "date",
143+
"example": "1980-12-31"
144+
},
145+
"relationship": {
146+
"type": "string",
147+
"example": "Spouse"
148+
},
149+
"phone": {
150+
"type": ["string", "null"],
151+
"example": "1234567890"
152+
},
153+
"email": {
154+
"type": ["string", "null"],
155+
"example": "[email protected]"
156+
}
157+
},
158+
"required": [
159+
"name",
160+
"address",
161+
"date_of_birth",
162+
"relationship",
163+
"phone",
164+
"email"
165+
]
166+
},
167+
"veteran": {
168+
"type": "object",
169+
"properties": {
170+
"name": {
171+
"type": "object",
172+
"properties": {
173+
"first": {
174+
"type": "string",
175+
"example": "john"
176+
},
177+
"middle": {
178+
"type": ["string", "null"],
179+
"example": "middle"
180+
},
181+
"last": {
182+
"type": "string",
183+
"example": "doe"
184+
}
185+
},
186+
"required": [
187+
"first",
188+
"middle",
189+
"last"
190+
]
191+
},
192+
"address": {
193+
"type": "object",
194+
"properties": {
195+
"address_line1": {
196+
"type": "string",
197+
"example": "123 Main St"
198+
},
199+
"address_line2": {
200+
"type": ["string", "null"],
201+
"example": "Apt 1"
202+
},
203+
"city": {
204+
"type": "string",
205+
"example": "Springfield"
206+
},
207+
"state_code": {
208+
"type": "string",
209+
"example": "IL"
210+
},
211+
"country": {
212+
"type": "string",
213+
"example": "US"
214+
},
215+
"zip_code": {
216+
"type": "string",
217+
"example": "62704"
218+
},
219+
"zip_code_suffix": {
220+
"type": ["string", "null"],
221+
"example": "6789"
222+
}
223+
},
224+
"required": [
225+
"address_line1",
226+
"address_line2",
227+
"city",
228+
"state_code",
229+
"country",
230+
"zip_code",
231+
"zip_code_suffix"
232+
]
233+
},
234+
"ssn": {
235+
"type": "string",
236+
"example": "123456789"
237+
},
238+
"va_file_number": {
239+
"type": ["string", "null"],
240+
"example": "123456789"
241+
},
242+
"date_of_birth": {
243+
"type": "string",
244+
"format": "date",
245+
"example": "1980-12-31"
246+
},
247+
"service_number": {
248+
"type": ["string", "null"],
249+
"example": "123456789"
250+
},
251+
"service_branch": {
252+
"type": ["string", "null"],
253+
"enum": [
254+
"ARMY",
255+
"NAVY",
256+
"AIR_FORCE",
257+
"MARINE_CORPS",
258+
"COAST_GUARD",
259+
"SPACE_FORCE",
260+
"NOAA",
261+
"USPHS"
262+
],
263+
"example": "ARMY"
264+
},
265+
"phone": {
266+
"type": ["string", "null"],
267+
"example": "1234567890"
268+
},
269+
"email": {
270+
"type": ["string", "null"],
271+
"example": "[email protected]"
272+
}
273+
},
274+
"required": [
275+
"name",
276+
"address",
277+
"ssn",
278+
"va_file_number",
279+
"date_of_birth",
280+
"service_number",
281+
"service_branch",
282+
"phone",
283+
"email"
284+
]
285+
}
286+
},
287+
"required": [
288+
"authorizations",
289+
"veteran",
290+
"dependent"
291+
]
292+
}
293+
JSON
16294
end
17295
end

0 commit comments

Comments
 (0)