Files
wt 1b6c7211ea feat(auth): implement JWT authentication flow
This commit implements a full-stack authentication system using JWT.

On the backend, a new login endpoint `/api/token` is created. It
validates credentials and issues a signed JWT. A JWT middleware is added
to the server configuration to protect sensitive API endpoints like
`/api/category` and `/api/operation`. Configuration is now managed via a
`wallet.conf` file, loaded at startup.

On the frontend, this enables a complete authentication lifecycle: - A
new `/login` page allows users to enter their credentials. - A
`PrivateRoute` component wraps protected pages, redirecting
unauthenticated users to the login page. - API calls to protected
resources now include the `Authorization: Bearer <token>` header. - A
logout function is added to clear user session data.

refactor(ui): enhance history and category views

This commit also introduces major UI improvements.

The History modal has been completely redesigned. Operations are no
longer displayed as a flat list but are now grouped into tabs for Daily,
Weekly, Monthly, and Yearly views, providing a much clearer overview of
transactions.

The Categories modal now separates categories into "Incomes" and
"Expenses" tabs, reflecting the changes in the backend data model.
2025-08-07 16:18:17 +07:00

74 lines
1.4 KiB
Go

package operation
import (
"backend/model"
"time"
)
func GetAllOperation() ([]model.Operation, error) {
return []model.Operation{
{
ID: "1",
Title: "Operation 1",
Amount: 100,
Category: "Category 1",
SubCategory: model.Subcategory{
ID: "1",
Title: "subcategory",
},
Date: "2022-01-01T00:00:00Z",
Type: "income",
Icon: "😀",
},
{
ID: "2",
Title: "Operation 2",
Amount: 200,
Category: "Category 2",
Date: "2022-01-02T00:00:00Z",
Type: "expense",
Icon: "😂",
},
{
ID: "2",
Title: "Operation 2",
Amount: 200,
Category: "Category 2",
Date: time.Now().Format(time.RFC3339),
Type: "expense",
Icon: "😂",
},
{
ID: "1",
Title: "Operation 1",
Amount: 100,
Category: "Category 1",
SubCategory: model.Subcategory{
ID: "1",
Title: "subcategory",
},
Date: "2022-01-02T00:00:00Z",
Type: "income",
Icon: "😀",
},
{
ID: "2",
Title: "Operation 2",
Amount: 200,
Category: "Category 2",
Date: "2022-06-02T00:00:00Z",
Type: "expense",
Icon: "😂",
},
{
ID: "2",
Title: "Operation 2",
Amount: 200,
Category: "Category 2",
Date: "2022-06-22T00:00:00Z",
Type: "expense",
Icon: "😂",
},
}, nil
}