Skip to content

Commit 796bd7b

Browse files
committed
refactor: add barrel to backend core/entity
1 parent d63dc9c commit 796bd7b

34 files changed

+79
-50
lines changed

backend/eslint.config.mjs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,31 @@ export default defineConfig([
1414
ignores: ['drizzle.config.ts'],
1515
},
1616
sharedConfig,
17+
{
18+
files: ['src/**/*.{ts,tsx}'],
19+
rules: {
20+
'no-restricted-imports': [
21+
'error',
22+
{
23+
patterns: [
24+
{
25+
group: [
26+
'./entity/*',
27+
'../entity/*',
28+
'../../entity/*',
29+
'../core/entity/*',
30+
'../../core/entity/*',
31+
'../../../core/entity/*',
32+
'@/internal/core/entity/*',
33+
],
34+
message:
35+
'Import backend entities via the barrel (e.g. "../entity" or "../../core/entity").',
36+
},
37+
],
38+
},
39+
],
40+
},
41+
},
1742
{
1843
files: ['**/*.ts'],
1944
languageOptions: {

backend/src/cmd/replay.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import path from 'path';
55
import { JsonSnapshotAdapter } from '../internal/adapter/driven/items/JsonSnapshotAdapter';
66
import { OpenAIAdapter } from '../internal/adapter/driven/llm/OpenAIAdapter';
77
import { PostgresAdapter } from '../internal/adapter/driven/persistence/PostgresAdapter';
8-
import type { Item } from '../internal/core/entity/Item';
8+
import type { Item } from '../internal/core/entity';
99
import { makeReportingAgent } from '../internal/usecase/agent/makeReportingAgent';
1010

1111
// - Dump Neon UI: { id?, date_created: "YYYY-MM-DD HH:mm:ss.SSS", data: { items: Item[] } }

backend/src/internal/adapter/driven/items/JsonSnapshotAdapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Item } from '../../../core/entity/Item';
1+
import type { Item } from '../../../core/entity';
22
import type { ItemsProviderPort } from '../../../core/port/ItemsProviderPort';
33

44
export class JsonSnapshotAdapter implements ItemsProviderPort {

backend/src/internal/adapter/driven/items/RedditItemsAdapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { z } from 'zod';
22
import { filterByScore } from '../../../core/domain/items/filterByScore';
3-
import type { Item } from '../../../core/entity/Item';
3+
import type { Item } from '../../../core/entity';
44
import type { FetchPort } from '../../../core/port/FetchPort';
55
import type { ItemsProviderPort } from '../../../core/port/ItemsProviderPort';
66
import { fetchWithRetry } from '../../../lib/http/fetchWithRetry';

backend/src/internal/core/domain/items/filterByScore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Item } from '../../entity/Item';
1+
import type { Item } from '../../entity';
22

33
export function filterByScore(items: Item[], minScore = 0): Item[] {
44
return items.filter((i) => i.score >= minScore);

backend/src/internal/core/domain/profiles/aggregateProfiles.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, test } from 'vitest';
2-
import type { EmotionProfile } from '../../entity/EmotionProfile';
2+
import type { EmotionProfile } from '../../entity';
33
import { aggregateProfiles } from './aggregateProfiles';
44

55
const fakeEmotionProfiles: EmotionProfile[] = [

backend/src/internal/core/domain/profiles/aggregateProfiles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type {
33
EmotionProfile,
44
EmotionScores,
55
TonalityScores,
6-
} from '../../entity/EmotionProfile';
6+
} from '../../entity';
77

88
const EMOTION_KEYS = [
99
'anger',

backend/src/internal/core/domain/weights/MomentumWeightsStrategy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { RelevantItem, WeightedItem } from '../../entity/Item';
1+
import type { RelevantItem, WeightedItem } from '../../entity';
22
import type { WeightsPort } from '../../port/WeightsPort';
33
import { capByPercentile } from './capByPercentile';
44
import { computeMomentum } from './computeMomentum';

backend/src/internal/core/domain/weights/capByPercentile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { WeightedItem } from '../../entity/Item';
1+
import type { WeightedItem } from '../../entity';
22
import type { CapOptions } from './MomentumWeightsStrategy';
33

44
export type WeightsCapReason =

backend/src/internal/core/domain/weights/computeMomentum.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { RelevantItem, WeightedItem } from '../../entity/Item';
1+
import type { RelevantItem, WeightedItem } from '../../entity';
22
import type { MomentumOptions } from './MomentumWeightsStrategy';
33

44
function isNew(prevRaw: number | undefined): boolean {

0 commit comments

Comments
 (0)