Added transaction feature, fixed some mistakes
This commit is contained in:
@@ -3,5 +3,6 @@ package domain
|
||||
type AuthRequest struct {
|
||||
TelegramId *string `json:"telegram_id"`
|
||||
OTP *int64 `json:"otp"`
|
||||
InitData *string `json:"init_data"`
|
||||
|
||||
InitData *string `json:"init_data"`
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ type Family struct {
|
||||
ID int64
|
||||
Name string
|
||||
OwnerID int64
|
||||
TelegramChatID int64
|
||||
TelegramChatName string
|
||||
TelegramChatID *int64
|
||||
TelegramChatName *string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
@@ -29,37 +29,27 @@ type FamilyMember struct {
|
||||
JoinedAt time.Time
|
||||
}
|
||||
|
||||
type FamilyThread struct {
|
||||
ID int64
|
||||
FamilyID int64
|
||||
Type string
|
||||
Title string
|
||||
TelegramTopicID int64
|
||||
IsSystem bool
|
||||
CreatedBy int64
|
||||
CreatedAt time.Time
|
||||
}
|
||||
|
||||
type CreateFamilyRequest struct {
|
||||
Name string `json:"name"`
|
||||
OwnerID int64 `json:"owner_id"`
|
||||
TelegramChatID int64 `json:"telegram_chat_id"`
|
||||
TelegramChatName string `json:"telegram_chat_name"`
|
||||
Name string `json:"name"`
|
||||
OwnerID int64 `json:"owner_id"`
|
||||
TelegramChatID *int64 `json:"telegram_chat_id"`
|
||||
TelegramChatName *string `json:"telegram_chat_name"`
|
||||
}
|
||||
|
||||
type UpdateFamilyRequest struct {
|
||||
Name *string `json:"name"`
|
||||
TelegramChatName string `json:"telegram_chat_name"`
|
||||
TelegramChatID *int64 `json:"telegram_chat_id"`
|
||||
TelegramChatName *string `json:"telegram_chat_name"`
|
||||
}
|
||||
|
||||
type FamilyResponse struct {
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
OwnerID int64 `json:"owner_id"`
|
||||
TelegramChatID int64 `json:"telegram_chat_id"`
|
||||
TelegramChatName string `json:"telegram_chat_name"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
OwnerID int64 `json:"owner_id"`
|
||||
TelegramChatID *int64 `json:"telegram_chat_id"`
|
||||
TelegramChatName *string `json:"telegram_chat_name"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
}
|
||||
|
||||
func (response *FamilyResponse) ModelToResponse(f *Family) FamilyResponse {
|
||||
|
||||
@@ -3,6 +3,8 @@ package domain
|
||||
import "time"
|
||||
|
||||
type Position struct {
|
||||
ID int64 `json:"id"`
|
||||
ReceiptID int64 `json:"receipt_id"`
|
||||
SectionNumber string `json:"section_number"`
|
||||
GTINCode string `json:"gtin_code"`
|
||||
Tag string `json:"tag"`
|
||||
@@ -25,6 +27,7 @@ type Position struct {
|
||||
|
||||
type Receipt struct {
|
||||
ID int `json:"id"`
|
||||
TransactionID *int64 `json:"transaction_id"`
|
||||
Status int `json:"STATUS"`
|
||||
AnotherAmount float64 `json:"another_amount"`
|
||||
CashAmount float64 `json:"cash_amount"`
|
||||
@@ -64,12 +67,18 @@ type Receipt struct {
|
||||
}
|
||||
|
||||
type AddReceiptRequest struct {
|
||||
Number string `json:"number" binding:"required,min=24,max=24"`
|
||||
Date string `json:"date" binding:"required"`
|
||||
Number string `json:"number" binding:"required,min=24,max=24"`
|
||||
Date string `json:"date" binding:"required"`
|
||||
FamilyID *int64 `json:"family_id"`
|
||||
CreatedBy *int64 `json:"created_by"`
|
||||
Type *string `json:"type"`
|
||||
Category *string `json:"category"`
|
||||
Description *string `json:"description"`
|
||||
}
|
||||
|
||||
type AddReceiptResponse struct {
|
||||
ID int32 `json:"id"`
|
||||
Number string `json:"number"`
|
||||
Date time.Time `json:"date"`
|
||||
ID int32 `json:"id"`
|
||||
Number string `json:"number"`
|
||||
Date time.Time `json:"date"`
|
||||
TransactionID *int64 `json:"transaction_id,omitempty"`
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package domain
|
||||
|
||||
import "time"
|
||||
|
||||
type Transaction struct {
|
||||
ID int64
|
||||
FamilyID int64
|
||||
Description *string
|
||||
Type string
|
||||
DateTime time.Time
|
||||
Category string
|
||||
Amount float64
|
||||
CreatedAt time.Time
|
||||
CreatedBy int64
|
||||
ReceiptID *int64
|
||||
}
|
||||
|
||||
type CreateTransactionRequest struct {
|
||||
FamilyID int64
|
||||
Description *string
|
||||
Type string
|
||||
DateTime time.Time
|
||||
Category string
|
||||
Amount float64
|
||||
CreatedBy int64
|
||||
ReceiptID *int64
|
||||
}
|
||||
|
||||
type UpdateTransactionRequest struct {
|
||||
Description *string
|
||||
Type *string
|
||||
DateTime *time.Time
|
||||
Category *string
|
||||
Amount *float64
|
||||
ReceiptID *int64
|
||||
DetachReceipt bool
|
||||
}
|
||||
|
||||
type TransactionListFilter struct {
|
||||
FamilyID *int64
|
||||
CreatedBy *int64
|
||||
Type *string
|
||||
Category *string
|
||||
DateFrom *time.Time
|
||||
DateTo *time.Time
|
||||
Limit int
|
||||
Offset int
|
||||
}
|
||||
Reference in New Issue
Block a user