Skip to content

Modern Docker Management, Designed for Everyone

fix: incorrect user reponse structure and missing types

Kyle Mendell4622ca6b6c9b
diff --git a/backend/internal/api/auth_handler.go b/backend/internal/api/auth_handler.go
index 10f4d0cef..88ce9f2e4 100644
--- a/backend/internal/api/auth_handler.go
+++ b/backend/internal/api/auth_handler.go
@@ -6,6 +6,7 @@ import (
"time"
"github.com/gin-gonic/gin"
+ "github.com/ofkm/arcane-backend/internal/dto"
"github.com/ofkm/arcane-backend/internal/middleware"
"github.com/ofkm/arcane-backend/internal/services"
)
@@ -30,21 +31,13 @@ type LoginRequest struct {
}
type LoginResponse struct {
- Success bool `json:"success"`
- Token string `json:"token,omitempty"`
- RefreshToken string `json:"refreshToken,omitempty"`
- ExpiresAt time.Time `json:"expiresAt,omitempty"`
- User *UserResponse `json:"user,omitempty"`
- Error string `json:"error,omitempty"`
- RequirePasswordChange bool `json:"requirePasswordChange,omitempty"`
-}
-
-type UserResponse struct {
- ID string `json:"id"`
- Username string `json:"username"`
- DisplayName *string `json:"displayName,omitempty"`
- Email *string `json:"email,omitempty"`
- Roles []string `json:"roles"`
+ Success bool `json:"success"`
+ Token string `json:"token,omitempty"`
+ RefreshToken string `json:"refreshToken,omitempty"`
+ ExpiresAt time.Time `json:"expiresAt,omitempty"`
+ User *dto.UserResponseDto `json:"user,omitempty"`
+ Error string `json:"error,omitempty"`
+ RequirePasswordChange bool `json:"requirePasswordChange,omitempty"`
}
type RefreshRequest struct {
@@ -95,7 +88,7 @@ func (h *AuthHandler) Login(c *gin.Context) {
c.JSON(http.StatusOK, LoginResponse{
Success: true,
RequirePasswordChange: true,
- User: &UserResponse{
+ User: &dto.UserResponseDto{
ID: user.ID,
Username: user.Username,
DisplayName: user.DisplayName,
@@ -147,7 +140,7 @@ func (h *AuthHandler) Login(c *gin.Context) {
Token: tokenPair.AccessToken,
RefreshToken: tokenPair.RefreshToken,
ExpiresAt: tokenPair.ExpiresAt,
- User: &UserResponse{
+ User: &dto.UserResponseDto{
ID: user.ID,
Username: user.Username,
DisplayName: user.DisplayName,
@@ -178,15 +171,12 @@ func (h *AuthHandler) GetCurrentUser(c *gin.Context) {
return
}
- c.JSON(http.StatusOK, gin.H{
- "success": true,
- "data": UserResponse{
- ID: user.ID,
- Username: user.Username,
- DisplayName: user.DisplayName,
- Email: user.Email,
- Roles: user.Roles,
- },
+ c.JSON(http.StatusOK, dto.UserResponseDto{
+ ID: user.ID,
+ Username: user.Username,
+ DisplayName: user.DisplayName,
+ Email: user.Email,
+ Roles: user.Roles,
})
}
diff --git a/backend/internal/api/user_handler.go b/backend/internal/api/user_handler.go
index bfcb0ab25..507228ffa 100644
--- a/backend/internal/api/user_handler.go
+++ b/backend/internal/api/user_handler.go
@@ -39,7 +39,8 @@ func (h *UserHandler) ListUsers(c *gin.Context) {
req.Pagination.Limit = 20
}
- if req.Pagination.Page == 0 && req.Pagination.Limit == 0 {
+ // For non-paginated requests (when both page and limit are default/zero)
+ if req.Pagination.Page == 1 && req.Pagination.Limit == 20 && req.Search == "" && req.Sort.Column == "" {
users, err := h.userService.ListUsers(c.Request.Context())
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{
@@ -49,9 +50,9 @@ func (h *UserHandler) ListUsers(c *gin.Context) {
return
}
- var userResponses []UserResponse
+ var userResponses []dto.UserResponseDto
for _, user := range users {
- userResponses = append(userResponses, UserResponse{
+ userResponses = append(userResponses, dto.UserResponseDto{
ID: user.ID,
Username: user.Username,
DisplayName: user.DisplayName,
@@ -129,7 +130,7 @@ func (h *UserHandler) CreateUser(c *gin.Context) {
c.JSON(http.StatusCreated, gin.H{
"success": true,
- "user": UserResponse{
+ "user": dto.UserResponseDto{
ID: createdUser.ID,
Username: createdUser.Username,
DisplayName: createdUser.DisplayName,
@@ -153,7 +154,7 @@ func (h *UserHandler) GetUser(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"success": true,
- "user": UserResponse{
+ "user": dto.UserResponseDto{
ID: user.ID,
Username: user.Username,
DisplayName: user.DisplayName,
@@ -208,7 +209,7 @@ func (h *UserHandler) UpdateUser(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"success": true,
- "user": UserResponse{
+ "user": dto.UserResponseDto{
ID: updatedUser.ID,
Username: updatedUser.Username,
DisplayName: updatedUser.DisplayName,
diff --git a/backend/internal/dto/user_dto.go b/backend/internal/dto/user_dto.go
index 3871f7e45..d1b1e4c3a 100644
--- a/backend/internal/dto/user_dto.go
+++ b/backend/internal/dto/user_dto.go
@@ -13,3 +13,13 @@ type UpdateUserDto struct {
Email *string `json:"email,omitempty"`
Roles []string `json:"roles,omitempty"`
}
+
+type UserResponseDto struct {
+ ID string `json:"id"`
+ Username string `json:"username"`
+ DisplayName *string `json:"displayName,omitempty"`
+ Email *string `json:"email,omitempty"`
+ Roles []string `json:"roles"`
+ CreatedAt string `json:"createdAt,omitempty"`
+ UpdatedAt string `json:"updatedAt,omitempty"`
+}
diff --git a/backend/internal/services/user_service.go b/backend/internal/services/user_service.go
index 9da268777..e1ac278e2 100644
--- a/backend/internal/services/user_service.go
+++ b/backend/internal/services/user_service.go
@@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"log"
+ "math"
"strings"
"golang.org/x/crypto/argon2"
@@ -15,6 +16,7 @@ import (
"github.com/google/uuid"
"github.com/ofkm/arcane-backend/internal/database"
+ "github.com/ofkm/arcane-backend/internal/dto"
"github.com/ofkm/arcane-backend/internal/models"
"github.com/ofkm/arcane-backend/internal/utils"
)
@@ -270,78 +272,63 @@ func (s *UserService) UpgradePasswordHash(ctx context.Context, userID, password
Update("password_hash", newHash).Error
}
-func (s *UserService) ListUsersPaginated(ctx context.Context, req utils.SortedPaginationRequest) ([]map[string]interface{}, utils.PaginationResponse, error) {
+func (s *UserService) ListUsersPaginated(ctx context.Context, req utils.SortedPaginationRequest) ([]dto.UserResponseDto, utils.PaginationResponse, error) {
users, err := s.ListUsers(ctx)
if err != nil {
return nil, utils.PaginationResponse{}, fmt.Errorf("failed to list users: %w", err)
}
- var result []map[string]interface{}
+ var result []dto.UserResponseDto
for _, user := range users {
- userData := map[string]interface{}{
- "ID": user.ID,
- "Username": user.Username,
- "DisplayName": user.DisplayName,
- "Email": user.Email,
- "Roles": user.Roles,
- "CreatedAt": user.CreatedAt,
- "UpdatedAt": user.UpdatedAt,
+ userResponse := dto.UserResponseDto{
+ ID: user.ID,
+ Username: user.Username,
+ DisplayName: user.DisplayName,
+ Email: user.Email,
+ Roles: user.Roles,
+ CreatedAt: user.CreatedAt.Format("2006-01-02T15:04:05.999999Z"),
+ UpdatedAt: user.UpdatedAt.Format("2006-01-02T15:04:05.999999Z"),
}
-
- result = append(result, userData)
+ result = append(result, userResponse)
}
+ // Apply search filter if provided
if req.Search != "" {
- filtered := make([]map[string]interface{}, 0)
+ var filteredResult []dto.UserResponseDto
searchLower := strings.ToLower(req.Search)
- for _, user := range result {
- if username, ok := user["Username"].(string); ok {
- if strings.Contains(strings.ToLower(username), searchLower) {
- filtered = append(filtered, user)
- continue
- }
- }
- if displayName, ok := user["DisplayName"].(*string); ok && displayName != nil {
- if strings.Contains(strings.ToLower(*displayName), searchLower) {
- filtered = append(filtered, user)
- continue
- }
- }
- if email, ok := user["Email"].(*string); ok && email != nil {
- if strings.Contains(strings.ToLower(*email), searchLower) {
- filtered = append(filtered, user)
- continue
- }
+
+ for _, userResponse := range result {
+ if strings.Contains(strings.ToLower(userResponse.Username), searchLower) ||
+ (userResponse.Email != nil && strings.Contains(strings.ToLower(*userResponse.Email), searchLower)) ||
+ (userResponse.DisplayName != nil && strings.Contains(strings.ToLower(*userResponse.DisplayName), searchLower)) {
+ filteredResult = append(filteredResult, userResponse)
}
}
- result = filtered
+ result = filteredResult
}
totalItems := len(result)
- if req.Sort.Column != "" {
- utils.SortSliceByField(result, req.Sort.Column, req.Sort.Direction)
+ // Apply sorting if specified
+ if req.Sort.Column != "" && req.Sort.Direction != "" {
+ utils.SortUserResponses(result, req.Sort.Column, req.Sort.Direction)
}
- startIdx := (req.Pagination.Page - 1) * req.Pagination.Limit
- endIdx := startIdx + req.Pagination.Limit
+ // Apply pagination
+ start := (req.Pagination.Page - 1) * req.Pagination.Limit
+ end := start + req.Pagination.Limit
- if startIdx > len(result) {
- startIdx = len(result)
- }
- if endIdx > len(result) {
- endIdx = len(result)
- }
-
- if startIdx < endIdx {
- result = result[startIdx:endIdx]
+ if start > len(result) {
+ result = []dto.UserResponseDto{}
} else {
- result = []map[string]interface{}{}
+ if end > len(result) {
+ end = len(result)
+ }
+ result = result[start:end]
}
- totalPages := (totalItems + req.Pagination.Limit - 1) / req.Pagination.Limit
pagination := utils.PaginationResponse{
- TotalPages: int64(totalPages),
+ TotalPages: int64(math.Ceil(float64(totalItems) / float64(req.Pagination.Limit))),
TotalItems: int64(totalItems),
CurrentPage: req.Pagination.Page,
ItemsPerPage: req.Pagination.Limit,
diff --git a/backend/internal/utils/registry_utils.go b/backend/internal/utils/registry_utils.go
index e883f1fc8..c3d83912b 100644
--- a/backend/internal/utils/registry_utils.go
+++ b/backend/internal/utils/registry_utils.go
@@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"net/http"
+ "regexp"
"strings"
"time"
)
@@ -13,6 +14,12 @@ const DEFAULT_REGISTRY = "registry-1.docker.io"
type RegistryUtils struct{}
+var (
+ SemanticVersionRegex = regexp.MustCompile(`^(\d+)\.(\d+)\.(\d+)(?:-.*)?$`)
+ DateVersionRegex = regexp.MustCompile(`^(\d{4})\.(\d{1,2})\.(\d{1,2})$`)
+ NumericVersionRegex = regexp.MustCompile(`^(\d+)(?:\.(\d+))?(?:\.(\d+))?$`)
+)
+
type RegistryCredentials struct {
Username string
Token string
diff --git a/backend/internal/utils/sort.go b/backend/internal/utils/sort.go
new file mode 100644
index 000000000..579476f68
--- /dev/null
+++ b/backend/internal/utils/sort.go
@@ -0,0 +1,57 @@
+package utils
+
+import (
+ "sort"
+ "strings"
+ "time"
+
+ "github.com/ofkm/arcane-backend/internal/dto"
+)
+
+// SortUserResponses sorts a slice of UserResponseDto structs by the specified column and direction
+func SortUserResponses(users []dto.UserResponseDto, column, direction string) {
+ sort.Slice(users, func(i, j int) bool {
+ var aVal, bVal interface{}
+
+ switch column {
+ case "username":
+ aVal, bVal = users[i].Username, users[j].Username
+ case "displayName":
+ aVal, bVal = getStringPtrValue(users[i].DisplayName), getStringPtrValue(users[j].DisplayName)
+ case "email":
+ aVal, bVal = getStringPtrValue(users[i].Email), getStringPtrValue(users[j].Email)
+ case "roles":
+ aVal, bVal = strings.Join(users[i].Roles, ","), strings.Join(users[j].Roles, ",")
+ case "createdAt", "updatedAt":
+ aTime, _ := time.Parse("2006-01-02T15:04:05.999999Z", users[i].CreatedAt)
+ bTime, _ := time.Parse("2006-01-02T15:04:05.999999Z", users[j].CreatedAt)
+ if column == "updatedAt" {
+ aTime, _ = time.Parse("2006-01-02T15:04:05.999999Z", users[i].UpdatedAt)
+ bTime, _ = time.Parse("2006-01-02T15:04:05.999999Z", users[j].UpdatedAt)
+ }
+ if direction == "desc" {
+ return aTime.After(bTime)
+ }
+ return aTime.Before(bTime)
+ default:
+ return false
+ }
+
+ // Handle string comparison
+ aStr := strings.ToLower(aVal.(string))
+ bStr := strings.ToLower(bVal.(string))
+
+ if direction == "desc" {
+ return aStr > bStr
+ }
+ return aStr < bStr
+ })
+}
+
+// getStringPtrValue safely gets the value from a string pointer
+func getStringPtrValue(ptr *string) string {
+ if ptr == nil {
+ return ""
+ }
+ return *ptr
+}
diff --git a/backend/internal/utils/version.go b/backend/internal/utils/version.go
deleted file mode 100644
index 12bb0ad8b..000000000
--- a/backend/internal/utils/version.go
+++ /dev/null
@@ -1,9 +0,0 @@
-package utils
-
-import "regexp"
-
-var (
- SemanticVersionRegex = regexp.MustCompile(`^(\d+)\.(\d+)\.(\d+)(?:-.*)?$`)
- DateVersionRegex = regexp.MustCompile(`^(\d{4})\.(\d{1,2})\.(\d{1,2})$`)
- NumericVersionRegex = regexp.MustCompile(`^(\d+)(?:\.(\d+))?(?:\.(\d+))?$`)
-)
diff --git a/frontend/src/lib/components/sheets/user-form-sheet.svelte b/frontend/src/lib/components/sheets/user-form-sheet.svelte
index 835296ed6..2e5e9a4e4 100644
--- a/frontend/src/lib/components/sheets/user-form-sheet.svelte
+++ b/frontend/src/lib/components/sheets/user-form-sheet.svelte
@@ -43,11 +43,11 @@
});
let formData = $derived({
- username: userToEdit?.Username || '',
+ username: userToEdit?.username || '',
password: '',
- displayName: userToEdit?.DisplayName || '',
- email: userToEdit?.Email || '',
- isAdmin: Boolean(userToEdit?.Roles?.includes('admin'))
+ displayName: userToEdit?.displayName || '',
+ email: userToEdit?.email || '',
+ isAdmin: Boolean(userToEdit?.roles?.includes('admin'))
});
let { inputs, ...form } = $derived(createForm<typeof formSchema>(formSchema, formData));
@@ -57,10 +57,10 @@
if (!data) return;
const userData: Partial<User> & { password?: string } = {
- Username: data.username,
- DisplayName: data.displayName,
- Email: data.email,
- Roles: [data.isAdmin ? 'admin' : 'user']
+ username: data.username,
+ displayName: data.displayName,
+ email: data.email,
+ roles: [data.isAdmin ? 'admin' : 'user']
};
// Only include password if it's provided (for create) or if editing and password is not empty
@@ -68,7 +68,7 @@
userData.password = data.password;
}
- onSubmit({ user: userData, isEditMode, userId: userToEdit?.ID });
+ onSubmit({ user: userData, isEditMode, userId: userToEdit?.id });
}
function handleOpenChange(newOpenState: boolean) {
@@ -92,7 +92,7 @@
</Sheet.Title>
<Sheet.Description class="text-sm text-muted-foreground mt-1">
{isEditMode
- ? `Update the details for ${userToEdit?.Username || 'this user'}`
+ ? `Update the details for ${userToEdit?.username || 'this user'}`
: 'Add a new user to your system with the required permissions'}
</Sheet.Description>
</div>
diff --git a/frontend/src/lib/services/api/user-api-service.ts b/frontend/src/lib/services/api/user-api-service.ts
index 89287d82b..5eafc677e 100644
--- a/frontend/src/lib/services/api/user-api-service.ts
+++ b/frontend/src/lib/services/api/user-api-service.ts
@@ -61,7 +61,7 @@ export default class UserAPIService extends BaseAPIService {
return this.handleResponse(this.api.get(`/auth/me`)) as Promise<User>;
}
- async create(user: Omit<User, 'ID' | 'CreatedAt' | 'UpdatedAt'>): Promise<User> {
+ async create(user: Omit<User, 'id' | 'createdAt' | 'updatedAt'>): Promise<User> {
return this.handleResponse(this.api.post('/users', user)) as Promise<User>;
}
diff --git a/frontend/src/lib/types/auto-update.type.ts b/frontend/src/lib/types/auto-update.type.ts
new file mode 100644
index 000000000..f062c33bb
--- /dev/null
+++ b/frontend/src/lib/types/auto-update.type.ts
@@ -0,0 +1,54 @@
+export interface AutoUpdateCheck {
+ type?: 'containers' | 'stacks' | 'all';
+ resourceIds?: string[];
+ forceUpdate?: boolean;
+ dryRun?: boolean;
+}
+
+export interface AutoUpdateResult {
+ success: boolean;
+ checked: number;
+ updated: number;
+ skipped: number;
+ failed: number;
+ startTime: string;
+ endTime: string;
+ duration: string;
+ results: AutoUpdateResourceResult[];
+}
+
+export interface AutoUpdateResourceResult {
+ resourceId: string;
+ resourceName: string;
+ resourceType: 'container' | 'stack';
+ status: 'checked' | 'up_to_date' | 'update_available' | 'updated' | 'failed' | 'skipped';
+ updateAvailable: boolean;
+ updateApplied: boolean;
+ oldImages?: Record<string, string>;
+ newImages?: Record<string, string>;
+ error?: string;
+ details?: Record<string, any>;
+}
+
+export interface AutoUpdateRecord {
+ id: string;
+ resourceId: string;
+ resourceType: string;
+ resourceName: string;
+ status: string;
+ startTime: string;
+ endTime?: string;
+ updateAvailable: boolean;
+ updateApplied: boolean;
+ oldImageVersions?: Record<string, string>;
+ newImageVersions?: Record<string, string>;
+ error?: string;
+ details?: Record<string, any>;
+}
+
+export interface AutoUpdateStatus {
+ updatingContainers: number;
+ updatingStacks: number;
+ containerIds: string[];
+ stackIds: string[];
+}
\ No newline at end of file
diff --git a/frontend/src/lib/types/loading-states.type.ts b/frontend/src/lib/types/loading-states.type.ts
new file mode 100644
index 000000000..a00004e6c
--- /dev/null
+++ b/frontend/src/lib/types/loading-states.type.ts
@@ -0,0 +1,10 @@
+export type LoadingStates = {
+ start?: boolean;
+ stop?: boolean;
+ restart?: boolean;
+ pull?: boolean;
+ deploy?: boolean;
+ redeploy?: boolean;
+ remove?: boolean;
+ validating?: boolean;
+};
\ No newline at end of file
diff --git a/frontend/src/lib/types/user.type.ts b/frontend/src/lib/types/user.type.ts
index 7d2d742b1..db1f61ee1 100644
--- a/frontend/src/lib/types/user.type.ts
+++ b/frontend/src/lib/types/user.type.ts
@@ -1,15 +1,15 @@
export type User = {
- ID: string;
- Username: string;
- PasswordHash?: string;
- DisplayName?: string;
- Email?: string;
- Roles: string[];
- CreatedAt: string;
- LastLogin?: string;
- RequirePasswordChange?: boolean;
- UpdatedAt?: string;
- OidcSubjectId?: string;
+ id: string;
+ username: string;
+ passwordHash?: string;
+ displayName?: string;
+ email?: string;
+ roles: string[];
+ createdAt: string;
+ lastLogin?: string;
+ requirePasswordChange?: boolean;
+ updatedAt?: string;
+ oidcSubjectId?: string;
};
export interface UserRole {
diff --git a/frontend/src/routes/+layout.ts b/frontend/src/routes/+layout.ts
index a5a93447a..eaeccd928 100644
--- a/frontend/src/routes/+layout.ts
+++ b/frontend/src/routes/+layout.ts
@@ -16,7 +16,7 @@ export const load = async () => {
}
const arcaneUser = await tryCatch(userAPI.getCurrentUser());
- const user = arcaneUser.error ? null : arcaneUser.data?.data;
+ const user = arcaneUser.error ? null : arcaneUser.data;
if (!environmentStore.isInitialized() && user) {
const environments = await tryCatch(environmentManagementAPI.list());
diff --git a/frontend/src/routes/auth/oidc/callback/+page.svelte b/frontend/src/routes/auth/oidc/callback/+page.svelte
index 5f92a4edd..61ede1b2a 100644
--- a/frontend/src/routes/auth/oidc/callback/+page.svelte
+++ b/frontend/src/routes/auth/oidc/callback/+page.svelte
@@ -37,17 +37,17 @@
if (authResult.user) {
const user: User = {
- ID: authResult.user.sub || authResult.user.email || '',
- Username: authResult.user.preferred_username || authResult.user.email || '',
- Email: authResult.user.email,
- DisplayName:
+ id: authResult.user.sub || authResult.user.email || '',
+ username: authResult.user.preferred_username || authResult.user.email || '',
+ email: authResult.user.email,
+ displayName:
authResult.user.name ||
authResult.user.given_name ||
authResult.user.preferred_username ||
authResult.user.email ||
'User',
- Roles: ['user'],
- CreatedAt: new Date().toISOString()
+ roles: ['user'],
+ createdAt: new Date().toISOString()
};
userStore.setUser(user);
diff --git a/frontend/src/routes/settings/users/+page.svelte b/frontend/src/routes/settings/users/+page.svelte
index a8b06c5c3..6f899cd5c 100644
--- a/frontend/src/routes/settings/users/+page.svelte
+++ b/frontend/src/routes/settings/users/+page.svelte
@@ -33,8 +33,8 @@
});
const totalUsers = $derived(users.length);
- const adminUsers = $derived(users.filter((u) => u.Roles?.includes('admin')).length);
- const regularUsers = $derived(users.filter((u) => !u.Roles?.includes('admin')).length);
+ const adminUsers = $derived(users.filter((u) => u.roles?.includes('admin')).length);
+ const regularUsers = $derived(users.filter((u) => !u.roles?.includes('admin')).length);
async function loadUsers() {
try {
@@ -109,38 +109,38 @@
const result = await tryCatch(userAPI.update(userId, user));
handleApiResultWithCallbacks({
result,
- message: `Failed to update user "${user.Username}"`,
+ message: `Failed to update user "${user.username}"`,
setLoadingState: (value) => (isLoading[loading] = value),
onSuccess: async () => {
- toast.success(`User "${user.Username}" updated successfully.`);
+ toast.success(`User "${user.username}" updated successfully.`);
await loadUsers();
isDialogOpen.edit = false;
userToEdit = null;
}
});
} else {
- if (!user.Username) {
+ if (!user.username) {
toast.error('Username is required');
isLoading[loading] = false;
return;
}
- const createUser: Omit<User, 'ID' | 'CreatedAt' | 'UpdatedAt'> = {
- Username: user.Username,
- DisplayName: user.DisplayName,
- Email: user.Email,
- Roles: user.Roles || ['user'],
- PasswordHash: user.password,
- RequirePasswordChange: false
+ const createUser: Omit<User, 'id' | 'createdAt' | 'updatedAt'> = {
+ username: user.username,
+ displayName: user.displayName,
+ email: user.email,
+ roles: user.roles || ['user'],
+ passwordHash: user.password,
+ requirePasswordChange: false
};
const result = await tryCatch(userAPI.create(createUser));
handleApiResultWithCallbacks({
result,
- message: `Failed to create user "${user.Username}"`,
+ message: `Failed to create user "${user.username}"`,
setLoadingState: (value) => (isLoading[loading] = value),
onSuccess: async () => {
- toast.success(`User "${user.Username}" created successfully.`);
+ toast.success(`User "${user.username}" created successfully.`);
await loadUsers();
isDialogOpen.create = false;
}
diff --git a/frontend/src/routes/settings/users/user-table.svelte b/frontend/src/routes/settings/users/user-table.svelte
index 6e38a4b41..df3527c1b 100644
--- a/frontend/src/routes/settings/users/user-table.svelte
+++ b/frontend/src/routes/settings/users/user-table.svelte
@@ -41,7 +41,7 @@
const usersWithId = $derived(
(users || []).map((user) => ({
...user,
- id: user.ID
+ id: user.id
}))
);
@@ -164,11 +164,11 @@
bind:selectedIds
{onRefresh}
columns={[
- { label: 'Username', sortColumn: 'Username' },
- { label: 'Display Name', sortColumn: 'DisplayName' },
- { label: 'Email', sortColumn: 'Email' },
- { label: 'Role', sortColumn: 'Roles' },
- { label: 'Created', sortColumn: 'CreatedAt' },
+ { label: 'Username', sortColumn: 'username' },
+ { label: 'Display Name', sortColumn: 'displayName' },
+ { label: 'Email', sortColumn: 'email' },
+ { label: 'Role', sortColumn: 'roles' },
+ { label: 'Created', sortColumn: 'createdAt' },
{ label: ' ' }
]}
filterPlaceholder="Search users..."
@@ -176,14 +176,14 @@
>
{#snippet rows({ item })}
<Table.Cell>
- <span class="font-medium">{item.Username}</span>
+ <span class="font-medium">{item.username}</span>
</Table.Cell>
- <Table.Cell>{item.DisplayName || '-'}</Table.Cell>
- <Table.Cell>{item.Email || '-'}</Table.Cell>
+ <Table.Cell>{item.displayName || '-'}</Table.Cell>
+ <Table.Cell>{item.email || '-'}</Table.Cell>
<Table.Cell>
- <StatusBadge text={getRoleText(item.Roles)} variant={getRoleBadgeVariant(item.Roles)} />
+ <StatusBadge text={getRoleText(item.roles)} variant={getRoleBadgeVariant(item.roles)} />
</Table.Cell>
- <Table.Cell>{formatFriendlyDate(item.CreatedAt)}</Table.Cell>
+ <Table.Cell>{formatFriendlyDate(item.createdAt)}</Table.Cell>
<Table.Cell>
<DropdownMenu.Root>
<DropdownMenu.Trigger>
@@ -202,7 +202,7 @@
</DropdownMenu.Item>
<DropdownMenu.Item
class="focus:text-red-700! text-red-500"
- onclick={() => handleDeleteUser(item.ID, item.Username)}
+ onclick={() => handleDeleteUser(item.id, item.username)}
>
<Trash2 class="size-4" />
Delete