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

Tehdään tuloilmoituksen draft-parametrista pakollinen #6060

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ export async function createChildIncomeStatement(
*/
export async function createIncomeStatement(
request: {
draft?: boolean | null,
draft: boolean,
body: IncomeStatementBody
}
): Promise<void> {
const params = createUrlSearchParams(
['draft', request.draft?.toString()]
['draft', request.draft.toString()]
)
const { data: json } = await client.request<JsonOf<void>>({
url: uri`/citizen/income-statements`.toString(),
Expand Down Expand Up @@ -218,12 +218,12 @@ export async function updateChildIncomeStatement(
request: {
childId: UUID,
incomeStatementId: UUID,
draft?: boolean | null,
draft: boolean,
body: IncomeStatementBody
}
): Promise<void> {
const params = createUrlSearchParams(
['draft', request.draft?.toString()]
['draft', request.draft.toString()]
)
const { data: json } = await client.request<JsonOf<void>>({
url: uri`/citizen/income-statements/child/${request.childId}/${request.incomeStatementId}`.toString(),
Expand All @@ -241,12 +241,12 @@ export async function updateChildIncomeStatement(
export async function updateIncomeStatement(
request: {
incomeStatementId: UUID,
draft?: boolean | null,
draft: boolean,
body: IncomeStatementBody
}
): Promise<void> {
const params = createUrlSearchParams(
['draft', request.draft?.toString()]
['draft', request.draft.toString()]
)
const { data: json } = await client.request<JsonOf<void>>({
url: uri`/citizen/income-statements/${request.incomeStatementId}`.toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class IncomeStatementControllerCitizen(private val accessControl: AccessControl)
user: AuthenticatedUser.Citizen,
clock: EvakaClock,
@RequestBody body: IncomeStatementBody,
@RequestParam draft: Boolean?,
@RequestParam draft: Boolean,
) {
val id =
db.connect { dbc ->
Expand All @@ -229,7 +229,7 @@ class IncomeStatementControllerCitizen(private val accessControl: AccessControl)
now = clock.now(),
personId = user.id,
body = body,
draft = draft ?: false,
draft = draft,
)
}
}
Expand Down Expand Up @@ -275,9 +275,9 @@ class IncomeStatementControllerCitizen(private val accessControl: AccessControl)
clock: EvakaClock,
@PathVariable incomeStatementId: IncomeStatementId,
@RequestBody body: IncomeStatementBody,
@RequestParam draft: Boolean?,
@RequestParam draft: Boolean,
) {
if (draft == false && !validateIncomeStatementBody(body))
if (!draft && !validateIncomeStatementBody(body))
throw BadRequest("Invalid income statement body")

db.connect { dbc ->
Expand All @@ -296,7 +296,7 @@ class IncomeStatementControllerCitizen(private val accessControl: AccessControl)
clock.now(),
incomeStatementId,
body,
draft ?: false,
draft,
)

val parent = AttachmentParent.IncomeStatement(incomeStatementId)
Expand All @@ -319,9 +319,9 @@ class IncomeStatementControllerCitizen(private val accessControl: AccessControl)
@PathVariable childId: ChildId,
@PathVariable incomeStatementId: IncomeStatementId,
@RequestBody body: IncomeStatementBody,
@RequestParam draft: Boolean?,
@RequestParam draft: Boolean,
) {
if (draft == false && !validateIncomeStatementBody(body))
if (!draft && !validateIncomeStatementBody(body))
throw BadRequest("Invalid child income statement body")

db.connect { dbc ->
Expand All @@ -340,7 +340,7 @@ class IncomeStatementControllerCitizen(private val accessControl: AccessControl)
clock.now(),
incomeStatementId,
body,
draft ?: false,
draft,
)

val parent = AttachmentParent.IncomeStatement(incomeStatementId)
Expand Down
Loading