Enhance error handling and logging in backend controllers and services
This commit improves error handling in various controllers, including diaryNoteController, memberNoteController, and permissionController, by adding console error logging for better debugging. Additionally, it updates the diaryService and teamDocumentService to enhance functionality and maintainability. The config.js file is also updated to ensure proper configuration for the development environment. These changes contribute to a more robust and user-friendly application.
This commit is contained in:
@@ -7,6 +7,8 @@ const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
dotenv.config({ path: path.resolve(__dirname, '.env') });
|
||||
|
||||
const isTestEnv = process.env.NODE_ENV === 'test';
|
||||
|
||||
const baseConfig = {
|
||||
username: process.env.DB_USER || 'root',
|
||||
password: process.env.DB_PASSWORD || 'hitomisan',
|
||||
@@ -19,11 +21,21 @@ const baseConfig = {
|
||||
underscoredAll: true,
|
||||
},
|
||||
logging: false,
|
||||
storage: process.env.DB_STORAGE,
|
||||
};
|
||||
|
||||
if (baseConfig.dialect === 'sqlite') {
|
||||
if (isTestEnv) {
|
||||
baseConfig.username = 'sqlite';
|
||||
baseConfig.password = '';
|
||||
baseConfig.database = 'sqlite';
|
||||
baseConfig.host = 'localhost';
|
||||
baseConfig.dialect = 'sqlite';
|
||||
baseConfig.storage = process.env.DB_STORAGE || ':memory:';
|
||||
}
|
||||
|
||||
if (baseConfig.dialect === 'sqlite' && !baseConfig.storage) {
|
||||
baseConfig.storage = ':memory:';
|
||||
}
|
||||
|
||||
export const development = baseConfig;
|
||||
|
||||
Reference in New Issue
Block a user