feat(birikim): varlıklar ve alım/satım kayıtları (ortalama maliyet)
- Varsayılan varlıklar (TL, altınlar, USD, EUR) + migration v2 ile eski hanelere ekleme - Döviz ekleme, varlık adı/aktifliği - Alım/satım ekle, düzenle, sil; eldekinden fazla satış (geriye tarihli dahil) engellenir - Ağırlıklı ortalama maliyet ve gerçekleşen kâr/zarar (hesaplanır, saklanmaz) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { AssetKind } from "./AssetKind";
|
||||
|
||||
export type Asset = { id: string, kind: AssetKind, code: string, name: string, unit_label: string, sort_order: number, is_active: boolean, version: number,
|
||||
/**
|
||||
* Eldeki miktar (× 1e6)
|
||||
*/
|
||||
quantity_e6: number,
|
||||
/**
|
||||
* Eldeki miktarın maliyeti (kuruş)
|
||||
*/
|
||||
cost: number,
|
||||
/**
|
||||
* Birim başına ortalama maliyet (TL × 1e6); elde yoksa `null`
|
||||
*/
|
||||
avg_cost_e6: number | null,
|
||||
/**
|
||||
* Satışlardan gerçekleşen kâr/zarar (kuruş)
|
||||
*/
|
||||
realized_pl: number, tx_count: number, };
|
||||
@@ -0,0 +1,11 @@
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type AssetCreateRequest = {
|
||||
/**
|
||||
* 3 harfli döviz kodu (ör. `GBP`)
|
||||
*/
|
||||
code: string, name: string,
|
||||
/**
|
||||
* Boşsa kod
|
||||
*/
|
||||
unit_label?: string, };
|
||||
@@ -0,0 +1,3 @@
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type AssetKind = "cash" | "gold" | "fx";
|
||||
@@ -0,0 +1,16 @@
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { AssetTxType } from "./AssetTxType";
|
||||
|
||||
export type AssetTransaction = { id: string, asset_id: string, type: AssetTxType, date: string, quantity_e6: number,
|
||||
/**
|
||||
* TL × 1e6
|
||||
*/
|
||||
unit_price_e6: number,
|
||||
/**
|
||||
* Kuruş
|
||||
*/
|
||||
total: number, note: string | null,
|
||||
/**
|
||||
* Dönem kapanışından geldiyse
|
||||
*/
|
||||
source_period_id: string | null, version: number, };
|
||||
@@ -0,0 +1,16 @@
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { AssetTxType } from "./AssetTxType";
|
||||
|
||||
export type AssetTxCreateRequest = { type: AssetTxType, date: string,
|
||||
/**
|
||||
* × 1e6; TL varlığında yok sayılır
|
||||
*/
|
||||
quantity_e6?: number,
|
||||
/**
|
||||
* TL × 1e6; verilmezse tutar ÷ miktar
|
||||
*/
|
||||
unit_price_e6?: number,
|
||||
/**
|
||||
* Kuruş — ödenen / alınan gerçek tutar
|
||||
*/
|
||||
total: number, note?: string, };
|
||||
@@ -0,0 +1,3 @@
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type AssetTxType = "buy" | "sell";
|
||||
@@ -0,0 +1,7 @@
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type AssetTxUpdateRequest = { date?: string, quantity_e6?: number, unit_price_e6?: number, total?: number,
|
||||
/**
|
||||
* Boş metin → notu kaldır
|
||||
*/
|
||||
note?: string, version?: number, };
|
||||
@@ -0,0 +1,3 @@
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type AssetUpdateRequest = { name?: string, is_active?: boolean, version?: number, };
|
||||
Reference in New Issue
Block a user