Refactor database services and add component tests
- Remove deprecated CouchDB service files - Update database test configurations - Add test files for components and auth modules - Update user context and admin interface - Remove migration script for unified config - Fix User interface properties in tests (use status instead of isActive)
This commit is contained in:
@@ -6,7 +6,7 @@ import React, {
|
||||
ReactNode,
|
||||
} from 'react';
|
||||
import { User } from '../types';
|
||||
import { dbService } from '../services/couchdb.factory';
|
||||
import { databaseService } from '../services/database';
|
||||
import { authService } from '../services/auth/auth.service';
|
||||
|
||||
const SESSION_KEY = 'medication_app_session';
|
||||
@@ -74,7 +74,7 @@ export const UserProvider: React.FC<{ children: ReactNode }> = ({
|
||||
|
||||
// Update last login time
|
||||
const updatedUser = { ...result.user, lastLoginAt: new Date() };
|
||||
await dbService.updateUser(updatedUser);
|
||||
await databaseService.updateUser(updatedUser);
|
||||
|
||||
console.warn('Updated user with last login:', updatedUser);
|
||||
|
||||
@@ -119,7 +119,7 @@ export const UserProvider: React.FC<{ children: ReactNode }> = ({
|
||||
|
||||
// Update last login time
|
||||
const updatedUser = { ...result.user, lastLoginAt: new Date() };
|
||||
await dbService.updateUser(updatedUser);
|
||||
await databaseService.updateUser(updatedUser);
|
||||
|
||||
console.warn('Updated OAuth user with last login:', updatedUser);
|
||||
|
||||
@@ -157,7 +157,7 @@ export const UserProvider: React.FC<{ children: ReactNode }> = ({
|
||||
|
||||
const updateUser = async (updatedUser: User) => {
|
||||
try {
|
||||
const savedUser = await dbService.updateUser(updatedUser);
|
||||
const savedUser = await databaseService.updateUser(updatedUser);
|
||||
setUser(savedUser);
|
||||
} catch (error) {
|
||||
console.error('Failed to update user', error);
|
||||
|
||||
Reference in New Issue
Block a user