Documentation
¶
Index ¶
- Variables
- type AuthRepository
- type AuthService
- type Category
- type CategoryRepository
- type CategoryService
- type CreateCategoryDTO
- type CreateExpenseDTO
- type DeleteCategoryDTO
- type DeleteExpenseDTO
- type Expense
- type ExpenseRepository
- type ExpenseService
- type ForgotPasswordDTO
- type GetAllCategoryDTO
- type GetAllExpensesDTO
- type GetOneExpenseDTO
- type LoginDTO
- type LoginResponse
- type PasswordResetLog
- type SignupDTO
- type UpdateCategoryDTO
- type UpdateExpenseDTO
- type UpdateUserDetailsDTO
- type User
- type UserRepository
- type UserService
Constants ¶
This section is empty.
Variables ¶
View Source
var PaymentMethods []string = []string{"cash", "bank_transfer", "card", "mobile_money", "paypal"}
Functions ¶
This section is empty.
Types ¶
type AuthRepository ¶
type AuthService ¶
type AuthService interface {
Signup(params SignupDTO) error
Login(params LoginDTO) (*LoginResponse, error)
ForgotPassword(params ForgotPasswordDTO) error
}
type Category ¶
type Category struct {
ID uint `json:"id" gorm:"primaryKey"`
Name string `json:"name" gorm:"not null;size:100;uniqueIndex:name_createdbyid"`
IsSystem bool `json:"isSystem" gorm:"default:0"`
CreatedById uint `json:"createdById,omitempty" gorm:"default:0;index;uniqueIndex:name_createdbyid"`
CreatedAt time.Time `json:"createdAt" gorm:"autoCreateTime;type:TIMESTAMP"`
UpdatedAt time.Time `json:"updatedAt" gorm:"autoUpdateTime;type:TIMESTAMP"`
}
type CategoryRepository ¶
type CategoryService ¶
type CategoryService interface {
Create(userId int, params CreateCategoryDTO) error
GetAll(userId int, params GetAllCategoryDTO) (*[]Category, error)
Update(userId int, params UpdateCategoryDTO) error
Delete(userId int, params DeleteCategoryDTO) error
}
type CreateCategoryDTO ¶
type CreateExpenseDTO ¶
type DeleteCategoryDTO ¶
type DeleteCategoryDTO struct {
ID int `json:"id"`
}
type DeleteExpenseDTO ¶
type DeleteExpenseDTO struct {
ID int `json:"id"`
}
type Expense ¶
type Expense struct {
ID uint `json:"id" gorm:"primaryKey"`
UserID uint `json:"userId" gorm:"index"`
CategoryId uint `json:"categoryId" gorm:"not null"`
Category string `json:"category" gorm:"not null;size:100"`
PaymentMethod string `json:"paymentMethod" gorm:"not null;size:100"`
Amount float64 `json:"amount" gorm:"not null"`
Currency string `json:"currency" gorm:"size:5;not null"`
Description string `json:"description" gorm:"not null"`
PayedAt time.Time `json:"payedAt" gorm:"type:TIMESTAMP"`
CreatedAt time.Time `json:"createdAt" gorm:"autoCreateTime;type:TIMESTAMP"`
UpdatedAt time.Time `json:"updatedAt" gorm:"autoUpdateTime;type:TIMESTAMP"`
}
type ExpenseRepository ¶
type ExpenseRepository interface {
Create(expense *Expense) error
GetCategoryByName(name string) (*Category, error)
GetAll(userId int, params GetAllExpensesDTO) (*[]Expense, error)
GetById(userId int, id int) (*Expense, error)
Update(userId int, params UpdateExpenseDTO) error
Delete(userId int, id int) error
GetUserDefaultCurrency(userId int) string
}
type ExpenseService ¶
type ExpenseService interface {
Create(userId int, params CreateExpenseDTO) error
GetAll(userId int, params GetAllExpensesDTO) (*[]Expense, error)
GetById(userId int, params GetOneExpenseDTO) (*Expense, error)
Update(userId int, params UpdateExpenseDTO) error
Delete(userId int, params DeleteExpenseDTO) error
}
type ForgotPasswordDTO ¶
type ForgotPasswordDTO struct {
Email string `json:"email"`
}
type GetAllCategoryDTO ¶
type GetAllExpensesDTO ¶
type GetOneExpenseDTO ¶
type GetOneExpenseDTO struct {
ID int `json:"id"`
}
type LoginResponse ¶
type PasswordResetLog ¶
type PasswordResetLog struct {
ID uint `json:"id" gorm:"primaryKey"`
UserID uint `json:"userId" gorm:"not null;index;uniqueIndex:userid_code"`
Code int `json:"code" gorm:"not null;uniqueIndex:userid_code"`
IsUsed bool `json:"isUsed" gorm:"default:0"`
CreatedAt time.Time `json:"createdAt" gorm:"autoCreateTime;type:TIMESTAMP"`
UpdatedAt time.Time `json:"updatedAt" gorm:"autoUpdateTime;type:TIMESTAMP"`
}
type UpdateCategoryDTO ¶
type UpdateExpenseDTO ¶
type UpdateExpenseDTO struct {
ID int `json:"id"`
CreateExpenseDTO
}
type UpdateUserDetailsDTO ¶
type User ¶
type User struct {
ID uint `json:"id" gorm:"primaryKey"`
Name string `json:"name" gorm:"size:100;not null"`
Username string `json:"username" gorm:"unique;size:100;not null"`
Email string `json:"email" gorm:"unique;not null"`
Password string `json:"password,omitempty"`
IsActive bool `json:"isActive" gorm:"default:1"`
DefaultCurrency string `json:"defaultCurrency" gorm:"size:5"`
CreatedAt time.Time `json:"createdAt" gorm:"autoCreateTime;type:TIMESTAMP"`
UpdatedAt time.Time `json:"updatedAt" gorm:"autoUpdateTime;type:TIMESTAMP"`
}
type UserRepository ¶
type UserRepository interface {
GetById(id int) (*User, error)
UpdateUserDetails(params UpdateUserDetailsDTO) error
}
type UserService ¶
type UserService interface {
GetLoggedInUser(id int) (*User, error)
UpdateUserDetails(params UpdateUserDetailsDTO) error
}
Click to show internal directories.
Click to hide internal directories.