feat: add global styles and transitions for dark mode support
- Created style.css for base styles and color variables for light and dark themes. - Added tailwind.css for Tailwind CSS integration and custom theme variables. - Introduced transitions.css to manage global transitions and reduce motion preferences. - Updated tsconfig.app.json to include path aliases for easier imports. - Modified tsconfig.json to set baseUrl and paths for module resolution. - Added typed-router.d.ts for auto-generated route types. - Enhanced vite.config.ts with Vue Router plugin, Tailwind CSS integration, and server proxy settings.
This commit is contained in:
@@ -1,46 +1,48 @@
|
||||
import { Collection, Db, MongoClient, type Document } from 'mongodb';
|
||||
import dbConfig from '../config/database';
|
||||
import { Collection, Db, MongoClient, type Document } from "mongodb";
|
||||
import dbConfig from "../config/database";
|
||||
|
||||
class DatabaseService {
|
||||
private client: MongoClient;
|
||||
private db: Db | null = null;
|
||||
private static instance: DatabaseService;
|
||||
private client: MongoClient;
|
||||
private db: Db | null = null;
|
||||
private static instance: DatabaseService;
|
||||
|
||||
private constructor() {
|
||||
this.client = new MongoClient(dbConfig.uri);
|
||||
}
|
||||
private constructor() {
|
||||
this.client = new MongoClient(dbConfig.uri);
|
||||
}
|
||||
|
||||
static getInstance(): DatabaseService {
|
||||
if (!DatabaseService.instance) {
|
||||
DatabaseService.instance = new DatabaseService();
|
||||
}
|
||||
return DatabaseService.instance;
|
||||
static getInstance(): DatabaseService {
|
||||
if (!DatabaseService.instance) {
|
||||
DatabaseService.instance = new DatabaseService();
|
||||
}
|
||||
return DatabaseService.instance;
|
||||
}
|
||||
|
||||
async connect(): Promise<void> {
|
||||
try {
|
||||
await this.client.connect();
|
||||
this.db = this.client.db(dbConfig.dbName);
|
||||
console.log('Connected to MongoDB successfully');
|
||||
} catch (error) {
|
||||
console.error('Failed to connect to MongoDB', error);
|
||||
throw error;
|
||||
}
|
||||
async connect(): Promise<void> {
|
||||
try {
|
||||
await this.client.connect();
|
||||
this.db = this.client.db(dbConfig.dbName);
|
||||
console.log("Connected to MongoDB successfully");
|
||||
} catch (error) {
|
||||
console.error("Failed to connect to MongoDB", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
getCollection<T extends Document>(collectionName: string): Collection<T> {
|
||||
if (!this.db) {
|
||||
throw new Error('Database connection not established. Call connect() first.');
|
||||
}
|
||||
return this.db.collection<T>(collectionName);
|
||||
getCollection<T extends Document>(collectionName: string): Collection<T> {
|
||||
if (!this.db) {
|
||||
throw new Error(
|
||||
"Database connection not established. Call connect() first.",
|
||||
);
|
||||
}
|
||||
return this.db.collection<T>(collectionName);
|
||||
}
|
||||
|
||||
async disconnect(): Promise<void> {
|
||||
if (this.client) {
|
||||
await this.client.close();
|
||||
console.log('Disconnected from MongoDB');
|
||||
}
|
||||
async disconnect(): Promise<void> {
|
||||
if (this.client) {
|
||||
await this.client.close();
|
||||
console.log("Disconnected from MongoDB");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default DatabaseService;
|
||||
|
||||
Reference in New Issue
Block a user