Add userbudget
This commit is contained in:
parent
07d5816251
commit
57a69c448d
@ -11,7 +11,14 @@ type Budget struct {
|
|||||||
LastModification time.Time
|
LastModification time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UserBudget represents the relation between users and budgets
|
||||||
|
type UserBudget struct {
|
||||||
|
UserID string `sql:",pk"`
|
||||||
|
BudgetID string `sql:",pk"`
|
||||||
|
}
|
||||||
|
|
||||||
// BudgetService provides Methods for CRUD of Budgets
|
// BudgetService provides Methods for CRUD of Budgets
|
||||||
type BudgetService interface {
|
type BudgetService interface {
|
||||||
Budget(id string) (Budget, error)
|
Budget(id string) (Budget, error)
|
||||||
|
BudgetsForUser(user User) ([]Budget, error)
|
||||||
}
|
}
|
||||||
|
@ -11,3 +11,7 @@ func (s *Repository) Budget(id string) (*budgeteer.Budget, error) {
|
|||||||
}
|
}
|
||||||
return b, nil
|
return b, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Repository) BudgetsForUser(user budgeteer.User) ([]budgeteer.Budget, error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
4
postgres/user_budgets.sql
Normal file
4
postgres/user_budgets.sql
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
CREATE TABLE user_budgets (
|
||||||
|
user_id char(26),
|
||||||
|
budget_id char(26)
|
||||||
|
);
|
Loading…
x
Reference in New Issue
Block a user