DAL

package
v0.0.0-...-2e93e0b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2020 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CategoryData

type CategoryData interface {
	GetDataByID(projectId primitive.ObjectID, id primitive.ObjectID) models.Category
	GetCategories(projectId primitive.ObjectID) []models.Category
	AddCategory(userId primitive.ObjectID, projectId primitive.ObjectID, expense *models.Category) primitive.ObjectID
	UpdateCategory(projectId primitive.ObjectID, id primitive.ObjectID, category *models.Category)
	DeleteCategory(projectId primitive.ObjectID, id primitive.ObjectID)
}

CategoryData main interface

type Database

type Database interface {
	NewExpenseData() ExpenseData
	NewCategoryData() CategoryData
	NewUserData() UserData
	NewProjectData() ProjectData
}

Database interface

func NewDatabase

func NewDatabase(cfg *config.Configuration, client *mongo.Client) Database

NewDatabase creates connection to database

type ExpenseData

type ExpenseData interface {
	GetLastHistory(projectId primitive.ObjectID, count int64, date time.Time) []models.Expense
	GetDataByID(projectId primitive.ObjectID, id primitive.ObjectID) models.Expense
	AddExpense(userId primitive.ObjectID, projectId primitive.ObjectID, expense *models.Expense) primitive.ObjectID
	DeleteExpense(projectId primitive.ObjectID, expenseId primitive.ObjectID)
	GetSummary(projectId primitive.ObjectID) []models.CategorySummary
	IsAnyInCategory(projectId primitive.ObjectID, categoryId primitive.ObjectID) bool
}

ExpenseData main interface

type ProjectData

type ProjectData interface {
	AddProject(ownerId primitive.ObjectID, project *models.Project) primitive.ObjectID
	GetProject(id primitive.ObjectID) models.Project
	GetAssignedProjects(userId primitive.ObjectID) []models.Project
	GetProjectsForOwner(ownerId primitive.ObjectID) []models.Project
	UpdateProject(ownerId primitive.ObjectID, id primitive.ObjectID, model *models.Project) models.Project
	DisableProject(projectId primitive.ObjectID)
	AssignUser(projectId primitive.ObjectID, userId primitive.ObjectID)
	UnAssignUser(projectId primitive.ObjectID, userId primitive.ObjectID)
	IsUserAssignedToProject(projectId primitive.ObjectID, userId primitive.ObjectID) bool
	IsOwnerOfProject(projectId primitive.ObjectID, userId primitive.ObjectID) bool
}

type UserData

type UserData interface {
	CreateUser(user *models.User) error
	GetUserByEmail(email string) (models.User, error)
	GetUserById(id primitive.ObjectID) (models.User, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL