ledger - переход на debet и credit транзакции

This commit is contained in:
Alex Ant
2025-07-30 13:15:58 +05:00
parent 26216a6a8c
commit cd37619af1
36 changed files with 187 additions and 1061 deletions
Binary file not shown.
+3 -4
View File
@@ -2,11 +2,10 @@
#include <ctime>
#include <eosio/transaction.hpp>
#include "src/common/add.cpp"
#include "src/common/sub.cpp"
#include "src/common/transfer.cpp"
#include "src/common/debet.cpp"
#include "src/common/credit.cpp"
#include "src/common/block.cpp"
#include "src/common/unblock.cpp"
#include "src/common/unblock.cpp"
#include "src/common/writeoff.cpp"
#include "src/common/writeoffcnsl.cpp"
+2 -3
View File
@@ -27,9 +27,8 @@ public:
[[eosio::action]] void migrate();
// Операции со счетами (common процесс)
[[eosio::action]] void add(eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment);
[[eosio::action]] void sub(eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment);
[[eosio::action]] void transfer(eosio::name coopname, uint64_t from_account_id, uint64_t to_account_id, eosio::asset quantity, std::string comment);
[[eosio::action]] void debet(eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment);
[[eosio::action]] void credit(eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment);
// Операции блокировки/разблокировки средств
[[eosio::action]] void block(eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment);
@@ -7,7 +7,7 @@
* @param comment - комментарий к операции
*/
[[eosio::action]]
void ledger::sub(eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment) {
void ledger::credit(eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment) {
require_recipient(coopname);
eosio::name payer = coopname;
@@ -7,7 +7,7 @@
* @param comment - комментарий к операции
*/
[[eosio::action]]
void ledger::add(eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment) {
void ledger::debet(eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment) {
require_recipient(coopname);
eosio::name payer = coopname;
@@ -1,63 +0,0 @@
/**
* @brief Перевод средств между счетами
* @param coopname - имя кооператива
* @param from_account_id - идентификатор счета списания
* @param to_account_id - идентификатор счета зачисления
* @param quantity - сумма перевода
* @param comment - комментарий к операции
*/
[[eosio::action]]
void ledger::transfer(eosio::name coopname, uint64_t from_account_id, uint64_t to_account_id, eosio::asset quantity, std::string comment) {
require_recipient(coopname);
eosio::name payer = coopname;
if (!has_auth(coopname)) {
payer = check_auth_and_get_payer_or_fail(contracts_whitelist);
}
eosio::check(quantity.is_valid(), "Некорректная сумма");
eosio::check(quantity.amount > 0, "Сумма должна быть положительной");
eosio::check(quantity.symbol == _root_govern_symbol, "Некорректный символ валюты");
eosio::check(from_account_id != to_account_id, "Счета списания и зачисления должны отличаться");
laccounts_index accounts(_ledger, coopname.value);
// Проверяем счет списания
auto from_account_iter = accounts.find(from_account_id);
eosio::check(from_account_iter != accounts.end(), "Счет списания не найден");
eosio::check(from_account_iter->available >= quantity, "Недостаточно доступных средств для перевода");
// Проверяем счет зачисления или создаем его
auto to_account_iter = accounts.find(to_account_id);
// Списываем с источника
accounts.modify(from_account_iter, payer, [&](auto& acc) {
acc.available -= quantity;
});
if (to_account_iter == accounts.end()) {
// Счет получателя не существует - создаем автоматически
std::string account_name = Ledger::get_account_name_by_id(to_account_id);
eosio::check(account_name != "Неизвестный счет", "Счет получателя с таким ID не предусмотрен в плане счетов");
accounts.emplace(payer, [&](auto& acc) {
acc.id = to_account_id;
acc.name = account_name;
acc.available = quantity;
acc.blocked = eosio::asset(0, _root_govern_symbol);
acc.writeoff = eosio::asset(0, _root_govern_symbol);
});
} else {
// Зачисляем на получателя
accounts.modify(to_account_iter, payer, [&](auto& acc) {
acc.available += quantity;
});
}
// Проверяем и удаляем счет источника если он полностью пуст
if (from_account_iter->is_empty()) {
accounts.erase(from_account_iter);
}
}
@@ -27,21 +27,21 @@ void ledger::migrate(){
if (wallet_iter != coopwallets.end()) {
// Паевой фонд (circulating_account) -> счет 80 (SHARE_FUND)
if (wallet_iter->circulating_account.available.amount > 0) {
Ledger::add(_ledger, coopname, Ledger::accounts::SHARE_FUND,
Ledger::debet(_ledger, coopname, Ledger::accounts::SHARE_FUND,
wallet_iter->circulating_account.available,
"Миграция: перенос паевого фонда");
}
// Вступительные взносы (initial_account) -> счет 861 (ENTRANCE_FEES)
if (wallet_iter->initial_account.available.amount > 0) {
Ledger::add(_ledger, coopname, Ledger::accounts::ENTRANCE_FEES,
Ledger::debet(_ledger, coopname, Ledger::accounts::ENTRANCE_FEES,
wallet_iter->initial_account.available,
"Миграция: перенос вступительных взносов");
}
// Накопительный счет членских взносов (accumulative_expense_account) -> счет 86 (TARGET_RECEIPTS)
if (wallet_iter->accumulative_expense_account.available.amount > 0) {
Ledger::add(_ledger, coopname, Ledger::accounts::TARGET_RECEIPTS,
Ledger::debet(_ledger, coopname, Ledger::accounts::TARGET_RECEIPTS,
wallet_iter->accumulative_expense_account.available,
"Миграция: перенос накопительного счета членских взносов");
}
+16 -21
View File
@@ -93,8 +93,8 @@ public:
static void check_positive_amount(const eosio::asset& amount);
// Основные операции
static void add(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment);
static void sub(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment);
static void debet(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment);
static void credit(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment);
static void transfer(eosio::name actor, eosio::name coopname, uint64_t from_account_id, uint64_t to_account_id, eosio::asset quantity, std::string comment);
// Операции блокировки/разблокировки
@@ -106,8 +106,8 @@ public:
static void writeoffcnsl(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment);
// Специализированные методы для членских взносов
static void add_membership_fee(eosio::name actor, eosio::name coopname, eosio::asset quantity, std::string comment);
static void sub_membership_fee(eosio::name actor, eosio::name coopname, eosio::asset quantity, std::string comment);
static void debet_membership_fee(eosio::name actor, eosio::name coopname, eosio::asset quantity, std::string comment);
static void credit_membership_fee(eosio::name actor, eosio::name coopname, eosio::asset quantity, std::string comment);
static void block_membership_fee(eosio::name actor, eosio::name coopname, eosio::asset quantity, std::string comment);
static void unblock_membership_fee(eosio::name actor, eosio::name coopname, eosio::asset quantity, std::string comment);
@@ -241,9 +241,8 @@ static const std::vector<std::tuple<uint64_t, std::string>> ACCOUNT_MAP = {
// Реализация статических методов класса Ledger
const std::set<eosio::name> Ledger::ledger_actions = {
"add"_n, // пополнение счета
"sub"_n, // списание со счета
"transfer"_n, // перевод между счетами
"debet"_n, // пополнение счета
"credit"_n, // списание со счета
"block"_n, // блокировка средств
"unblock"_n, // разблокировка средств
"writeoff"_n, // атомарное списание средств
@@ -277,31 +276,27 @@ inline std::string Ledger::get_account_name_by_id(uint64_t account_id) {
return "Неизвестный счет";
}
inline void Ledger::add(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment) {
inline void Ledger::debet(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment) {
eosio::action(
eosio::permission_level{actor, "active"_n},
_ledger,
get_valid_ledger_action("add"_n),
get_valid_ledger_action("debet"_n),
std::make_tuple(coopname, account_id, quantity, comment)
).send();
}
inline void Ledger::sub(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment) {
inline void Ledger::credit(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment) {
eosio::action(
eosio::permission_level{actor, "active"_n},
_ledger,
get_valid_ledger_action("sub"_n),
get_valid_ledger_action("credit"_n),
std::make_tuple(coopname, account_id, quantity, comment)
).send();
}
inline void Ledger::transfer(eosio::name actor, eosio::name coopname, uint64_t from_account_id, uint64_t to_account_id, eosio::asset quantity, std::string comment) {
eosio::action(
eosio::permission_level{actor, "active"_n},
_ledger,
get_valid_ledger_action("transfer"_n),
std::make_tuple(coopname, from_account_id, to_account_id, quantity, comment)
).send();
debet(actor, coopname, from_account_id, quantity, comment);
credit(actor, coopname, to_account_id, quantity, comment);
}
inline void Ledger::block(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment) {
@@ -340,12 +335,12 @@ inline void Ledger::writeoffcnsl(eosio::name actor, eosio::name coopname, uint64
).send();
}
inline void Ledger::add_membership_fee(eosio::name actor, eosio::name coopname, eosio::asset quantity, std::string comment) {
add(actor, coopname, accounts::TARGET_RECEIPTS, quantity, comment);
inline void Ledger::debet_membership_fee(eosio::name actor, eosio::name coopname, eosio::asset quantity, std::string comment) {
debet(actor, coopname, accounts::TARGET_RECEIPTS, quantity, comment);
}
inline void Ledger::sub_membership_fee(eosio::name actor, eosio::name coopname, eosio::asset quantity, std::string comment) {
sub(actor, coopname, accounts::TARGET_RECEIPTS, quantity, comment);
inline void Ledger::credit_membership_fee(eosio::name actor, eosio::name coopname, eosio::asset quantity, std::string comment) {
credit(actor, coopname, accounts::TARGET_RECEIPTS, quantity, comment);
}
inline void Ledger::block_membership_fee(eosio::name actor, eosio::name coopname, eosio::asset quantity, std::string comment) {
@@ -44,7 +44,7 @@
std::string memo = "Подтверждение получения для заказа №" + std::to_string(change.id);
// Паевой фонд - уменьшаем циркуляцию
Ledger::sub(_marketplace, coopname, Ledger::accounts::SHARE_FUND, change.base_cost, memo);
Ledger::credit(_marketplace, coopname, Ledger::accounts::SHARE_FUND, change.base_cost, memo);
// Заказчик - списываем заблокированный баланс
Wallet::sub_blocked_funds(_marketplace, coopname, change.money_contributor, change.total_cost, _marketplace_program, memo);
@@ -42,7 +42,7 @@
std::string memo = "Подтверждение поставки для заказа №" + std::to_string(change.id);
// Паевой фонд - увеличиваем циркуляцию
Ledger::add(_marketplace, coopname, Ledger::accounts::SHARE_FUND, change.total_cost, memo);
Ledger::debet(_marketplace, coopname, Ledger::accounts::SHARE_FUND, change.total_cost, memo);
// Поставщик - начисляем и блокируем средства
Wallet::add_available_funds(_marketplace, coopname, change.product_contributor, change.base_cost, _marketplace_program, memo);
@@ -78,10 +78,10 @@
});
Ledger::add(_registrator, coopname, Ledger::accounts::SHARE_FUND, minimum, "Паевой взнос при регистрации пайщика");
Ledger::debet(_registrator, coopname, Ledger::accounts::SHARE_FUND, minimum, "Паевой взнос при регистрации пайщика");
if (spread_initial) {
Ledger::add(_registrator, coopname, Ledger::accounts::ENTRANCE_FEES, initial, "Вступительный взнос при регистрации пайщика");
Ledger::debet(_registrator, coopname, Ledger::accounts::ENTRANCE_FEES, initial, "Вступительный взнос при регистрации пайщика");
}
eosio::name braname = ""_n;
@@ -35,9 +35,9 @@ void registrator::confirmreg(eosio::name coopname, checksum256 registration_hash
).send();
//добавляем
Ledger::add(_registrator, coopname, Ledger::accounts::SHARE_FUND, candidate -> minimum, "Паевой взнос при подтверждении регистрации");
Ledger::debet(_registrator, coopname, Ledger::accounts::SHARE_FUND, candidate -> minimum, "Паевой взнос при подтверждении регистрации");
Ledger::add(_registrator, coopname, Ledger::accounts::ENTRANCE_FEES, candidate -> initial, "Вступительный взнос при подтверждении регистрации");
Ledger::debet(_registrator, coopname, Ledger::accounts::ENTRANCE_FEES, candidate -> initial, "Вступительный взнос при подтверждении регистрации");
// Увеличиваем счетчик активных пайщиков
cooperatives2_index cooperatives(_registrator, _registrator.value);
@@ -3,7 +3,6 @@ void wallet::completedpst(eosio::name coopname, checksum256 deposit_hash) {
auto cooperative = get_cooperative_or_fail(coopname);
auto exist_deposit = Wallet::get_deposit(coopname, deposit_hash);
eosio::check(exist_deposit.has_value(), "Объект паевого взноса не найден");
@@ -15,7 +14,7 @@ void wallet::completedpst(eosio::name coopname, checksum256 deposit_hash) {
std::string memo = "Паевой взнос по целевой потребительской программе 'Цифровой Кошелёк'";
Wallet::add_available_funds(_wallet, coopname, deposit -> username, deposit ->quantity, _wallet_program, memo);
Ledger::add(_wallet, coopname, Ledger::accounts::SHARE_FUND, deposit -> quantity, memo);
Ledger::debet(_wallet, coopname, Ledger::accounts::SHARE_FUND, deposit -> quantity, memo);
//оповещаем пользователя
require_recipient(deposit -> username);
@@ -9,7 +9,7 @@ void wallet::completewthd(COMPLETEWTHD_SIGNATURE) {
eosio::check(withdraw -> status == "authorized"_n, "Только принятые заявления на вывод могут быть обработаны");
Ledger::sub(_wallet, coopname, Ledger::accounts::SHARE_FUND, withdraw -> quantity, "Уменьшение паевого фонда при возврате паевого взноса");
Ledger::credit(_wallet, coopname, Ledger::accounts::SHARE_FUND, withdraw -> quantity, "Уменьшение паевого фонда при возврате паевого взноса");
std::string memo_in = "Возврат части паевого взноса по ЦПП 'Цифровой Кошелёк'";
Wallet::sub_blocked_funds(_wallet, coopname, withdraw -> username, withdraw -> quantity, _wallet_program, memo_in);
+22 -119
View File
@@ -2478,52 +2478,6 @@ type KeyWeight {
weight: Int!
}
type LedgerAddOperation {
"""ID счета"""
account_id: Int!
"""Тип операции"""
action: String!
"""Комментарий к операции"""
comment: String!
"""Имя кооператива"""
coopname: String!
"""Дата и время создания операции"""
created_at: DateTime!
"""Номер глобальной последовательности блокчейна"""
global_sequence: Int!
"""Сумма операции"""
quantity: String!
}
type LedgerBlockOperation {
"""ID счета"""
account_id: Int!
"""Тип операции"""
action: String!
"""Комментарий к операции"""
comment: String!
"""Имя кооператива"""
coopname: String!
"""Дата и время создания операции"""
created_at: DateTime!
"""Номер глобальной последовательности блокчейна"""
global_sequence: Int!
"""Сумма операции"""
quantity: String!
}
type LedgerHistoryResponse {
"""Текущая страница"""
currentPage: Int!
@@ -2538,7 +2492,28 @@ type LedgerHistoryResponse {
totalPages: Int!
}
union LedgerOperation = LedgerAddOperation | LedgerBlockOperation | LedgerSubOperation | LedgerTransferOperation | LedgerUnblockOperation
type LedgerOperation {
"""ID счета"""
account_id: Int!
"""Тип операции"""
action: String!
"""Комментарий к операции"""
comment: String
"""Имя кооператива"""
coopname: String!
"""Дата и время создания операции"""
created_at: DateTime!
"""Номер глобальной последовательности блокчейна"""
global_sequence: Int!
"""Сумма операции"""
quantity: String!
}
type LedgerState {
"""План счетов с актуальными данными"""
@@ -2548,78 +2523,6 @@ type LedgerState {
coopname: String!
}
type LedgerSubOperation {
"""ID счета"""
account_id: Int!
"""Тип операции"""
action: String!
"""Комментарий к операции"""
comment: String!
"""Имя кооператива"""
coopname: String!
"""Дата и время создания операции"""
created_at: DateTime!
"""Номер глобальной последовательности блокчейна"""
global_sequence: Int!
"""Сумма операции"""
quantity: String!
}
type LedgerTransferOperation {
"""Тип операции"""
action: String!
"""Комментарий к операции"""
comment: String!
"""Имя кооператива"""
coopname: String!
"""Дата и время создания операции"""
created_at: DateTime!
"""ID счета отправителя"""
from_account_id: Int!
"""Номер глобальной последовательности блокчейна"""
global_sequence: Int!
"""Сумма операции"""
quantity: String!
"""ID счета получателя"""
to_account_id: Int!
}
type LedgerUnblockOperation {
"""ID счета"""
account_id: Int!
"""Тип операции"""
action: String!
"""Комментарий к операции"""
comment: String!
"""Имя кооператива"""
coopname: String!
"""Дата и время создания операции"""
created_at: DateTime!
"""Номер глобальной последовательности блокчейна"""
global_sequence: Int!
"""Сумма операции"""
quantity: String!
}
input LoginInput {
"""Электронная почта"""
email: String!
@@ -96,7 +96,7 @@ async function processEvent(event: IAction) {
}
// Обработка событий операций ledger
const ledgerActions = ['add', 'sub', 'transfer', 'block', 'unblock', 'writeoff', 'writeoffcnsl'];
const ledgerActions = ['debet', 'credit', 'block', 'unblock', 'writeoff', 'writeoffcnsl'];
if (ledgerActions.includes(event.name)) {
try {
if (ledgerInteractor) {
@@ -10,63 +10,32 @@ export class LedgerOperationDomainEntity {
public readonly coopname!: string;
public readonly action!: string;
public readonly created_at!: Date;
// Поля для операций add, sub, block, unblock
public readonly account_id?: number;
public readonly quantity?: string;
public readonly comment?: string;
// Поля для операции transfer
public readonly from_account_id?: number;
public readonly to_account_id?: number;
constructor(data: LedgerOperationDomainInterface) {
this.global_sequence = data.global_sequence;
this.coopname = data.coopname;
this.action = data.action;
this.created_at = data.created_at;
// Проверяем тип операции и присваиваем соответствующие поля
if (data.action === 'transfer') {
this.from_account_id = data.from_account_id;
this.to_account_id = data.to_account_id;
this.quantity = data.quantity;
this.comment = data.comment;
} else if (['add', 'sub', 'block', 'unblock'].includes(data.action)) {
this.account_id = (data as any).account_id;
this.quantity = (data as any).quantity;
this.comment = (data as any).comment;
}
this.account_id = data.account_id;
this.quantity = data.quantity;
this.comment = data.comment;
}
/**
* Конвертирует доменную сущность в интерфейс
*/
toInterface(): LedgerOperationDomainInterface {
const base = {
return {
global_sequence: this.global_sequence,
coopname: this.coopname,
action: this.action as any,
action: this.action,
created_at: this.created_at,
account_id: this.account_id,
quantity: this.quantity,
comment: this.comment,
};
if (this.action === 'transfer') {
return {
...base,
action: 'transfer',
from_account_id: this.from_account_id!,
to_account_id: this.to_account_id!,
quantity: this.quantity!,
comment: this.comment!,
};
} else {
return {
...base,
action: this.action as any,
account_id: this.account_id!,
quantity: this.quantity!,
comment: this.comment!,
};
}
}
}
@@ -79,7 +79,7 @@ export class LedgerDomainInteractor {
*/
async processLedgerEvent(eventData: any): Promise<void> {
// Проверяем, что событие относится к операциям ledger
const allowedActions = ['add', 'sub', 'transfer', 'block', 'unblock'];
const allowedActions = ['debet', 'credit', 'block', 'unblock'];
if (!allowedActions.includes(eventData.name)) {
return;
}
@@ -90,18 +90,9 @@ export class LedgerDomainInteractor {
coopname: eventData.data.coopname,
action: eventData.name,
created_at: new Date(eventData.block_time || new Date()),
...(eventData.name === 'transfer'
? {
from_account_id: eventData.data.from_account_id,
to_account_id: eventData.data.to_account_id,
quantity: eventData.data.quantity,
comment: eventData.data.comment,
}
: {
account_id: eventData.data.account_id,
quantity: eventData.data.quantity,
comment: eventData.data.comment,
}),
account_id: eventData.data.account_id,
quantity: eventData.data.quantity,
comment: eventData.data.comment,
} as LedgerOperationDomainInterface;
await this.saveLedgerOperation(operationData);
@@ -1,74 +1,16 @@
/**
* Базовый доменный интерфейс для операции ledger
* Доменный интерфейс для операции ledger
*/
export interface LedgerOperationBaseDomainInterface {
export interface LedgerOperationDomainInterface {
global_sequence: number;
coopname: string;
action: string;
created_at: Date;
account_id?: number;
quantity?: string;
comment?: string;
}
/**
* Доменный интерфейс для операции пополнения счета (add)
*/
export interface LedgerAddOperationDomainInterface extends LedgerOperationBaseDomainInterface {
action: 'add';
account_id: number;
quantity: string;
comment: string;
}
/**
* Доменный интерфейс для операции списания со счета (sub)
*/
export interface LedgerSubOperationDomainInterface extends LedgerOperationBaseDomainInterface {
action: 'sub';
account_id: number;
quantity: string;
comment: string;
}
/**
* Доменный интерфейс для операции перевода между счетами (transfer)
*/
export interface LedgerTransferOperationDomainInterface extends LedgerOperationBaseDomainInterface {
action: 'transfer';
from_account_id: number;
to_account_id: number;
quantity: string;
comment: string;
}
/**
* Доменный интерфейс для операции блокировки средств (block)
*/
export interface LedgerBlockOperationDomainInterface extends LedgerOperationBaseDomainInterface {
action: 'block';
account_id: number;
quantity: string;
comment: string;
}
/**
* Доменный интерфейс для операции разблокировки средств (unblock)
*/
export interface LedgerUnblockOperationDomainInterface extends LedgerOperationBaseDomainInterface {
action: 'unblock';
account_id: number;
quantity: string;
comment: string;
}
/**
* Объединяющий тип для всех операций ledger
*/
export type LedgerOperationDomainInterface =
| LedgerAddOperationDomainInterface
| LedgerSubOperationDomainInterface
| LedgerTransferOperationDomainInterface
| LedgerBlockOperationDomainInterface
| LedgerUnblockOperationDomainInterface;
/**
* Доменный интерфейс для запроса истории операций
*/
@@ -7,8 +7,6 @@ import { Entity, PrimaryColumn, Column, CreateDateColumn, Index } from 'typeorm'
@Entity('ledger_operations')
@Index(['coopname', 'created_at'])
@Index(['coopname', 'account_id', 'created_at'])
@Index(['coopname', 'from_account_id', 'created_at'])
@Index(['coopname', 'to_account_id', 'created_at'])
export class LedgerOperationEntity {
@PrimaryColumn({ type: 'bigint' })
global_sequence!: number;
@@ -23,7 +21,7 @@ export class LedgerOperationEntity {
@CreateDateColumn()
created_at!: Date;
// Поля для операций add, sub, block, unblock
// Поля для операций debet, credit, block, unblock
@Column({ type: 'bigint', nullable: true })
account_id?: number;
@@ -32,11 +30,4 @@ export class LedgerOperationEntity {
@Column({ type: 'text', nullable: true })
comment?: string;
// Поля для операции transfer
@Column({ type: 'bigint', nullable: true })
from_account_id?: number;
@Column({ type: 'bigint', nullable: true })
to_account_id?: number;
}
@@ -26,8 +26,6 @@ export class TypeOrmLedgerOperationRepository implements LedgerOperationReposito
account_id: operation.account_id,
quantity: operation.quantity,
comment: operation.comment,
from_account_id: operation.from_account_id,
to_account_id: operation.to_account_id,
});
// Используем upsert (ON CONFLICT DO UPDATE) по global_sequence
@@ -41,10 +39,7 @@ export class TypeOrmLedgerOperationRepository implements LedgerOperationReposito
// Фильтр по account_id если указан
if (params.account_id !== undefined) {
queryBuilder.andWhere(
'(op.account_id = :account_id OR op.from_account_id = :account_id OR op.to_account_id = :account_id)',
{ account_id: params.account_id }
);
queryBuilder.andWhere('op.account_id = :account_id', { account_id: params.account_id });
}
// Сортировка
@@ -68,25 +63,15 @@ export class TypeOrmLedgerOperationRepository implements LedgerOperationReposito
// Преобразование в доменные интерфейсы
const operations = entities.map((entity) => {
const operationData: any = {
return {
global_sequence: entity.global_sequence,
coopname: entity.coopname,
action: entity.action,
created_at: entity.created_at,
account_id: entity.account_id,
quantity: entity.quantity,
comment: entity.comment,
};
if (entity.action === 'transfer') {
operationData.from_account_id = entity.from_account_id;
operationData.to_account_id = entity.to_account_id;
operationData.quantity = entity.quantity;
operationData.comment = entity.comment;
} else {
operationData.account_id = entity.account_id;
operationData.quantity = entity.quantity;
operationData.comment = entity.comment;
}
return operationData;
});
const totalPages = Math.ceil(totalCount / limit);
@@ -108,24 +93,16 @@ export class TypeOrmLedgerOperationRepository implements LedgerOperationReposito
return null;
}
const operationData: any = {
const operationData = {
global_sequence: entity.global_sequence,
coopname: entity.coopname,
action: entity.action,
created_at: entity.created_at,
account_id: entity.account_id,
quantity: entity.quantity,
comment: entity.comment,
};
if (entity.action === 'transfer') {
operationData.from_account_id = entity.from_account_id;
operationData.to_account_id = entity.to_account_id;
operationData.quantity = entity.quantity;
operationData.comment = entity.comment;
} else {
operationData.account_id = entity.account_id;
operationData.quantity = entity.quantity;
operationData.comment = entity.comment;
}
return new LedgerOperationDomainEntity(operationData);
}
}
@@ -1,3 +1,5 @@
export * from './get-ledger-input.dto';
export * from './get-ledger-history-input.dto';
export * from './chart-of-accounts-item.dto';
export * from './ledger-state.dto';
export * from './ledger-operation.dto';
@@ -1,10 +1,10 @@
import { Field, ObjectType, Int, createUnionType } from '@nestjs/graphql';
import { Field, ObjectType, Int } from '@nestjs/graphql';
/**
* Базовый DTO для операции ledger
* DTO для операции ledger
*/
@ObjectType('LedgerOperationBase')
abstract class LedgerOperationBaseDTO {
@ObjectType('LedgerOperation')
export class LedgerOperationDTO {
@Field(() => Int, { description: 'Номер глобальной последовательности блокчейна' })
global_sequence!: number;
@@ -16,15 +16,6 @@ abstract class LedgerOperationBaseDTO {
@Field(() => Date, { description: 'Дата и время создания операции' })
created_at!: Date;
}
/**
* DTO для операции пополнения счета (add)
*/
@ObjectType('LedgerAddOperation')
export class LedgerAddOperationDTO extends LedgerOperationBaseDTO {
@Field(() => String, { description: 'Тип операции' })
action!: 'add';
@Field(() => Int, { description: 'ID счета' })
account_id!: number;
@@ -32,122 +23,16 @@ export class LedgerAddOperationDTO extends LedgerOperationBaseDTO {
@Field(() => String, { description: 'Сумма операции' })
quantity!: string;
@Field(() => String, { description: 'Комментарий к операции' })
@Field(() => String, { description: 'Комментарий к операции', nullable: true })
comment!: string;
}
/**
* DTO для операции списания со счета (sub)
*/
@ObjectType('LedgerSubOperation')
export class LedgerSubOperationDTO extends LedgerOperationBaseDTO {
@Field(() => String, { description: 'Тип операции' })
action!: 'sub';
@Field(() => Int, { description: 'ID счета' })
account_id!: number;
@Field(() => String, { description: 'Сумма операции' })
quantity!: string;
@Field(() => String, { description: 'Комментарий к операции' })
comment!: string;
}
/**
* DTO для операции перевода между счетами (transfer)
*/
@ObjectType('LedgerTransferOperation')
export class LedgerTransferOperationDTO extends LedgerOperationBaseDTO {
@Field(() => String, { description: 'Тип операции' })
action!: 'transfer';
@Field(() => Int, { description: 'ID счета отправителя' })
from_account_id!: number;
@Field(() => Int, { description: 'ID счета получателя' })
to_account_id!: number;
@Field(() => String, { description: 'Сумма операции' })
quantity!: string;
@Field(() => String, { description: 'Комментарий к операции' })
comment!: string;
}
/**
* DTO для операции блокировки средств (block)
*/
@ObjectType('LedgerBlockOperation')
export class LedgerBlockOperationDTO extends LedgerOperationBaseDTO {
@Field(() => String, { description: 'Тип операции' })
action!: 'block';
@Field(() => Int, { description: 'ID счета' })
account_id!: number;
@Field(() => String, { description: 'Сумма операции' })
quantity!: string;
@Field(() => String, { description: 'Комментарий к операции' })
comment!: string;
}
/**
* DTO для операции разблокировки средств (unblock)
*/
@ObjectType('LedgerUnblockOperation')
export class LedgerUnblockOperationDTO extends LedgerOperationBaseDTO {
@Field(() => String, { description: 'Тип операции' })
action!: 'unblock';
@Field(() => Int, { description: 'ID счета' })
account_id!: number;
@Field(() => String, { description: 'Сумма операции' })
quantity!: string;
@Field(() => String, { description: 'Комментарий к операции' })
comment!: string;
}
/**
* Union type для всех типов операций ledger
*/
export const LedgerOperationUnion = createUnionType({
name: 'LedgerOperation',
types: () => [
LedgerAddOperationDTO,
LedgerSubOperationDTO,
LedgerTransferOperationDTO,
LedgerBlockOperationDTO,
LedgerUnblockOperationDTO,
],
resolveType: (value) => {
switch (value.action) {
case 'add':
return LedgerAddOperationDTO;
case 'sub':
return LedgerSubOperationDTO;
case 'transfer':
return LedgerTransferOperationDTO;
case 'block':
return LedgerBlockOperationDTO;
case 'unblock':
return LedgerUnblockOperationDTO;
default:
return null;
}
},
});
/**
* DTO для ответа с историей операций ledger
*/
@ObjectType('LedgerHistoryResponse')
export class LedgerHistoryResponseDTO {
@Field(() => [LedgerOperationUnion], { description: 'Список операций' })
items!: (typeof LedgerOperationUnion)[];
@Field(() => [LedgerOperationDTO], { description: 'Список операций' })
items!: LedgerOperationDTO[];
@Field(() => Int, { description: 'Общее количество операций' })
totalCount!: number;
@@ -7,9 +7,9 @@ export const authorizations = [{ permissions: [Permissions.active], actor: Actor
/**
* Имя действия
*/
export const actionName = 'transfer'
export const actionName = 'credit'
/**
* @interface
*/
export type ITransfer = Ledger.ITransfer
export type ICredit = Ledger.ICredit
@@ -7,9 +7,9 @@ export const authorizations = [{ permissions: [Permissions.active], actor: Actor
/**
* Имя действия
*/
export const actionName = 'add'
export const actionName = 'debet'
/**
* @interface
*/
export type IAdd = Ledger.IAdd
export type IDebet = Ledger.IDebet
@@ -1,6 +1,5 @@
export * as Add from './add'
export * as Sub from './sub'
export * as Transfer from './transfer'
export * as Add from './debet'
export * as Sub from './credit'
export * as Block from './block'
export * as Unblock from './unblock'
export * as Writeoff from './writeoff'
@@ -7,9 +7,9 @@ export const authorizations = [{ permissions: [Permissions.active], actor: Actor
/**
* Имя действия
*/
export const actionName = 'sub'
export const actionName = 'credit'
/**
* @interface
*/
export type ISub = Ledger.ISub
export type ICredit = Ledger.ICredit
+2 -10
View File
@@ -9,7 +9,7 @@ export type ITimePointSec = string
export type IUint32 = number
export type IUint64 = number | string
export interface IAdd {
export interface IDebet {
coopname: IName
account_id: IUint64
quantity: IAsset
@@ -79,21 +79,13 @@ export interface ISignatureInfo {
meta: string
}
export interface ISub {
export interface ICredit {
coopname: IName
account_id: IUint64
quantity: IAsset
comment: string
}
export interface ITransfer {
coopname: IName
from_account_id: IUint64
to_account_id: IUint64
quantity: IAsset
comment: string
}
export interface IUnblock {
coopname: IName
account_id: IUint64
@@ -12,14 +12,6 @@ export type IGetLedgerHistoryInput =
Queries.Ledger.GetLedgerHistory.IInput['data'];
export type ILedgerOperation = Zeus.ModelTypes['LedgerOperation'];
// Типы для конкретных операций
export type ILedgerAddOperation = Zeus.ModelTypes['LedgerAddOperation'];
export type ILedgerSubOperation = Zeus.ModelTypes['LedgerSubOperation'];
export type ILedgerTransferOperation =
Zeus.ModelTypes['LedgerTransferOperation'];
export type ILedgerBlockOperation = Zeus.ModelTypes['LedgerBlockOperation'];
export type ILedgerUnblockOperation = Zeus.ModelTypes['LedgerUnblockOperation'];
// Интерфейс для пагинации истории операций
export interface ILedgerHistoryPagination {
currentPage: number;
@@ -70,7 +70,6 @@ import {
import type {
ILedgerOperation,
ILedgerHistoryFilter,
ILedgerTransferOperation,
} from 'src/entities/LedgerAccount/types';
// Props
@@ -186,9 +185,8 @@ const formatDate = (dateString: string): string => {
const getActionColor = (action: string): string => {
const colors: Record<string, string> = {
add: 'green',
sub: 'red',
transfer: 'blue',
debet: 'green',
credit: 'red',
block: 'orange',
unblock: 'teal',
writeoff: 'deep-orange',
@@ -199,9 +197,8 @@ const getActionColor = (action: string): string => {
const getActionLabel = (action: string): string => {
const labels: Record<string, string> = {
add: 'Дебет',
sub: 'Кредит',
transfer: 'Перевод',
debet: 'Дебет',
credit: 'Кредит',
block: 'Блокировка',
unblock: 'Разблокировка',
writeoff: 'Списание',
@@ -220,16 +217,8 @@ const getAccountsInfo = (operation: ILedgerOperation): string => {
: `Счет ${accountId}`;
};
// Для переводов показываем источник и назначение
if (operation.action === 'transfer') {
const transferOp = operation as ILedgerTransferOperation;
const fromAccountName = getAccountDisplayName(transferOp.from_account_id);
const toAccountName = getAccountDisplayName(transferOp.to_account_id);
return `${fromAccountName}${toAccountName}`;
}
// Для остальных операций показываем один счет
const accountId = (operation as any).account_id;
// Для всех операций показываем один счет
const accountId = operation.account_id;
return accountId ? getAccountDisplayName(accountId) : '-';
};
+2 -3
View File
@@ -66,9 +66,8 @@ export const subsribedActions: IActionConfig[] = [
{ code: 'meet', action: 'newgdecision', notify: true },
{ code: 'wallet', action: 'createwthd', notify: true },
{ code: 'ledger', action: 'add', notify: true },
{ code: 'ledger', action: 'sub', notify: true },
{ code: 'ledger', action: 'transfer', notify: true },
{ code: 'ledger', action: 'debet', notify: true },
{ code: 'ledger', action: 'credit', notify: true },
{ code: 'ledger', action: 'block', notify: true },
{ code: 'ledger', action: 'unblock', notify: true },
{ code: 'ledger', action: 'writeoff', notify: true },
@@ -1,14 +1,14 @@
import type { MakeAllFieldsRequired } from '../../utils/MakeAllFieldsRequired'
import { paginationSelector } from '../../utils/paginationSelector'
import { type ModelTypes, Selector, type ValueTypes } from '../../zeus/index'
import { rawLedgerOperationUnionSelector } from './ledgerOperationSelectors'
import { rawLedgerOperationSelector } from './ledgerOperationSelectors'
/**
* Пагинированный селектор для истории операций ledger
*/
export const rawLedgerHistorySelector = {
...paginationSelector,
items: rawLedgerOperationUnionSelector
items: rawLedgerOperationSelector
}
// Проверка валидности
@@ -1,107 +1,17 @@
import type { MakeAllFieldsRequired } from '../../utils/MakeAllFieldsRequired'
import { type ModelTypes, Selector, type ValueTypes } from '../../zeus/index'
import { type ModelTypes, Selector } from '../../zeus/index'
/**
* Селектор для базовых полей операции ledger
* Селектор для операции ledger
*/
const rawLedgerOperationBaseSelector = {
export const rawLedgerOperationSelector = {
global_sequence: true,
coopname: true,
action: true,
created_at: true,
}
/**
* Селектор для операции пополнения счета (add)
*/
export const rawLedgerAddOperationSelector = {
...rawLedgerOperationBaseSelector,
account_id: true,
quantity: true,
comment: true,
}
// Проверка валидности
const _validateAdd: MakeAllFieldsRequired<ValueTypes['LedgerAddOperation']> = rawLedgerAddOperationSelector
export type ledgerAddOperationModel = ModelTypes['LedgerAddOperation']
export const ledgerAddOperationSelector = Selector('LedgerAddOperation')(rawLedgerAddOperationSelector)
/**
* Селектор для операции списания со счета (sub)
*/
export const rawLedgerSubOperationSelector = {
...rawLedgerOperationBaseSelector,
account_id: true,
quantity: true,
comment: true,
}
// Проверка валидности
const _validateSub: MakeAllFieldsRequired<ValueTypes['LedgerSubOperation']> = rawLedgerSubOperationSelector
export type ledgerSubOperationModel = ModelTypes['LedgerSubOperation']
export const ledgerSubOperationSelector = Selector('LedgerSubOperation')(rawLedgerSubOperationSelector)
/**
* Селектор для операции перевода между счетами (transfer)
*/
export const rawLedgerTransferOperationSelector = {
...rawLedgerOperationBaseSelector,
from_account_id: true,
to_account_id: true,
quantity: true,
comment: true,
}
// Проверка валидности
const _validateTransfer: MakeAllFieldsRequired<ValueTypes['LedgerTransferOperation']> = rawLedgerTransferOperationSelector
export type ledgerTransferOperationModel = ModelTypes['LedgerTransferOperation']
export const ledgerTransferOperationSelector = Selector('LedgerTransferOperation')(rawLedgerTransferOperationSelector)
/**
* Селектор для операции блокировки средств (block)
*/
export const rawLedgerBlockOperationSelector = {
...rawLedgerOperationBaseSelector,
account_id: true,
quantity: true,
comment: true,
}
// Проверка валидности
const _validateBlock: MakeAllFieldsRequired<ValueTypes['LedgerBlockOperation']> = rawLedgerBlockOperationSelector
export type ledgerBlockOperationModel = ModelTypes['LedgerBlockOperation']
export const ledgerBlockOperationSelector = Selector('LedgerBlockOperation')(rawLedgerBlockOperationSelector)
/**
* Селектор для операции разблокировки средств (unblock)
*/
export const rawLedgerUnblockOperationSelector = {
...rawLedgerOperationBaseSelector,
account_id: true,
quantity: true,
comment: true,
}
// Проверка валидности
const _validateUnblock: MakeAllFieldsRequired<ValueTypes['LedgerUnblockOperation']> = rawLedgerUnblockOperationSelector
export type ledgerUnblockOperationModel = ModelTypes['LedgerUnblockOperation']
export const ledgerUnblockOperationSelector = Selector('LedgerUnblockOperation')(rawLedgerUnblockOperationSelector)
/**
* Селектор для Union типа LedgerOperation
* Включает все возможные поля из всех типов операций
*/
export const rawLedgerOperationUnionSelector = {
'...on LedgerAddOperation': rawLedgerAddOperationSelector,
'...on LedgerSubOperation': rawLedgerSubOperationSelector,
'...on LedgerTransferOperation': rawLedgerTransferOperationSelector,
'...on LedgerBlockOperation': rawLedgerBlockOperationSelector,
'...on LedgerUnblockOperation': rawLedgerUnblockOperationSelector,
}
export type ledgerOperationUnionModel = ModelTypes['LedgerOperation']
export type ledgerOperationModel = ModelTypes['LedgerOperation']
export const ledgerOperationSelector = Selector('LedgerOperation')(rawLedgerOperationSelector)
+7 -51
View File
@@ -1190,24 +1190,6 @@ export const ReturnTypes: Record<string,any> = {
key:"String",
weight:"Int"
},
LedgerAddOperation:{
account_id:"Int",
action:"String",
comment:"String",
coopname:"String",
created_at:"DateTime",
global_sequence:"Int",
quantity:"String"
},
LedgerBlockOperation:{
account_id:"Int",
action:"String",
comment:"String",
coopname:"String",
created_at:"DateTime",
global_sequence:"Int",
quantity:"String"
},
LedgerHistoryResponse:{
currentPage:"Int",
items:"LedgerOperation",
@@ -1215,44 +1197,18 @@ export const ReturnTypes: Record<string,any> = {
totalPages:"Int"
},
LedgerOperation:{
"...on LedgerAddOperation":"LedgerAddOperation",
"...on LedgerBlockOperation":"LedgerBlockOperation",
"...on LedgerSubOperation":"LedgerSubOperation",
"...on LedgerTransferOperation":"LedgerTransferOperation",
"...on LedgerUnblockOperation":"LedgerUnblockOperation"
account_id:"Int",
action:"String",
comment:"String",
coopname:"String",
created_at:"DateTime",
global_sequence:"Int",
quantity:"String"
},
LedgerState:{
chartOfAccounts:"ChartOfAccountsItem",
coopname:"String"
},
LedgerSubOperation:{
account_id:"Int",
action:"String",
comment:"String",
coopname:"String",
created_at:"DateTime",
global_sequence:"Int",
quantity:"String"
},
LedgerTransferOperation:{
action:"String",
comment:"String",
coopname:"String",
created_at:"DateTime",
from_account_id:"Int",
global_sequence:"Int",
quantity:"String",
to_account_id:"Int"
},
LedgerUnblockOperation:{
account_id:"Int",
action:"String",
comment:"String",
coopname:"String",
created_at:"DateTime",
global_sequence:"Int",
quantity:"String"
},
Meet:{
authorization:"DocumentAggregate",
close_at:"DateTime",
+62 -362
View File
@@ -920,7 +920,7 @@ export type ScalarCoders = {
JSON?: ScalarResolver;
JSONObject?: ScalarResolver;
}
type ZEUS_UNIONS = GraphQLTypes["LedgerOperation"] | GraphQLTypes["PaymentMethodData"] | GraphQLTypes["PrivateAccountSearchData"] | GraphQLTypes["UserCertificateUnion"]
type ZEUS_UNIONS = GraphQLTypes["PaymentMethodData"] | GraphQLTypes["PrivateAccountSearchData"] | GraphQLTypes["UserCertificateUnion"]
export type ValueTypes = {
["AcceptChildOrderInput"]: {
@@ -2656,40 +2656,6 @@ export type ValueTypes = {
/** Вес */
weight?:boolean | `@${string}`,
__typename?: boolean | `@${string}`
}>;
["LedgerAddOperation"]: AliasType<{
/** ID счета */
account_id?:boolean | `@${string}`,
/** Тип операции */
action?:boolean | `@${string}`,
/** Комментарий к операции */
comment?:boolean | `@${string}`,
/** Имя кооператива */
coopname?:boolean | `@${string}`,
/** Дата и время создания операции */
created_at?:boolean | `@${string}`,
/** Номер глобальной последовательности блокчейна */
global_sequence?:boolean | `@${string}`,
/** Сумма операции */
quantity?:boolean | `@${string}`,
__typename?: boolean | `@${string}`
}>;
["LedgerBlockOperation"]: AliasType<{
/** ID счета */
account_id?:boolean | `@${string}`,
/** Тип операции */
action?:boolean | `@${string}`,
/** Комментарий к операции */
comment?:boolean | `@${string}`,
/** Имя кооператива */
coopname?:boolean | `@${string}`,
/** Дата и время создания операции */
created_at?:boolean | `@${string}`,
/** Номер глобальной последовательности блокчейна */
global_sequence?:boolean | `@${string}`,
/** Сумма операции */
quantity?:boolean | `@${string}`,
__typename?: boolean | `@${string}`
}>;
["LedgerHistoryResponse"]: AliasType<{
/** Текущая страница */
@@ -2702,11 +2668,21 @@ export type ValueTypes = {
totalPages?:boolean | `@${string}`,
__typename?: boolean | `@${string}`
}>;
["LedgerOperation"]: AliasType<{ ["...on LedgerAddOperation"]?: ValueTypes["LedgerAddOperation"],
["...on LedgerBlockOperation"]?: ValueTypes["LedgerBlockOperation"],
["...on LedgerSubOperation"]?: ValueTypes["LedgerSubOperation"],
["...on LedgerTransferOperation"]?: ValueTypes["LedgerTransferOperation"],
["...on LedgerUnblockOperation"]?: ValueTypes["LedgerUnblockOperation"]
["LedgerOperation"]: AliasType<{
/** ID счета */
account_id?:boolean | `@${string}`,
/** Тип операции */
action?:boolean | `@${string}`,
/** Комментарий к операции */
comment?:boolean | `@${string}`,
/** Имя кооператива */
coopname?:boolean | `@${string}`,
/** Дата и время создания операции */
created_at?:boolean | `@${string}`,
/** Номер глобальной последовательности блокчейна */
global_sequence?:boolean | `@${string}`,
/** Сумма операции */
quantity?:boolean | `@${string}`,
__typename?: boolean | `@${string}`
}>;
["LedgerState"]: AliasType<{
@@ -2715,59 +2691,6 @@ export type ValueTypes = {
/** Имя кооператива */
coopname?:boolean | `@${string}`,
__typename?: boolean | `@${string}`
}>;
["LedgerSubOperation"]: AliasType<{
/** ID счета */
account_id?:boolean | `@${string}`,
/** Тип операции */
action?:boolean | `@${string}`,
/** Комментарий к операции */
comment?:boolean | `@${string}`,
/** Имя кооператива */
coopname?:boolean | `@${string}`,
/** Дата и время создания операции */
created_at?:boolean | `@${string}`,
/** Номер глобальной последовательности блокчейна */
global_sequence?:boolean | `@${string}`,
/** Сумма операции */
quantity?:boolean | `@${string}`,
__typename?: boolean | `@${string}`
}>;
["LedgerTransferOperation"]: AliasType<{
/** Тип операции */
action?:boolean | `@${string}`,
/** Комментарий к операции */
comment?:boolean | `@${string}`,
/** Имя кооператива */
coopname?:boolean | `@${string}`,
/** Дата и время создания операции */
created_at?:boolean | `@${string}`,
/** ID счета отправителя */
from_account_id?:boolean | `@${string}`,
/** Номер глобальной последовательности блокчейна */
global_sequence?:boolean | `@${string}`,
/** Сумма операции */
quantity?:boolean | `@${string}`,
/** ID счета получателя */
to_account_id?:boolean | `@${string}`,
__typename?: boolean | `@${string}`
}>;
["LedgerUnblockOperation"]: AliasType<{
/** ID счета */
account_id?:boolean | `@${string}`,
/** Тип операции */
action?:boolean | `@${string}`,
/** Комментарий к операции */
comment?:boolean | `@${string}`,
/** Имя кооператива */
coopname?:boolean | `@${string}`,
/** Дата и время создания операции */
created_at?:boolean | `@${string}`,
/** Номер глобальной последовательности блокчейна */
global_sequence?:boolean | `@${string}`,
/** Сумма операции */
quantity?:boolean | `@${string}`,
__typename?: boolean | `@${string}`
}>;
["LoginInput"]: {
/** Электронная почта */
@@ -6282,40 +6205,6 @@ export type ResolverInputTypes = {
/** Вес */
weight?:boolean | `@${string}`,
__typename?: boolean | `@${string}`
}>;
["LedgerAddOperation"]: AliasType<{
/** ID счета */
account_id?:boolean | `@${string}`,
/** Тип операции */
action?:boolean | `@${string}`,
/** Комментарий к операции */
comment?:boolean | `@${string}`,
/** Имя кооператива */
coopname?:boolean | `@${string}`,
/** Дата и время создания операции */
created_at?:boolean | `@${string}`,
/** Номер глобальной последовательности блокчейна */
global_sequence?:boolean | `@${string}`,
/** Сумма операции */
quantity?:boolean | `@${string}`,
__typename?: boolean | `@${string}`
}>;
["LedgerBlockOperation"]: AliasType<{
/** ID счета */
account_id?:boolean | `@${string}`,
/** Тип операции */
action?:boolean | `@${string}`,
/** Комментарий к операции */
comment?:boolean | `@${string}`,
/** Имя кооператива */
coopname?:boolean | `@${string}`,
/** Дата и время создания операции */
created_at?:boolean | `@${string}`,
/** Номер глобальной последовательности блокчейна */
global_sequence?:boolean | `@${string}`,
/** Сумма операции */
quantity?:boolean | `@${string}`,
__typename?: boolean | `@${string}`
}>;
["LedgerHistoryResponse"]: AliasType<{
/** Текущая страница */
@@ -6329,11 +6218,20 @@ export type ResolverInputTypes = {
__typename?: boolean | `@${string}`
}>;
["LedgerOperation"]: AliasType<{
LedgerAddOperation?:ResolverInputTypes["LedgerAddOperation"],
LedgerBlockOperation?:ResolverInputTypes["LedgerBlockOperation"],
LedgerSubOperation?:ResolverInputTypes["LedgerSubOperation"],
LedgerTransferOperation?:ResolverInputTypes["LedgerTransferOperation"],
LedgerUnblockOperation?:ResolverInputTypes["LedgerUnblockOperation"],
/** ID счета */
account_id?:boolean | `@${string}`,
/** Тип операции */
action?:boolean | `@${string}`,
/** Комментарий к операции */
comment?:boolean | `@${string}`,
/** Имя кооператива */
coopname?:boolean | `@${string}`,
/** Дата и время создания операции */
created_at?:boolean | `@${string}`,
/** Номер глобальной последовательности блокчейна */
global_sequence?:boolean | `@${string}`,
/** Сумма операции */
quantity?:boolean | `@${string}`,
__typename?: boolean | `@${string}`
}>;
["LedgerState"]: AliasType<{
@@ -6342,59 +6240,6 @@ export type ResolverInputTypes = {
/** Имя кооператива */
coopname?:boolean | `@${string}`,
__typename?: boolean | `@${string}`
}>;
["LedgerSubOperation"]: AliasType<{
/** ID счета */
account_id?:boolean | `@${string}`,
/** Тип операции */
action?:boolean | `@${string}`,
/** Комментарий к операции */
comment?:boolean | `@${string}`,
/** Имя кооператива */
coopname?:boolean | `@${string}`,
/** Дата и время создания операции */
created_at?:boolean | `@${string}`,
/** Номер глобальной последовательности блокчейна */
global_sequence?:boolean | `@${string}`,
/** Сумма операции */
quantity?:boolean | `@${string}`,
__typename?: boolean | `@${string}`
}>;
["LedgerTransferOperation"]: AliasType<{
/** Тип операции */
action?:boolean | `@${string}`,
/** Комментарий к операции */
comment?:boolean | `@${string}`,
/** Имя кооператива */
coopname?:boolean | `@${string}`,
/** Дата и время создания операции */
created_at?:boolean | `@${string}`,
/** ID счета отправителя */
from_account_id?:boolean | `@${string}`,
/** Номер глобальной последовательности блокчейна */
global_sequence?:boolean | `@${string}`,
/** Сумма операции */
quantity?:boolean | `@${string}`,
/** ID счета получателя */
to_account_id?:boolean | `@${string}`,
__typename?: boolean | `@${string}`
}>;
["LedgerUnblockOperation"]: AliasType<{
/** ID счета */
account_id?:boolean | `@${string}`,
/** Тип операции */
action?:boolean | `@${string}`,
/** Комментарий к операции */
comment?:boolean | `@${string}`,
/** Имя кооператива */
coopname?:boolean | `@${string}`,
/** Дата и время создания операции */
created_at?:boolean | `@${string}`,
/** Номер глобальной последовательности блокчейна */
global_sequence?:boolean | `@${string}`,
/** Сумма операции */
quantity?:boolean | `@${string}`,
__typename?: boolean | `@${string}`
}>;
["LoginInput"]: {
/** Электронная почта */
@@ -9872,38 +9717,6 @@ export type ModelTypes = {
key: string,
/** Вес */
weight: number
};
["LedgerAddOperation"]: {
/** ID счета */
account_id: number,
/** Тип операции */
action: string,
/** Комментарий к операции */
comment: string,
/** Имя кооператива */
coopname: string,
/** Дата и время создания операции */
created_at: ModelTypes["DateTime"],
/** Номер глобальной последовательности блокчейна */
global_sequence: number,
/** Сумма операции */
quantity: string
};
["LedgerBlockOperation"]: {
/** ID счета */
account_id: number,
/** Тип операции */
action: string,
/** Комментарий к операции */
comment: string,
/** Имя кооператива */
coopname: string,
/** Дата и время создания операции */
created_at: ModelTypes["DateTime"],
/** Номер глобальной последовательности блокчейна */
global_sequence: number,
/** Сумма операции */
quantity: string
};
["LedgerHistoryResponse"]: {
/** Текущая страница */
@@ -9915,62 +9728,27 @@ export type ModelTypes = {
/** Общее количество страниц */
totalPages: number
};
["LedgerOperation"]:ModelTypes["LedgerAddOperation"] | ModelTypes["LedgerBlockOperation"] | ModelTypes["LedgerSubOperation"] | ModelTypes["LedgerTransferOperation"] | ModelTypes["LedgerUnblockOperation"];
["LedgerOperation"]: {
/** ID счета */
account_id: number,
/** Тип операции */
action: string,
/** Комментарий к операции */
comment?: string | undefined | null,
/** Имя кооператива */
coopname: string,
/** Дата и время создания операции */
created_at: ModelTypes["DateTime"],
/** Номер глобальной последовательности блокчейна */
global_sequence: number,
/** Сумма операции */
quantity: string
};
["LedgerState"]: {
/** План счетов с актуальными данными */
chartOfAccounts: Array<ModelTypes["ChartOfAccountsItem"]>,
/** Имя кооператива */
coopname: string
};
["LedgerSubOperation"]: {
/** ID счета */
account_id: number,
/** Тип операции */
action: string,
/** Комментарий к операции */
comment: string,
/** Имя кооператива */
coopname: string,
/** Дата и время создания операции */
created_at: ModelTypes["DateTime"],
/** Номер глобальной последовательности блокчейна */
global_sequence: number,
/** Сумма операции */
quantity: string
};
["LedgerTransferOperation"]: {
/** Тип операции */
action: string,
/** Комментарий к операции */
comment: string,
/** Имя кооператива */
coopname: string,
/** Дата и время создания операции */
created_at: ModelTypes["DateTime"],
/** ID счета отправителя */
from_account_id: number,
/** Номер глобальной последовательности блокчейна */
global_sequence: number,
/** Сумма операции */
quantity: string,
/** ID счета получателя */
to_account_id: number
};
["LedgerUnblockOperation"]: {
/** ID счета */
account_id: number,
/** Тип операции */
action: string,
/** Комментарий к операции */
comment: string,
/** Имя кооператива */
coopname: string,
/** Дата и время создания операции */
created_at: ModelTypes["DateTime"],
/** Номер глобальной последовательности блокчейна */
global_sequence: number,
/** Сумма операции */
quantity: string
};
["LoginInput"]: {
/** Электронная почта */
@@ -13519,40 +13297,6 @@ export type GraphQLTypes = {
key: string,
/** Вес */
weight: number
};
["LedgerAddOperation"]: {
__typename: "LedgerAddOperation",
/** ID счета */
account_id: number,
/** Тип операции */
action: string,
/** Комментарий к операции */
comment: string,
/** Имя кооператива */
coopname: string,
/** Дата и время создания операции */
created_at: GraphQLTypes["DateTime"],
/** Номер глобальной последовательности блокчейна */
global_sequence: number,
/** Сумма операции */
quantity: string
};
["LedgerBlockOperation"]: {
__typename: "LedgerBlockOperation",
/** ID счета */
account_id: number,
/** Тип операции */
action: string,
/** Комментарий к операции */
comment: string,
/** Имя кооператива */
coopname: string,
/** Дата и время создания операции */
created_at: GraphQLTypes["DateTime"],
/** Номер глобальной последовательности блокчейна */
global_sequence: number,
/** Сумма операции */
quantity: string
};
["LedgerHistoryResponse"]: {
__typename: "LedgerHistoryResponse",
@@ -13565,13 +13309,22 @@ export type GraphQLTypes = {
/** Общее количество страниц */
totalPages: number
};
["LedgerOperation"]:{
__typename:"LedgerAddOperation" | "LedgerBlockOperation" | "LedgerSubOperation" | "LedgerTransferOperation" | "LedgerUnblockOperation"
['...on LedgerAddOperation']: '__union' & GraphQLTypes["LedgerAddOperation"];
['...on LedgerBlockOperation']: '__union' & GraphQLTypes["LedgerBlockOperation"];
['...on LedgerSubOperation']: '__union' & GraphQLTypes["LedgerSubOperation"];
['...on LedgerTransferOperation']: '__union' & GraphQLTypes["LedgerTransferOperation"];
['...on LedgerUnblockOperation']: '__union' & GraphQLTypes["LedgerUnblockOperation"];
["LedgerOperation"]: {
__typename: "LedgerOperation",
/** ID счета */
account_id: number,
/** Тип операции */
action: string,
/** Комментарий к операции */
comment?: string | undefined | null,
/** Имя кооператива */
coopname: string,
/** Дата и время создания операции */
created_at: GraphQLTypes["DateTime"],
/** Номер глобальной последовательности блокчейна */
global_sequence: number,
/** Сумма операции */
quantity: string
};
["LedgerState"]: {
__typename: "LedgerState",
@@ -13579,59 +13332,6 @@ export type GraphQLTypes = {
chartOfAccounts: Array<GraphQLTypes["ChartOfAccountsItem"]>,
/** Имя кооператива */
coopname: string
};
["LedgerSubOperation"]: {
__typename: "LedgerSubOperation",
/** ID счета */
account_id: number,
/** Тип операции */
action: string,
/** Комментарий к операции */
comment: string,
/** Имя кооператива */
coopname: string,
/** Дата и время создания операции */
created_at: GraphQLTypes["DateTime"],
/** Номер глобальной последовательности блокчейна */
global_sequence: number,
/** Сумма операции */
quantity: string
};
["LedgerTransferOperation"]: {
__typename: "LedgerTransferOperation",
/** Тип операции */
action: string,
/** Комментарий к операции */
comment: string,
/** Имя кооператива */
coopname: string,
/** Дата и время создания операции */
created_at: GraphQLTypes["DateTime"],
/** ID счета отправителя */
from_account_id: number,
/** Номер глобальной последовательности блокчейна */
global_sequence: number,
/** Сумма операции */
quantity: string,
/** ID счета получателя */
to_account_id: number
};
["LedgerUnblockOperation"]: {
__typename: "LedgerUnblockOperation",
/** ID счета */
account_id: number,
/** Тип операции */
action: string,
/** Комментарий к операции */
comment: string,
/** Имя кооператива */
coopname: string,
/** Дата и время создания операции */
created_at: GraphQLTypes["DateTime"],
/** Номер глобальной последовательности блокчейна */
global_sequence: number,
/** Сумма операции */
quantity: string
};
["LoginInput"]: {
/** Электронная почта */