all tests works...

This commit is contained in:
samantha42
2026-03-21 18:14:23 +01:00
parent c55e7d6774
commit 6c5b4bae67
6 changed files with 239 additions and 150 deletions

View File

@@ -123,8 +123,8 @@ func (r *ReferenceRepo) ListDepartments(ctx context.Context) ([]model.Department
return depts, rows.Err()
}
func (r *ReferenceRepo) DeleteDepartment(ctx context.Context, id int) error {
_, err := r.db.ExecContext(ctx, `DELETE FROM departments WHERE id = ?`, id)
func (r *ReferenceRepo) DeleteDepartment(ctx context.Context, req model.DeleteDepartmentRequest) error {
_, err := r.db.ExecContext(ctx, `DELETE FROM departments WHERE id = ?`, req.ID)
return err
}
@@ -170,7 +170,7 @@ func (r *ReferenceRepo) getGLAccountByCode(ctx context.Context, code string) (*m
func (r *ReferenceRepo) ListGLAccounts(ctx context.Context) ([]model.GLAccount, error) {
rows, err := r.db.QueryContext(ctx,
`SELECT id, code, description, type, favour_high, active
FROM gl_accounts ORDER BY code`)
FROM gl_accounts ORDER BY code`)
if err != nil {
return nil, err
}
@@ -179,10 +179,12 @@ func (r *ReferenceRepo) ListGLAccounts(ctx context.Context) ([]model.GLAccount,
var accts []model.GLAccount
for rows.Next() {
var a model.GLAccount
var glType string
var favourHigh, active int
if err := rows.Scan(&a.ID, &a.Code, &a.Description, &a.Type, &favourHigh, &active); err != nil {
if err := rows.Scan(&a.ID, &a.Code, &a.Description, &glType, &favourHigh, &active); err != nil {
return nil, err
}
a.Type = glType
a.FavourHigh = favourHigh == 1
a.Active = active == 1
accts = append(accts, a)