Skip to content

Commit

Permalink
refactor: reduce confusion between Settings and CardOption
Browse files Browse the repository at this point in the history
Rename SettingsController to CardOptionsController.
  • Loading branch information
aalemayhu committed Dec 24, 2024
1 parent d7d7232 commit 2c67b4d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SettingsService, {
IServiceSettings,
} from '../../services/SettingsService';
import SettingsController from './SettingsController';
import CardOptionsController from './CardOptionsController';
import { SettingsInitializer } from '../../data_layer/public/Settings';

class FakeSettingsService implements IServiceSettings {
Expand All @@ -25,7 +25,7 @@ function testDefaultSettings(
type: 'client' | 'server',
expectedOptions: Record<string, string>
) {
const settingsController = new SettingsController(new FakeSettingsService());
const settingsController = new CardOptionsController(new FakeSettingsService());
const defaultOptions = settingsController.getDefaultSettingsCardOptions(type);
expect(defaultOptions).toStrictEqual(expectedOptions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getOwner } from '../../lib/User/getOwner';
import supportedOptions, { CardOption } from './supportedOptions';
import Settings from '../../lib/parser/Settings';

class SettingsController {
class CardOptionsController {
constructor(private readonly service: IServiceSettings) {}

async createSetting(req: Request, res: Response) {
Expand Down Expand Up @@ -74,4 +74,4 @@ class SettingsController {
}
}

export default SettingsController;
export default CardOptionsController;
4 changes: 2 additions & 2 deletions src/routes/SettingsRouter.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import express from 'express';

import RequireAuthentication from './middleware/RequireAuthentication';
import SettingsController from '../controllers/SettingsController/SettingsController';
import CardOptionsController from '../controllers/CardOptionsController/CardOptionsController';
import SettingsRepository from '../data_layer/SettingsRepository';
import { getDatabase } from '../data_layer';
import SettingsService from '../services/SettingsService';

const SettingsRouter = () => {
const router = express.Router();
const database = getDatabase();
const controller = new SettingsController(
const controller = new CardOptionsController(
new SettingsService(new SettingsRepository(database))
);

Expand Down

0 comments on commit 2c67b4d

Please sign in to comment.