Last active
December 16, 2021 04:28
-
-
Save lomeat/f8eddd052b6e47d8b1639f736baadaca to your computer and use it in GitHub Desktop.
Important types for BACKEND json response for passport
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type Passport = { | |
id: number; | |
title: string; | |
children: PassportCategory[] | PassportNomenclature[] | null; | |
}; | |
// Если что amount - это количество/объем | |
// в контексте нашего проекта amount - это объем товара | |
// а count - это счетчик чего-то конкретного | |
// amount - объем | |
// count - счетчик | |
// To something - к чему-то, типа "_to" это "к" в "к оплате" | |
// payment_amount_to | |
// Now - надеюсь тут и так понятно | |
// payment_amount_now | |
type PassportTableStatic = { | |
budget?: { | |
amount?: number; | |
price_unit?: number; | |
price_sum?: number; | |
}; | |
contract?: { | |
date?: string | Date; | |
responsible_uuid?: string; | |
responsible_name?: string; | |
agent_name?: string; | |
agent_count?: number; | |
amount?: number; | |
price_unit?: number; | |
price_sum?: number; | |
}; | |
payment?: { | |
count?: number; | |
date?: string | Date; | |
amount_to?: number; | |
amount_not?: number; | |
price_unit?: number; | |
price_sum_to?: number; | |
price_sum_now?: number; | |
status?: string; | |
percent_to?: number; | |
percent_now?: number; | |
}; | |
ttn?: { | |
amount?: number; | |
date?: string | Date; | |
document_count?: number; | |
percent?: number; | |
}; | |
invoice?: { | |
amount?: number; | |
price_unit?: number; | |
price_sum?: number; | |
}; | |
}; | |
export type PassportCategory = PassportTableStatic & { | |
id: number | null; | |
children: PassportCategory[] | PassportNomenclature[] | null; | |
title: string; | |
unit?: string; | |
}; | |
export type PassportNomenclature = PassportTableStatic & { | |
id: number; | |
base_title: string; | |
base_unit?: string; | |
// --- ADDIIONAL TABLE STATIC --- | |
approve?: { | |
status?: string; | |
comment?: string; | |
}; | |
// --- INNER HIDE ARRAYS FOR POPS --- | |
agents: ContractAgents[]; | |
}; | |
// Тут дальше акцент на названии важных полей, название остальных не так важно | |
// но хотелось бы адекватные | |
// примеров тут много, где черпать вдохновение | |
type ContractAgents = { | |
id: number; | |
contracts?: Contract[]; | |
payments?: Payment[]; | |
}; | |
type Contract = { | |
uuid: string; | |
payments?: Payment[]; | |
ttns?: TTN[]; | |
invoices?: Invoice[]; | |
}; | |
type Payment = { | |
uuid: string; | |
ttns?: TTN[]; | |
invoices?: Invoice[]; | |
}; | |
type TTN = { | |
uuid: string; | |
}; | |
type Invoice = { | |
uuid: string; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment