aboutsummaryrefslogtreecommitdiff
path: root/services/user.go
diff options
context:
space:
mode:
authorBobby <[email protected]>2026-03-08 03:06:23 +0530
committerBobby <[email protected]>2026-03-08 03:06:23 +0530
commitcaf265e7050edefa64ecf7e13828ec9636bce867 (patch)
tree6bb8554dbb34695a74c2dca556bf512998cf62ab /services/user.go
parentcca905d35412f1549400fc3d1aca6dc704d8cae6 (diff)
downloaddove-caf265e7050edefa64ecf7e13828ec9636bce867.tar.xz
dove-caf265e7050edefa64ecf7e13828ec9636bce867.zip
Refactor configuration handling and add mail management features
- Removed dependency on messages package in TOML loading and parsing. - Introduced new config constants and messages for better clarity and maintainability. - Implemented mail user and mailbox management with corresponding controllers and views. - Added new templates for mailboxes, mailbox creation, and user management. - Enhanced logging and error handling throughout the application. - Established a structured approach for applying default values in TOML configuration. - Created new utility functions for SMTP and email handling.
Diffstat (limited to 'services/user.go')
-rw-r--r--services/user.go50
1 files changed, 0 insertions, 50 deletions
diff --git a/services/user.go b/services/user.go
deleted file mode 100644
index b2d43cf..0000000
--- a/services/user.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package services
-
-import (
- "strings"
-
- "dove/enums"
- "dove/messages"
- "dove/models"
- "dove/repositories"
- "dove/types"
- "dove/utils/meta"
- "dove/utils/shortcuts"
-)
-
-func ListUsers(pagination meta.Pagination, sorting meta.Sorting, search string) types.PaginatedResponse {
- users, total := repositories.ListUsers(pagination, sorting, search)
- return pagination.Response(users, total)
-}
-
-func CreateUser(request types.CreateUserRequest) *types.ServiceError {
- username := strings.TrimSpace(request.Username)
- displayName := strings.TrimSpace(request.DisplayName)
-
- if username == "" {
- return shortcuts.ServiceError(enums.BadRequest, messages.UserUsernameRequired)
- }
-
- if displayName == "" {
- return shortcuts.ServiceError(enums.BadRequest, messages.UserDisplayNameRequired)
- }
-
- if repositories.FindUserByUsername(username) != nil {
- return shortcuts.ServiceError(enums.Unprocessable, messages.UserAlreadyExists)
- }
-
- user := &models.User{
- Username: username,
- DisplayName: displayName,
- }
-
- if createError := repositories.CreateUser(user); createError != nil {
- return shortcuts.ServiceError(enums.Internal, messages.UserCreationFailed)
- }
-
- return nil
-}
-
-func AllUsers() []models.User {
- return repositories.AllUsers()
-}