Compare commits
8 Commits
c2f9ef8ec7
...
master
Author | SHA1 | Date | |
---|---|---|---|
45af54d995 | |||
a241298170 | |||
9248c12aab | |||
8817e665e9 | |||
0b36048f47 | |||
0c2438373d | |||
2f636b5f9c | |||
4ef0b759ef |
@@ -29,13 +29,15 @@ linters-settings:
|
|||||||
wrapcheck:
|
wrapcheck:
|
||||||
ignoreSigs:
|
ignoreSigs:
|
||||||
- .JSON(
|
- .JSON(
|
||||||
|
- .Redirect(
|
||||||
|
- .String(
|
||||||
- .Errorf(
|
- .Errorf(
|
||||||
- errors.New(
|
- errors.New(
|
||||||
- errors.Unwrap(
|
- errors.Unwrap(
|
||||||
- .Wrap(
|
- .Wrap(
|
||||||
- .Wrapf(
|
- .Wrapf(
|
||||||
- .WithMessage(
|
- .WithMessage(
|
||||||
- .WithMessagef(
|
- .WithMessagef(
|
||||||
- .WithStack(
|
- .WithStack(
|
||||||
ignorePackageGlobs:
|
ignorePackageGlobs:
|
||||||
- git.javil.eu/jacob1123/budgeteer/postgres
|
- git.javil.eu/jacob1123/budgeteer/postgres
|
12
bass.build
Normal file
12
bass.build
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
(def go
|
||||||
|
(from (linux/alpine)
|
||||||
|
($ apk add go)))
|
||||||
|
|
||||||
|
(-> ($ go mod download)
|
||||||
|
(with-image go)
|
||||||
|
(with-mount *dir*/go.mod ./go.mod)
|
||||||
|
(with-mount *dir*/go.sum ./go.sum))
|
||||||
|
|
||||||
|
(def go-mods
|
||||||
|
(from go
|
||||||
|
($ go mod download)))
|
@@ -40,6 +40,7 @@ func TestRegisterUser(t *testing.T) {
|
|||||||
http.MethodPost,
|
http.MethodPost,
|
||||||
"/api/v1/user/register",
|
"/api/v1/user/register",
|
||||||
strings.NewReader(`{"password":"pass","email":"info@example.com","name":"Test"}`))
|
strings.NewReader(`{"password":"pass","email":"info@example.com","name":"Test"}`))
|
||||||
|
request.Header.Set("Content-Type", "application/json")
|
||||||
context := engine.NewContext(request, recorder)
|
context := engine.NewContext(request, recorder)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("error creating request: %s", err)
|
t.Errorf("error creating request: %s", err)
|
||||||
|
@@ -63,7 +63,7 @@ func (h *Handler) loginPost(c echo.Context) error {
|
|||||||
var login loginInformation
|
var login loginInformation
|
||||||
err := c.Bind(&login)
|
err := c.Bind(&login)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("parse payload: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
user, err := h.Service.GetUserByUsername(c.Request().Context(), login.User)
|
user, err := h.Service.GetUserByUsername(c.Request().Context(), login.User)
|
||||||
@@ -72,12 +72,12 @@ func (h *Handler) loginPost(c echo.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err = h.CredentialsVerifier.Verify(login.Password, user.Password); err != nil {
|
if err = h.CredentialsVerifier.Verify(login.Password, user.Password); err != nil {
|
||||||
return err
|
return fmt.Errorf("verify password: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
token, err := h.TokenVerifier.CreateToken(&user)
|
token, err := h.TokenVerifier.CreateToken(&user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("create token: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
go h.UpdateLastLogin(user.ID)
|
go h.UpdateLastLogin(user.ID)
|
||||||
@@ -120,7 +120,7 @@ func (h *Handler) registerPost(c echo.Context) error {
|
|||||||
|
|
||||||
hash, err := h.CredentialsVerifier.Hash(register.Password)
|
hash, err := h.CredentialsVerifier.Hash(register.Password)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("hash password: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
createUser := postgres.CreateUserParams{
|
createUser := postgres.CreateUserParams{
|
||||||
@@ -135,7 +135,7 @@ func (h *Handler) registerPost(c echo.Context) error {
|
|||||||
|
|
||||||
token, err := h.TokenVerifier.CreateToken(&user)
|
token, err := h.TokenVerifier.CreateToken(&user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("create token: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
go h.UpdateLastLogin(user.ID)
|
go h.UpdateLastLogin(user.ID)
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"git.javil.eu/jacob1123/budgeteer/postgres"
|
"git.javil.eu/jacob1123/budgeteer/postgres"
|
||||||
@@ -26,12 +27,12 @@ func (h *Handler) importYNAB(c echo.Context) error {
|
|||||||
|
|
||||||
transactionsFile, err := c.FormFile("transactions")
|
transactionsFile, err := c.FormFile("transactions")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("get transactions: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
transactions, err := transactionsFile.Open()
|
transactions, err := transactionsFile.Open()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("open transactions: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ynab.ImportTransactions(c.Request().Context(), transactions)
|
err = ynab.ImportTransactions(c.Request().Context(), transactions)
|
||||||
@@ -41,12 +42,12 @@ func (h *Handler) importYNAB(c echo.Context) error {
|
|||||||
|
|
||||||
assignmentsFile, err := c.FormFile("assignments")
|
assignmentsFile, err := c.FormFile("assignments")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("get assignments: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
assignments, err := assignmentsFile.Open()
|
assignments, err := assignmentsFile.Open()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("open assignments: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ynab.ImportAssignments(c.Request().Context(), assignments)
|
err = ynab.ImportAssignments(c.Request().Context(), assignments)
|
||||||
|
@@ -11,10 +11,10 @@ export interface Suggestion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
text: string,
|
text: string | null,
|
||||||
id: string | undefined,
|
id: string | null,
|
||||||
model: string,
|
model: string,
|
||||||
type?: string | undefined,
|
type?: string | null,
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const SearchQuery = ref(props.text || "");
|
const SearchQuery = ref(props.text || "");
|
||||||
|
@@ -16,9 +16,9 @@ const TX = ref<Transaction>({
|
|||||||
Memo: "",
|
Memo: "",
|
||||||
Amount: 0,
|
Amount: 0,
|
||||||
Payee: "",
|
Payee: "",
|
||||||
PayeeID: undefined,
|
PayeeID: null,
|
||||||
Category: "",
|
Category: "",
|
||||||
CategoryID: undefined,
|
CategoryID: null,
|
||||||
CategoryGroup: "",
|
CategoryGroup: "",
|
||||||
GroupID: "",
|
GroupID: "",
|
||||||
ID: "",
|
ID: "",
|
||||||
|
@@ -42,7 +42,7 @@ const filters = ref({
|
|||||||
ToDate: new Date(2999,11,32),
|
ToDate: new Date(2999,11,32),
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(() => filters.value.AccountID
|
watch(() => (filters.value.AccountID ?? "")
|
||||||
+ filters.value.PayeeID
|
+ filters.value.PayeeID
|
||||||
+ filters.value.CategoryID
|
+ filters.value.CategoryID
|
||||||
+ filters.value.FromDate?.toISOString()
|
+ filters.value.FromDate?.toISOString()
|
||||||
|
@@ -2,7 +2,7 @@ import { defineStore } from "pinia";
|
|||||||
import { GET, POST } from "../api";
|
import { GET, POST } from "../api";
|
||||||
import { useBudgetsStore } from "./budget";
|
import { useBudgetsStore } from "./budget";
|
||||||
import { useSessionStore } from "./session";
|
import { useSessionStore } from "./session";
|
||||||
import { useTransactionsStore } from "./transactions";
|
import { Transaction, useTransactionsStore } from "./transactions";
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
Accounts: Map<string, Account>;
|
Accounts: Map<string, Account>;
|
||||||
@@ -200,6 +200,7 @@ export const useAccountStore = defineStore("budget/account", {
|
|||||||
transactionsStore.AddTransactions(
|
transactionsStore.AddTransactions(
|
||||||
response.Transactions
|
response.Transactions
|
||||||
);
|
);
|
||||||
|
account.Transactions = response.Transactions.map((x : Transaction) =>x.ID);
|
||||||
},
|
},
|
||||||
async FetchMonthBudget(budgetid: string, year: number, month: number) {
|
async FetchMonthBudget(budgetid: string, year: number, month: number) {
|
||||||
const result = await GET(
|
const result = await GET(
|
||||||
|
@@ -17,12 +17,12 @@ export interface Transaction {
|
|||||||
TransferAccount: string;
|
TransferAccount: string;
|
||||||
CategoryGroup: string;
|
CategoryGroup: string;
|
||||||
Category: string;
|
Category: string;
|
||||||
CategoryID: string | undefined;
|
CategoryID: string | null;
|
||||||
Memo: string;
|
Memo: string;
|
||||||
Status: string;
|
Status: string;
|
||||||
GroupID: string;
|
GroupID: string;
|
||||||
Payee: string;
|
Payee: string;
|
||||||
PayeeID: string | undefined;
|
PayeeID: string | null;
|
||||||
Amount: number;
|
Amount: number;
|
||||||
Reconciled: boolean;
|
Reconciled: boolean;
|
||||||
Account: string;
|
Account: string;
|
||||||
@@ -47,10 +47,12 @@ export const useTransactionsStore = defineStore("budget/transactions", {
|
|||||||
}
|
}
|
||||||
return reconciledBalance;
|
return reconciledBalance;
|
||||||
},
|
},
|
||||||
TransactionsByDate(state) : Record<string, Transaction[]> {
|
TransactionsByDate(state) : Record<string, Transaction[]>|undefined{
|
||||||
const accountsStore = useAccountStore();
|
const accountsStore = useAccountStore();
|
||||||
const accountID = accountsStore.CurrentAccountID;
|
const account = accountsStore.CurrentAccount;
|
||||||
const allTransactions = [...this.Transactions.values()].filter(x => x.AccountID == accountID);
|
if(account === undefined)
|
||||||
|
return undefined;
|
||||||
|
const allTransactions = account!.Transactions.map(x => this.Transactions.get(x) ?? {} as Transaction);
|
||||||
return groupBy(allTransactions, x => formatDate(x.Date));
|
return groupBy(allTransactions, x => formatDate(x.Date));
|
||||||
},
|
},
|
||||||
TransactionsList(state) : Transaction[] {
|
TransactionsList(state) : Transaction[] {
|
||||||
|
Reference in New Issue
Block a user