chore: db file compatibility (#228)

This commit is contained in:
kimatata
2025-05-25 10:13:57 +09:00
committed by GitHub
parent 13e0727914
commit 3475b3863c
5 changed files with 27 additions and 11 deletions

View File

@@ -1,6 +1,6 @@
const path = require('path');
const databasePath = path.resolve(__dirname, '../../database/database.sqlite');
const databasePath = path.resolve(__dirname, '../database/database.sqlite');
module.exports = {
development: {
@@ -14,5 +14,5 @@ module.exports = {
production: {
dialect: 'sqlite',
storage: databasePath,
}
},
};

View File

@@ -1,9 +1,18 @@
const path = require('path');
const express = require('express');
const RateLimit = require('express-rate-limit');
const path = require('path');
const { Sequelize } = require('sequelize');
const app = express();
// enable frontend access
const cors = require('cors');
const frontendOrigin = process.env.FRONTEND_ORIGIN || 'http://localhost:8000';
const corsOptions = {
origin: frontendOrigin,
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
};
app.use(cors(corsOptions));
// enable json middleware
app.use(express.json());
@@ -19,9 +28,10 @@ app.use(limiter);
app.use(express.static(path.join(__dirname, 'public')));
// init sequalize
const databasePath = path.resolve(__dirname, 'database/database.sqlite');
const sequelize = new Sequelize({
dialect: 'sqlite',
storage: 'database/database.sqlite',
storage: databasePath,
logging: false,
});

View File

@@ -9,7 +9,7 @@ services:
- SECRET_KEY=your_secret_key_here
- IS_DEMO=false # set to true to seed the database
volumes:
- db-data:/app/database
- db-data:/app/backend/database
volumes:
db-data:

View File

@@ -1,6 +0,0 @@
import { test, expect } from '@playwright/test';
test('has title', async ({ page }) => {
await page.goto('http://localhost:8000/');
await expect(page).toHaveTitle('Open Source Test Case Management System | UnitTCMS');
});

12
e2e/not-demo-mode.spec.ts Normal file
View File

@@ -0,0 +1,12 @@
import { test, expect } from '@playwright/test';
test('If not demo mode, the landing page will not be displayed and will be redirected to the projects page.', async ({
page,
}) => {
const screenshotDir = 'playwright-screenshots/not-demo-redirect';
await page.goto('http://localhost:8000/');
await expect(page).toHaveURL(/\/projects/);
await page.screenshot({ path: `${screenshotDir}/landing-page-redirect.png`, fullPage: true });
});