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
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
income statement: require draft param
Joosakur committed Dec 1, 2024

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit 2a8b1948a3fb2a3ee2ac5d715f221fecfc34f9b7
Original file line number Diff line number Diff line change
@@ -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(),
@@ -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(),
@@ -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(),
Original file line number Diff line number Diff line change
@@ -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 ->
@@ -229,7 +229,7 @@ class IncomeStatementControllerCitizen(private val accessControl: AccessControl)
now = clock.now(),
personId = user.id,
body = body,
draft = draft ?: false,
draft = draft,
)
}
}
@@ -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 ->
@@ -296,7 +296,7 @@ class IncomeStatementControllerCitizen(private val accessControl: AccessControl)
clock.now(),
incomeStatementId,
body,
draft ?: false,
draft,
)

val parent = AttachmentParent.IncomeStatement(incomeStatementId)
@@ -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 ->
@@ -340,7 +340,7 @@ class IncomeStatementControllerCitizen(private val accessControl: AccessControl)
clock.now(),
incomeStatementId,
body,
draft ?: false,
draft,
)

val parent = AttachmentParent.IncomeStatement(incomeStatementId)