Documentation
¶
Index ¶
- Variables
- type CommentRepository
- type EmployeeRepository
- type FileAttachmentRepository
- type NotificationRepository
- type OrganizationRepository
- type PostgresCommentRepository
- func (r *PostgresCommentRepository) AddMention(ctx context.Context, commentID, userID uuid.UUID) error
- func (r *PostgresCommentRepository) Create(ctx context.Context, comment *models.Comment) error
- func (r *PostgresCommentRepository) Delete(ctx context.Context, id uuid.UUID) error
- func (r *PostgresCommentRepository) GetByID(ctx context.Context, id uuid.UUID) (*models.Comment, error)
- func (r *PostgresCommentRepository) GetMentions(ctx context.Context, commentID uuid.UUID) ([]uuid.UUID, error)
- func (r *PostgresCommentRepository) List(ctx context.Context, params models.CommentListParams) ([]models.Comment, int, error)
- func (r *PostgresCommentRepository) Update(ctx context.Context, comment *models.Comment) error
- type PostgresEmployeeRepository
- func (r *PostgresEmployeeRepository) Create(ctx context.Context, employee *models.Employee) error
- func (r *PostgresEmployeeRepository) Delete(ctx context.Context, id uuid.UUID) error
- func (r *PostgresEmployeeRepository) GetByEmployeeID(ctx context.Context, organizationID uuid.UUID, employeeID string) (*models.Employee, error)
- func (r *PostgresEmployeeRepository) GetByID(ctx context.Context, id uuid.UUID) (*models.Employee, error)
- func (r *PostgresEmployeeRepository) GetByUserID(ctx context.Context, organizationID, userID uuid.UUID) (*models.Employee, error)
- func (r *PostgresEmployeeRepository) GetDB() *sqlx.DB
- func (r *PostgresEmployeeRepository) List(ctx context.Context, params models.EmployeeListParams) ([]models.Employee, int, error)
- func (r *PostgresEmployeeRepository) Update(ctx context.Context, employee *models.Employee) error
- type PostgresFileAttachmentRepository
- func (r *PostgresFileAttachmentRepository) Create(ctx context.Context, fileAttachment *models.FileAttachment) error
- func (r *PostgresFileAttachmentRepository) Delete(ctx context.Context, id uuid.UUID) error
- func (r *PostgresFileAttachmentRepository) GetByID(ctx context.Context, id uuid.UUID) (*models.FileAttachment, error)
- func (r *PostgresFileAttachmentRepository) List(ctx context.Context, params models.FileAttachmentListParams) ([]models.FileAttachment, int, error)
- type PostgresNotificationRepository
- func (r *PostgresNotificationRepository) Create(ctx context.Context, notification *models.Notification) error
- func (r *PostgresNotificationRepository) Delete(ctx context.Context, id uuid.UUID) error
- func (r *PostgresNotificationRepository) DeleteAllForUser(ctx context.Context, userID uuid.UUID) error
- func (r *PostgresNotificationRepository) GetByID(ctx context.Context, id uuid.UUID) (*models.Notification, error)
- func (r *PostgresNotificationRepository) List(ctx context.Context, params models.NotificationListParams) ([]models.Notification, int, error)
- func (r *PostgresNotificationRepository) MarkAllAsRead(ctx context.Context, userID uuid.UUID) error
- func (r *PostgresNotificationRepository) MarkAsRead(ctx context.Context, id uuid.UUID) error
- type PostgresOrganizationRepository
- func (r *PostgresOrganizationRepository) AddUser(ctx context.Context, organizationUser *models.OrganizationUser) error
- func (r *PostgresOrganizationRepository) Create(ctx context.Context, organization *models.Organization) error
- func (r *PostgresOrganizationRepository) Delete(ctx context.Context, id uuid.UUID) error
- func (r *PostgresOrganizationRepository) GetByID(ctx context.Context, id uuid.UUID) (*models.Organization, error)
- func (r *PostgresOrganizationRepository) GetByName(ctx context.Context, name string) (*models.Organization, error)
- func (r *PostgresOrganizationRepository) GetDB() *sqlx.DB
- func (r *PostgresOrganizationRepository) GetOrganizations(ctx context.Context, userID uuid.UUID) ([]models.Organization, error)
- func (r *PostgresOrganizationRepository) GetUsers(ctx context.Context, organizationID uuid.UUID) ([]models.User, error)
- func (r *PostgresOrganizationRepository) List(ctx context.Context) ([]models.Organization, error)
- func (r *PostgresOrganizationRepository) RemoveUser(ctx context.Context, organizationID, userID uuid.UUID) error
- func (r *PostgresOrganizationRepository) Update(ctx context.Context, organization *models.Organization) error
- type PostgresProjectRepository
- func (r *PostgresProjectRepository) Create(ctx context.Context, project *models.Project) error
- func (r *PostgresProjectRepository) Delete(ctx context.Context, id uuid.UUID) error
- func (r *PostgresProjectRepository) GetByID(ctx context.Context, id uuid.UUID) (*models.Project, error)
- func (r *PostgresProjectRepository) GetByName(ctx context.Context, organizationID uuid.UUID, name string) (*models.Project, error)
- func (r *PostgresProjectRepository) List(ctx context.Context, params models.ProjectListParams) ([]models.Project, int, error)
- func (r *PostgresProjectRepository) Update(ctx context.Context, project *models.Project) error
- type PostgresRoleRepository
- func (r *PostgresRoleRepository) AssignPermissionToRole(ctx context.Context, roleID, permissionID uuid.UUID) error
- func (r *PostgresRoleRepository) AssignRoleToUser(ctx context.Context, userRole *models.UserRole) error
- func (r *PostgresRoleRepository) CreatePermission(ctx context.Context, permission *models.Permission) error
- func (r *PostgresRoleRepository) CreateRole(ctx context.Context, role *models.Role) error
- func (r *PostgresRoleRepository) DeletePermission(ctx context.Context, id uuid.UUID) error
- func (r *PostgresRoleRepository) DeleteRole(ctx context.Context, id uuid.UUID) error
- func (r *PostgresRoleRepository) GetPermissionByID(ctx context.Context, id uuid.UUID) (*models.Permission, error)
- func (r *PostgresRoleRepository) GetPermissionByName(ctx context.Context, name string) (*models.Permission, error)
- func (r *PostgresRoleRepository) GetRoleByID(ctx context.Context, id uuid.UUID) (*models.Role, error)
- func (r *PostgresRoleRepository) GetRoleByName(ctx context.Context, name string) (*models.Role, error)
- func (r *PostgresRoleRepository) GetRolePermissions(ctx context.Context, roleID uuid.UUID) ([]models.Permission, error)
- func (r *PostgresRoleRepository) GetUserRoles(ctx context.Context, userID, organizationID uuid.UUID) ([]models.Role, error)
- func (r *PostgresRoleRepository) HasPermission(ctx context.Context, userID, organizationID uuid.UUID, permissionName string) (bool, error)
- func (r *PostgresRoleRepository) ListPermissions(ctx context.Context) ([]models.Permission, error)
- func (r *PostgresRoleRepository) ListRoles(ctx context.Context) ([]models.Role, error)
- func (r *PostgresRoleRepository) RemovePermissionFromRole(ctx context.Context, roleID, permissionID uuid.UUID) error
- func (r *PostgresRoleRepository) RemoveRoleFromUser(ctx context.Context, userID, roleID, organizationID uuid.UUID) error
- func (r *PostgresRoleRepository) UpdatePermission(ctx context.Context, permission *models.Permission) error
- func (r *PostgresRoleRepository) UpdateRole(ctx context.Context, role *models.Role) error
- type PostgresTaskRepository
- func (r *PostgresTaskRepository) AddTag(ctx context.Context, taskID uuid.UUID, tag string) error
- func (r *PostgresTaskRepository) Create(ctx context.Context, task *models.Task) error
- func (r *PostgresTaskRepository) Delete(ctx context.Context, id uuid.UUID) error
- func (r *PostgresTaskRepository) GetByID(ctx context.Context, id uuid.UUID) (*models.Task, error)
- func (r *PostgresTaskRepository) GetTags(ctx context.Context, taskID uuid.UUID) ([]string, error)
- func (r *PostgresTaskRepository) List(ctx context.Context, params models.TaskListParams) ([]models.Task, int, error)
- func (r *PostgresTaskRepository) RemoveTag(ctx context.Context, taskID uuid.UUID, tag string) error
- func (r *PostgresTaskRepository) Update(ctx context.Context, task *models.Task) error
- type PostgresTimeEntryRepository
- func (r *PostgresTimeEntryRepository) Aggregate(ctx context.Context, params models.TimeEntryAggregationParams) ([]models.TimeEntryAggregation, error)
- func (r *PostgresTimeEntryRepository) Create(ctx context.Context, timeEntry *models.TimeEntry) error
- func (r *PostgresTimeEntryRepository) Delete(ctx context.Context, id uuid.UUID) error
- func (r *PostgresTimeEntryRepository) GetByID(ctx context.Context, id uuid.UUID) (*models.TimeEntry, error)
- func (r *PostgresTimeEntryRepository) GetRunningTimeEntries(ctx context.Context, userID uuid.UUID) ([]models.TimeEntry, error)
- func (r *PostgresTimeEntryRepository) GetRunningTimeEntry(ctx context.Context, userID, taskID uuid.UUID) (*models.TimeEntry, error)
- func (r *PostgresTimeEntryRepository) List(ctx context.Context, params models.TimeEntryListParams) ([]models.TimeEntry, int, error)
- func (r *PostgresTimeEntryRepository) Update(ctx context.Context, timeEntry *models.TimeEntry) error
- type PostgresUserRepository
- func (r *PostgresUserRepository) Create(ctx context.Context, user *models.User) error
- func (r *PostgresUserRepository) Delete(ctx context.Context, id uuid.UUID) error
- func (r *PostgresUserRepository) GetByEmail(ctx context.Context, email string) (*models.User, error)
- func (r *PostgresUserRepository) GetByID(ctx context.Context, id uuid.UUID) (*models.User, error)
- func (r *PostgresUserRepository) GetDB() *sqlx.DB
- func (r *PostgresUserRepository) Update(ctx context.Context, user *models.User) error
- type ProjectRepository
- type RoleRepository
- type TaskRepository
- type TimeEntryRepository
- type UserRepository
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmployeeNotFound = errors.New("employee not found") ErrEmployeeIDExists = errors.New("employee ID already exists") ErrUserAlreadyEmployee = errors.New("user is already an employee in this organization") ErrManagerNotFound = errors.New("manager not found") )
Common errors for employee repository
var ( ErrOrganizationNotFound = errors.New("organization not found") ErrOrganizationNameExists = errors.New("organization name already exists") )
Common errors for organization repository
var ( ErrProjectNotFound = errors.New("project not found") ErrProjectNameExists = errors.New("project name already exists in this organization") )
Common errors for project repository
var ( ErrRoleNotFound = errors.New("role not found") ErrPermissionNotFound = errors.New("permission not found") ErrRoleNameExists = errors.New("role name already exists") ErrPermissionNameExists = errors.New("permission name already exists") )
Common errors
var ( ErrTimeEntryNotFound = errors.New("time entry not found") ErrRunningTimeEntry = errors.New("user already has a running time entry for this task") )
Common errors for time entry repository
var ( ErrUserNotFound = errors.New("user not found") ErrEmailAlreadyExists = errors.New("email already exists") ErrDatabaseError = errors.New("database error") )
Common errors
var (
ErrCommentNotFound = errors.New("comment not found")
)
Common errors for comment repository
var (
ErrFileAttachmentNotFound = errors.New("file attachment not found")
)
Common errors for file attachment repository
var (
ErrNotificationNotFound = errors.New("notification not found")
)
Common errors for notification repository
var (
ErrTaskNotFound = errors.New("task not found")
)
Common errors for task repository
Functions ¶
This section is empty.
Types ¶
type CommentRepository ¶
type CommentRepository interface {
// Create creates a new comment
Create(ctx context.Context, comment *models.Comment) error
// GetByID retrieves a comment by ID
GetByID(ctx context.Context, id uuid.UUID) (*models.Comment, error)
// List retrieves comments based on filter parameters
List(ctx context.Context, params models.CommentListParams) ([]models.Comment, int, error)
// Update updates a comment
Update(ctx context.Context, comment *models.Comment) error
// Delete deletes a comment
Delete(ctx context.Context, id uuid.UUID) error
// AddMention adds a mention to a comment
AddMention(ctx context.Context, commentID, userID uuid.UUID) error
// GetMentions retrieves all mentions for a comment
GetMentions(ctx context.Context, commentID uuid.UUID) ([]uuid.UUID, error)
}
CommentRepository defines the interface for comment data access
func NewPostgresCommentRepository ¶
func NewPostgresCommentRepository(db *sqlx.DB) CommentRepository
NewPostgresCommentRepository creates a new PostgresCommentRepository
type EmployeeRepository ¶
type EmployeeRepository interface {
// Create creates a new employee
Create(ctx context.Context, employee *models.Employee) error
// GetByID retrieves an employee by ID
GetByID(ctx context.Context, id uuid.UUID) (*models.Employee, error)
// GetByEmployeeID retrieves an employee by employee ID
GetByEmployeeID(ctx context.Context, organizationID uuid.UUID, employeeID string) (*models.Employee, error)
// GetByUserID retrieves an employee by user ID
GetByUserID(ctx context.Context, organizationID, userID uuid.UUID) (*models.Employee, error)
// List retrieves employees based on filter parameters
List(ctx context.Context, params models.EmployeeListParams) ([]models.Employee, int, error)
// Update updates an employee
Update(ctx context.Context, employee *models.Employee) error
// Delete marks an employee as inactive
Delete(ctx context.Context, id uuid.UUID) error
// GetDB returns the database connection
GetDB() *sqlx.DB
}
EmployeeRepository defines the interface for employee data access
func NewPostgresEmployeeRepository ¶
func NewPostgresEmployeeRepository(db *sqlx.DB) EmployeeRepository
NewPostgresEmployeeRepository creates a new PostgresEmployeeRepository
type FileAttachmentRepository ¶
type FileAttachmentRepository interface {
// Create creates a new file attachment
Create(ctx context.Context, fileAttachment *models.FileAttachment) error
// GetByID retrieves a file attachment by ID
GetByID(ctx context.Context, id uuid.UUID) (*models.FileAttachment, error)
// List retrieves file attachments based on filter parameters
List(ctx context.Context, params models.FileAttachmentListParams) ([]models.FileAttachment, int, error)
// Delete deletes a file attachment
Delete(ctx context.Context, id uuid.UUID) error
}
FileAttachmentRepository defines the interface for file attachment data access
func NewPostgresFileAttachmentRepository ¶
func NewPostgresFileAttachmentRepository(db *sqlx.DB) FileAttachmentRepository
NewPostgresFileAttachmentRepository creates a new PostgresFileAttachmentRepository
type NotificationRepository ¶
type NotificationRepository interface {
// Create creates a new notification
Create(ctx context.Context, notification *models.Notification) error
// GetByID retrieves a notification by ID
GetByID(ctx context.Context, id uuid.UUID) (*models.Notification, error)
// List retrieves notifications based on filter parameters
List(ctx context.Context, params models.NotificationListParams) ([]models.Notification, int, error)
// MarkAsRead marks a notification as read
MarkAsRead(ctx context.Context, id uuid.UUID) error
// MarkAllAsRead marks all notifications for a user as read
MarkAllAsRead(ctx context.Context, userID uuid.UUID) error
// Delete deletes a notification
Delete(ctx context.Context, id uuid.UUID) error
// DeleteAllForUser deletes all notifications for a user
DeleteAllForUser(ctx context.Context, userID uuid.UUID) error
}
NotificationRepository defines the interface for notification data access
func NewPostgresNotificationRepository ¶
func NewPostgresNotificationRepository(db *sqlx.DB) NotificationRepository
NewPostgresNotificationRepository creates a new PostgresNotificationRepository
type OrganizationRepository ¶
type OrganizationRepository interface {
// Create creates a new organization
Create(ctx context.Context, organization *models.Organization) error
// GetByID retrieves an organization by ID
GetByID(ctx context.Context, id uuid.UUID) (*models.Organization, error)
// GetByName retrieves an organization by name
GetByName(ctx context.Context, name string) (*models.Organization, error)
// List retrieves all organizations
List(ctx context.Context) ([]models.Organization, error)
// Update updates an organization
Update(ctx context.Context, organization *models.Organization) error
// Delete marks an organization as inactive
Delete(ctx context.Context, id uuid.UUID) error
// AddUser adds a user to an organization
AddUser(ctx context.Context, organizationUser *models.OrganizationUser) error
// RemoveUser removes a user from an organization
RemoveUser(ctx context.Context, organizationID, userID uuid.UUID) error
// GetUsers retrieves all users in an organization
GetUsers(ctx context.Context, organizationID uuid.UUID) ([]models.User, error)
// GetOrganizations retrieves all organizations a user belongs to
GetOrganizations(ctx context.Context, userID uuid.UUID) ([]models.Organization, error)
// GetDB returns the database connection
GetDB() *sqlx.DB
}
OrganizationRepository defines the interface for organization data access
func NewPostgresOrganizationRepository ¶
func NewPostgresOrganizationRepository(db *sqlx.DB) OrganizationRepository
NewPostgresOrganizationRepository creates a new PostgresOrganizationRepository
type PostgresCommentRepository ¶
type PostgresCommentRepository struct {
// contains filtered or unexported fields
}
PostgresCommentRepository implements CommentRepository using PostgreSQL
func (*PostgresCommentRepository) AddMention ¶
func (r *PostgresCommentRepository) AddMention(ctx context.Context, commentID, userID uuid.UUID) error
AddMention adds a mention to a comment
func (*PostgresCommentRepository) GetByID ¶
func (r *PostgresCommentRepository) GetByID(ctx context.Context, id uuid.UUID) (*models.Comment, error)
GetByID retrieves a comment by ID
func (*PostgresCommentRepository) GetMentions ¶
func (r *PostgresCommentRepository) GetMentions(ctx context.Context, commentID uuid.UUID) ([]uuid.UUID, error)
GetMentions retrieves all mentions for a comment
type PostgresEmployeeRepository ¶
type PostgresEmployeeRepository struct {
// contains filtered or unexported fields
}
PostgresEmployeeRepository implements EmployeeRepository using PostgreSQL
func (*PostgresEmployeeRepository) GetByEmployeeID ¶
func (r *PostgresEmployeeRepository) GetByEmployeeID(ctx context.Context, organizationID uuid.UUID, employeeID string) (*models.Employee, error)
GetByEmployeeID retrieves an employee by employee ID
func (*PostgresEmployeeRepository) GetByID ¶
func (r *PostgresEmployeeRepository) GetByID(ctx context.Context, id uuid.UUID) (*models.Employee, error)
GetByID retrieves an employee by ID
func (*PostgresEmployeeRepository) GetByUserID ¶
func (r *PostgresEmployeeRepository) GetByUserID(ctx context.Context, organizationID, userID uuid.UUID) (*models.Employee, error)
GetByUserID retrieves an employee by user ID
func (*PostgresEmployeeRepository) GetDB ¶
func (r *PostgresEmployeeRepository) GetDB() *sqlx.DB
GetDB returns the database connection
type PostgresFileAttachmentRepository ¶
type PostgresFileAttachmentRepository struct {
// contains filtered or unexported fields
}
PostgresFileAttachmentRepository implements FileAttachmentRepository using PostgreSQL
func (*PostgresFileAttachmentRepository) Create ¶
func (r *PostgresFileAttachmentRepository) Create(ctx context.Context, fileAttachment *models.FileAttachment) error
Create creates a new file attachment
func (*PostgresFileAttachmentRepository) GetByID ¶
func (r *PostgresFileAttachmentRepository) GetByID(ctx context.Context, id uuid.UUID) (*models.FileAttachment, error)
GetByID retrieves a file attachment by ID
func (*PostgresFileAttachmentRepository) List ¶
func (r *PostgresFileAttachmentRepository) List(ctx context.Context, params models.FileAttachmentListParams) ([]models.FileAttachment, int, error)
List retrieves file attachments based on filter parameters
type PostgresNotificationRepository ¶
type PostgresNotificationRepository struct {
// contains filtered or unexported fields
}
PostgresNotificationRepository implements NotificationRepository using PostgreSQL
func (*PostgresNotificationRepository) Create ¶
func (r *PostgresNotificationRepository) Create(ctx context.Context, notification *models.Notification) error
Create creates a new notification
func (*PostgresNotificationRepository) DeleteAllForUser ¶
func (r *PostgresNotificationRepository) DeleteAllForUser(ctx context.Context, userID uuid.UUID) error
DeleteAllForUser deletes all notifications for a user
func (*PostgresNotificationRepository) GetByID ¶
func (r *PostgresNotificationRepository) GetByID(ctx context.Context, id uuid.UUID) (*models.Notification, error)
GetByID retrieves a notification by ID
func (*PostgresNotificationRepository) List ¶
func (r *PostgresNotificationRepository) List(ctx context.Context, params models.NotificationListParams) ([]models.Notification, int, error)
List retrieves notifications based on filter parameters
func (*PostgresNotificationRepository) MarkAllAsRead ¶
MarkAllAsRead marks all notifications for a user as read
func (*PostgresNotificationRepository) MarkAsRead ¶
MarkAsRead marks a notification as read
type PostgresOrganizationRepository ¶
type PostgresOrganizationRepository struct {
// contains filtered or unexported fields
}
PostgresOrganizationRepository implements OrganizationRepository using PostgreSQL
func (*PostgresOrganizationRepository) AddUser ¶
func (r *PostgresOrganizationRepository) AddUser(ctx context.Context, organizationUser *models.OrganizationUser) error
AddUser adds a user to an organization
func (*PostgresOrganizationRepository) Create ¶
func (r *PostgresOrganizationRepository) Create(ctx context.Context, organization *models.Organization) error
Create creates a new organization
func (*PostgresOrganizationRepository) GetByID ¶
func (r *PostgresOrganizationRepository) GetByID(ctx context.Context, id uuid.UUID) (*models.Organization, error)
GetByID retrieves an organization by ID
func (*PostgresOrganizationRepository) GetByName ¶
func (r *PostgresOrganizationRepository) GetByName(ctx context.Context, name string) (*models.Organization, error)
GetByName retrieves an organization by name
func (*PostgresOrganizationRepository) GetDB ¶
func (r *PostgresOrganizationRepository) GetDB() *sqlx.DB
GetDB returns the database connection
func (*PostgresOrganizationRepository) GetOrganizations ¶
func (r *PostgresOrganizationRepository) GetOrganizations(ctx context.Context, userID uuid.UUID) ([]models.Organization, error)
GetOrganizations retrieves all organizations a user belongs to
func (*PostgresOrganizationRepository) GetUsers ¶
func (r *PostgresOrganizationRepository) GetUsers(ctx context.Context, organizationID uuid.UUID) ([]models.User, error)
GetUsers retrieves all users in an organization
func (*PostgresOrganizationRepository) List ¶
func (r *PostgresOrganizationRepository) List(ctx context.Context) ([]models.Organization, error)
List retrieves all organizations
func (*PostgresOrganizationRepository) RemoveUser ¶
func (r *PostgresOrganizationRepository) RemoveUser(ctx context.Context, organizationID, userID uuid.UUID) error
RemoveUser removes a user from an organization
func (*PostgresOrganizationRepository) Update ¶
func (r *PostgresOrganizationRepository) Update(ctx context.Context, organization *models.Organization) error
Update updates an organization
type PostgresProjectRepository ¶
type PostgresProjectRepository struct {
// contains filtered or unexported fields
}
PostgresProjectRepository implements ProjectRepository using PostgreSQL
func (*PostgresProjectRepository) GetByID ¶
func (r *PostgresProjectRepository) GetByID(ctx context.Context, id uuid.UUID) (*models.Project, error)
GetByID retrieves a project by ID
func (*PostgresProjectRepository) GetByName ¶
func (r *PostgresProjectRepository) GetByName(ctx context.Context, organizationID uuid.UUID, name string) (*models.Project, error)
GetByName retrieves a project by name within an organization
type PostgresRoleRepository ¶
type PostgresRoleRepository struct {
// contains filtered or unexported fields
}
PostgresRoleRepository implements RoleRepository using PostgreSQL
func (*PostgresRoleRepository) AssignPermissionToRole ¶
func (r *PostgresRoleRepository) AssignPermissionToRole(ctx context.Context, roleID, permissionID uuid.UUID) error
AssignPermissionToRole assigns a permission to a role
func (*PostgresRoleRepository) AssignRoleToUser ¶
func (r *PostgresRoleRepository) AssignRoleToUser(ctx context.Context, userRole *models.UserRole) error
AssignRoleToUser assigns a role to a user
func (*PostgresRoleRepository) CreatePermission ¶
func (r *PostgresRoleRepository) CreatePermission(ctx context.Context, permission *models.Permission) error
CreatePermission creates a new permission
func (*PostgresRoleRepository) CreateRole ¶
CreateRole creates a new role
func (*PostgresRoleRepository) DeletePermission ¶
DeletePermission deletes a permission
func (*PostgresRoleRepository) DeleteRole ¶
DeleteRole deletes a role
func (*PostgresRoleRepository) GetPermissionByID ¶
func (r *PostgresRoleRepository) GetPermissionByID(ctx context.Context, id uuid.UUID) (*models.Permission, error)
GetPermissionByID retrieves a permission by ID
func (*PostgresRoleRepository) GetPermissionByName ¶
func (r *PostgresRoleRepository) GetPermissionByName(ctx context.Context, name string) (*models.Permission, error)
GetPermissionByName retrieves a permission by name
func (*PostgresRoleRepository) GetRoleByID ¶
func (r *PostgresRoleRepository) GetRoleByID(ctx context.Context, id uuid.UUID) (*models.Role, error)
GetRoleByID retrieves a role by ID
func (*PostgresRoleRepository) GetRoleByName ¶
func (r *PostgresRoleRepository) GetRoleByName(ctx context.Context, name string) (*models.Role, error)
GetRoleByName retrieves a role by name
func (*PostgresRoleRepository) GetRolePermissions ¶
func (r *PostgresRoleRepository) GetRolePermissions(ctx context.Context, roleID uuid.UUID) ([]models.Permission, error)
GetRolePermissions retrieves all permissions for a role
func (*PostgresRoleRepository) GetUserRoles ¶
func (r *PostgresRoleRepository) GetUserRoles(ctx context.Context, userID, organizationID uuid.UUID) ([]models.Role, error)
GetUserRoles retrieves all roles for a user
func (*PostgresRoleRepository) HasPermission ¶
func (r *PostgresRoleRepository) HasPermission(ctx context.Context, userID, organizationID uuid.UUID, permissionName string) (bool, error)
HasPermission checks if a user has a specific permission
func (*PostgresRoleRepository) ListPermissions ¶
func (r *PostgresRoleRepository) ListPermissions(ctx context.Context) ([]models.Permission, error)
ListPermissions retrieves all permissions
func (*PostgresRoleRepository) RemovePermissionFromRole ¶
func (r *PostgresRoleRepository) RemovePermissionFromRole(ctx context.Context, roleID, permissionID uuid.UUID) error
RemovePermissionFromRole removes a permission from a role
func (*PostgresRoleRepository) RemoveRoleFromUser ¶
func (r *PostgresRoleRepository) RemoveRoleFromUser(ctx context.Context, userID, roleID, organizationID uuid.UUID) error
RemoveRoleFromUser removes a role from a user
func (*PostgresRoleRepository) UpdatePermission ¶
func (r *PostgresRoleRepository) UpdatePermission(ctx context.Context, permission *models.Permission) error
UpdatePermission updates a permission
func (*PostgresRoleRepository) UpdateRole ¶
UpdateRole updates a role
type PostgresTaskRepository ¶
type PostgresTaskRepository struct {
// contains filtered or unexported fields
}
PostgresTaskRepository implements TaskRepository using PostgreSQL
func (*PostgresTaskRepository) List ¶
func (r *PostgresTaskRepository) List(ctx context.Context, params models.TaskListParams) ([]models.Task, int, error)
List retrieves tasks based on filter parameters
type PostgresTimeEntryRepository ¶
type PostgresTimeEntryRepository struct {
// contains filtered or unexported fields
}
PostgresTimeEntryRepository implements TimeEntryRepository using PostgreSQL
func (*PostgresTimeEntryRepository) Aggregate ¶
func (r *PostgresTimeEntryRepository) Aggregate(ctx context.Context, params models.TimeEntryAggregationParams) ([]models.TimeEntryAggregation, error)
Aggregate aggregates time entries based on parameters
func (*PostgresTimeEntryRepository) Create ¶
func (r *PostgresTimeEntryRepository) Create(ctx context.Context, timeEntry *models.TimeEntry) error
Create creates a new time entry
func (*PostgresTimeEntryRepository) GetByID ¶
func (r *PostgresTimeEntryRepository) GetByID(ctx context.Context, id uuid.UUID) (*models.TimeEntry, error)
GetByID retrieves a time entry by ID
func (*PostgresTimeEntryRepository) GetRunningTimeEntries ¶
func (r *PostgresTimeEntryRepository) GetRunningTimeEntries(ctx context.Context, userID uuid.UUID) ([]models.TimeEntry, error)
GetRunningTimeEntries retrieves all running time entries for a user
func (*PostgresTimeEntryRepository) GetRunningTimeEntry ¶
func (r *PostgresTimeEntryRepository) GetRunningTimeEntry(ctx context.Context, userID, taskID uuid.UUID) (*models.TimeEntry, error)
GetRunningTimeEntry retrieves a running time entry for a user and task
type PostgresUserRepository ¶
type PostgresUserRepository struct {
// contains filtered or unexported fields
}
PostgresUserRepository implements UserRepository using PostgreSQL
func (*PostgresUserRepository) GetByEmail ¶
func (r *PostgresUserRepository) GetByEmail(ctx context.Context, email string) (*models.User, error)
GetByEmail retrieves a user by email
func (*PostgresUserRepository) GetDB ¶
func (r *PostgresUserRepository) GetDB() *sqlx.DB
GetDB returns the database connection
type ProjectRepository ¶
type ProjectRepository interface {
// Create creates a new project
Create(ctx context.Context, project *models.Project) error
// GetByID retrieves a project by ID
GetByID(ctx context.Context, id uuid.UUID) (*models.Project, error)
// GetByName retrieves a project by name within an organization
GetByName(ctx context.Context, organizationID uuid.UUID, name string) (*models.Project, error)
// List retrieves projects based on filter parameters
List(ctx context.Context, params models.ProjectListParams) ([]models.Project, int, error)
// Update updates a project
Update(ctx context.Context, project *models.Project) error
// Delete deletes a project
Delete(ctx context.Context, id uuid.UUID) error
}
ProjectRepository defines the interface for project data access
func NewPostgresProjectRepository ¶
func NewPostgresProjectRepository(db *sqlx.DB) ProjectRepository
NewPostgresProjectRepository creates a new PostgresProjectRepository
type RoleRepository ¶
type RoleRepository interface {
// CreateRole creates a new role
CreateRole(ctx context.Context, role *models.Role) error
// GetRoleByID retrieves a role by ID
GetRoleByID(ctx context.Context, id uuid.UUID) (*models.Role, error)
// GetRoleByName retrieves a role by name
GetRoleByName(ctx context.Context, name string) (*models.Role, error)
// ListRoles retrieves all roles
ListRoles(ctx context.Context) ([]models.Role, error)
// UpdateRole updates a role
UpdateRole(ctx context.Context, role *models.Role) error
// DeleteRole deletes a role
DeleteRole(ctx context.Context, id uuid.UUID) error
// CreatePermission creates a new permission
CreatePermission(ctx context.Context, permission *models.Permission) error
// GetPermissionByID retrieves a permission by ID
GetPermissionByID(ctx context.Context, id uuid.UUID) (*models.Permission, error)
// GetPermissionByName retrieves a permission by name
GetPermissionByName(ctx context.Context, name string) (*models.Permission, error)
// ListPermissions retrieves all permissions
ListPermissions(ctx context.Context) ([]models.Permission, error)
// UpdatePermission updates a permission
UpdatePermission(ctx context.Context, permission *models.Permission) error
// DeletePermission deletes a permission
DeletePermission(ctx context.Context, id uuid.UUID) error
// AssignPermissionToRole assigns a permission to a role
AssignPermissionToRole(ctx context.Context, roleID, permissionID uuid.UUID) error
// RemovePermissionFromRole removes a permission from a role
RemovePermissionFromRole(ctx context.Context, roleID, permissionID uuid.UUID) error
// GetRolePermissions retrieves all permissions for a role
GetRolePermissions(ctx context.Context, roleID uuid.UUID) ([]models.Permission, error)
// AssignRoleToUser assigns a role to a user
AssignRoleToUser(ctx context.Context, userRole *models.UserRole) error
// RemoveRoleFromUser removes a role from a user
RemoveRoleFromUser(ctx context.Context, userID, roleID, organizationID uuid.UUID) error
// GetUserRoles retrieves all roles for a user
GetUserRoles(ctx context.Context, userID, organizationID uuid.UUID) ([]models.Role, error)
// HasPermission checks if a user has a specific permission
HasPermission(ctx context.Context, userID, organizationID uuid.UUID, permissionName string) (bool, error)
}
RoleRepository defines the interface for role data access
func NewPostgresRoleRepository ¶
func NewPostgresRoleRepository(db *sqlx.DB) RoleRepository
NewPostgresRoleRepository creates a new PostgresRoleRepository
type TaskRepository ¶
type TaskRepository interface {
// Create creates a new task
Create(ctx context.Context, task *models.Task) error
// GetByID retrieves a task by ID
GetByID(ctx context.Context, id uuid.UUID) (*models.Task, error)
// List retrieves tasks based on filter parameters
List(ctx context.Context, params models.TaskListParams) ([]models.Task, int, error)
// Update updates a task
Update(ctx context.Context, task *models.Task) error
// Delete deletes a task
Delete(ctx context.Context, id uuid.UUID) error
// AddTag adds a tag to a task
AddTag(ctx context.Context, taskID uuid.UUID, tag string) error
// RemoveTag removes a tag from a task
RemoveTag(ctx context.Context, taskID uuid.UUID, tag string) error
// GetTags retrieves all tags for a task
GetTags(ctx context.Context, taskID uuid.UUID) ([]string, error)
}
TaskRepository defines the interface for task data access
func NewPostgresTaskRepository ¶
func NewPostgresTaskRepository(db *sqlx.DB) TaskRepository
NewPostgresTaskRepository creates a new PostgresTaskRepository
type TimeEntryRepository ¶
type TimeEntryRepository interface {
// Create creates a new time entry
Create(ctx context.Context, timeEntry *models.TimeEntry) error
// GetByID retrieves a time entry by ID
GetByID(ctx context.Context, id uuid.UUID) (*models.TimeEntry, error)
// List retrieves time entries based on filter parameters
List(ctx context.Context, params models.TimeEntryListParams) ([]models.TimeEntry, int, error)
// Update updates a time entry
Update(ctx context.Context, timeEntry *models.TimeEntry) error
// Delete deletes a time entry
Delete(ctx context.Context, id uuid.UUID) error
// GetRunningTimeEntry retrieves a running time entry for a user and task
GetRunningTimeEntry(ctx context.Context, userID, taskID uuid.UUID) (*models.TimeEntry, error)
// GetRunningTimeEntries retrieves all running time entries for a user
GetRunningTimeEntries(ctx context.Context, userID uuid.UUID) ([]models.TimeEntry, error)
// Aggregate aggregates time entries based on parameters
Aggregate(ctx context.Context, params models.TimeEntryAggregationParams) ([]models.TimeEntryAggregation, error)
}
TimeEntryRepository defines the interface for time entry data access
func NewPostgresTimeEntryRepository ¶
func NewPostgresTimeEntryRepository(db *sqlx.DB) TimeEntryRepository
NewPostgresTimeEntryRepository creates a new PostgresTimeEntryRepository
type UserRepository ¶
type UserRepository interface {
// Create creates a new user
Create(ctx context.Context, user *models.User) error
// GetByID retrieves a user by ID
GetByID(ctx context.Context, id uuid.UUID) (*models.User, error)
// GetByEmail retrieves a user by email
GetByEmail(ctx context.Context, email string) (*models.User, error)
// Update updates a user
Update(ctx context.Context, user *models.User) error
// Delete marks a user as inactive
Delete(ctx context.Context, id uuid.UUID) error
// GetDB returns the database connection
GetDB() *sqlx.DB
}
UserRepository defines the interface for user data access
func NewPostgresUserRepository ¶
func NewPostgresUserRepository(db *sqlx.DB) UserRepository
NewPostgresUserRepository creates a new PostgresUserRepository