Restructured project

- backend moved to backend directory
- added and initialized frontend with vue
- moved infrastructure files to infra directory
This commit is contained in:
2026-04-01 22:27:26 +03:00
parent 48ef7217eb
commit 9d845c8899
96 changed files with 1591 additions and 118 deletions
+7
View File
@@ -0,0 +1,7 @@
package domain
type AuthRequest struct {
TelegramId *string `json:"telegram_id"`
OTP *int64 `json:"otp"`
InitData *string `json:"init_data"`
}
+75
View File
@@ -0,0 +1,75 @@
package domain
import "time"
type Family struct {
ID int64
Name string
OwnerID int64
TelegramChatID int64
TelegramChatName string
CreatedAt time.Time
UpdatedAt time.Time
}
type FamilyRole string
const (
FamilyRoleOwner FamilyRole = "owner"
FamilyRoleAdmin FamilyRole = "admin"
FamilyRoleMember FamilyRole = "member"
FamilyRoleChild FamilyRole = "child"
)
type FamilyMember struct {
ID int64
FamilyID int64
UserID int64
Role FamilyRole
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"`
}
type UpdateFamilyRequest struct {
Name *string `json:"name"`
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"`
}
func (response *FamilyResponse) ModelToResponse(f *Family) FamilyResponse {
return FamilyResponse{
ID: f.ID,
Name: f.Name,
OwnerID: f.OwnerID,
TelegramChatID: f.TelegramChatID,
TelegramChatName: f.TelegramChatName,
CreatedAt: f.CreatedAt.Format(time.RFC3339),
UpdatedAt: f.UpdatedAt.Format(time.RFC3339),
}
}
+9
View File
@@ -0,0 +1,9 @@
package domain
import "time"
type OTP struct {
UserID int64
Code string
ExpiredAt time.Time
}
+75
View File
@@ -0,0 +1,75 @@
package domain
import "time"
type Position struct {
SectionNumber string `json:"section_number"`
GTINCode string `json:"gtin_code"`
Tag string `json:"tag"`
MarkingCode string `json:"marking_code"`
UKZCode string `json:"ukz_code"`
ProductName string `json:"product_name"`
ProductCountRaw string `json:"product_count"`
ProductCount float64 `json:"-"`
AmountRaw string `json:"amount"`
Amount float64 `json:"-"`
DiscountRaw string `json:"discount"`
Discount float64 `json:"-"`
SurchargeRaw string `json:"surcharge"`
Surcharge float64 `json:"-"`
}
type Receipt struct {
ID int `json:"id"`
Status int `json:"STATUS"`
AnotherAmount float64 `json:"another_amount"`
CashAmount float64 `json:"cash_amount"`
CashboxNumber int64 `json:"cashbox_number"`
Cashier string `json:"cashier"`
ClearingAmount float64 `json:"clearing_amount"`
Currency string `json:"currency"`
DocNum string `json:"doc_num"`
HouseTo string `json:"house_to"`
KodSoato string `json:"kod_soato"`
Margin float64 `json:"margin"`
NameNP string `json:"name_np"`
NameSPD string `json:"name_spd"`
NameTO string `json:"name_to"`
OblastSoato *string `json:"oblast_soato"`
RayonSoato *string `json:"rayon_soato"`
SelsovetSoato *string `json:"selsovet_soato"`
PaymentAmount float64 `json:"payment_amount"`
PaymentType int `json:"payment_type"`
ReceiptNumber string `json:"receipt_number"`
SknoNumber string `json:"skno_number"`
StreetTo string `json:"street_to"`
Success string `json:"success"`
TotalAmount float64 `json:"total_amount"`
TypeNP string `json:"type_np"`
UI string `json:"ui"`
UNP string `json:"unp"`
IssuedAtRaw string `json:"issued_at"`
IssuedAt time.Time `json:"-"`
PositionsRaw string `json:"positions"`
Positions []Position `json:"-"`
}
type AddReceiptRequest struct {
Number string `json:"number" binding:"required,min=24,max=24"`
Date string `json:"date" binding:"required"`
}
type AddReceiptResponse struct {
ID int32 `json:"id"`
Number string `json:"number"`
Date time.Time `json:"date"`
}
+59
View File
@@ -0,0 +1,59 @@
package domain
import (
"time"
)
type UserModel struct {
ID int64
TelegramID int64
Username *string
FirstName *string
LastName *string
LanguageCode *string
CreatedAt time.Time
UpdatedAt time.Time
}
type CreateUserRequest struct {
TelegramID int64 `json:"telegram_id" validate:"required"`
Username *string `json:"username"`
FirstName *string `json:"first_name" validate:"required"`
LastName *string `json:"last_name"`
LanguageCode *string `json:"language_code"`
}
type UpdateUserRequest struct {
Username *string `json:"username"`
FirstName *string `json:"first_name"`
LastName *string `json:"last_name"`
LanguageCode *string `json:"language_code"`
}
type UserResponse struct {
ID int64 `json:"id"`
TelegramID int64 `json:"telegram_id"`
Username *string `json:"username"`
FirstName *string `json:"first_name"`
LastName *string `json:"last_name"`
LanguageCode *string `json:"language_code"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
type UserErrorResponse struct {
Error string `json:"error"`
}
func (response *UserResponse) ModelToResponse(u *UserModel) UserResponse {
return UserResponse{
ID: u.ID,
TelegramID: u.TelegramID,
Username: u.Username,
FirstName: u.FirstName,
LastName: u.LastName,
LanguageCode: u.LanguageCode,
CreatedAt: u.CreatedAt.Format(time.RFC3339),
UpdatedAt: u.UpdatedAt.Format(time.RFC3339),
}
}