Skip to content
Open
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 @@ -50,7 +50,8 @@ data class ReceiptLine(
val giftCardSecret: String? = null,
val priceCalculatedFromNet: Boolean = false,
val linePriceGross: BigDecimal,
val discountId: Long? = null
val discountId: Long? = null,
val manualDiscountPercent: BigDecimal? = null
) {
enum class Type(val value: String) {
PRODUCT_SALE("PRODUCT_SALE"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ fun ReceiptLine.toModel() =
priceCalculatedFromNet = price_calculated_from_net == true,
linePriceGross = line_price_gross ?: price,
discountId = discount_id,
manualDiscountPercent = manual_discount_percent,
)
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ fun ReceiptLine.toJSON(): JSONObject {
jo.put("gift_card_secret", gift_card_secret)
jo.put("line_price_gross", line_price_gross ?: JSONObject.NULL)
jo.put("discount", discount_id ?: JSONObject.NULL)
jo.put("manual_discount_percent", manual_discount_percent)
return jo
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ INSERT INTO ReceiptLine (
variation_id,
voucher_code,
line_price_gross,
discount_id
discount_id,
manual_discount_percent
)
VALUES (
?,
Expand Down Expand Up @@ -108,5 +109,6 @@ VALUES (
?,
?,
?,
?,
?
);
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ CREATE TABLE ReceiptLine (
voucher_code character varying(255),
line_price_gross numeric,
discount_id bigint,
manual_discount_percent bigint,
receipt bigint REFERENCES Receipt (id) ON DELETE CASCADE,

-- The foreign key constraint must be created in code since SQLDelight does not support self-referential foreign key constraints here
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE ReceiptLine ADD manual_discount_percent numeric;
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ CREATE TABLE ReceiptLine (
variation_id INTEGER,
voucher_code TEXT,
line_price_gross REAL AS BigDecimal,
discount_id INTEGER
discount_id INTEGER,
manual_discount_percent REAL AS BigDecimal
);

CREATE INDEX ReceiptLine_addon_to_index ON ReceiptLine (addon_to);
Expand Down
3 changes: 3 additions & 0 deletions libpretixsync/src/main/sqldelight/sqlite/migrations/118.sqm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import java.math.BigDecimal;

ALTER TABLE ReceiptLine ADD manual_discount_percent REAL AS BigDecimal;
Loading