refactor: 重构数据层支持 SGS SDK 集成
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -5,12 +5,11 @@ import type {
|
||||
} from '@/domain/museum'
|
||||
import {
|
||||
GuideRouteError,
|
||||
guideRouteRepository,
|
||||
type GuideRouteRepository
|
||||
} from '@/repositories/GuideRouteRepository'
|
||||
import {
|
||||
applyRouteReadinessGate
|
||||
} from '@/domain/guideReadiness'
|
||||
createGuideRouteRepository
|
||||
} from '@/repositories/createGuideRouteRepository'
|
||||
|
||||
const toSearchText = (target: GuideRouteTarget) => [
|
||||
target.name,
|
||||
@@ -36,12 +35,12 @@ export class GuideRouteUseCase {
|
||||
private targetsCache: GuideRouteTarget[] | null = null
|
||||
private readinessCache: GuideRouteReadiness | null = null
|
||||
|
||||
constructor(private readonly repository: GuideRouteRepository = guideRouteRepository) {}
|
||||
constructor(private readonly repository: GuideRouteRepository = createGuideRouteRepository()) {}
|
||||
|
||||
async getRouteReadiness() {
|
||||
if (this.readinessCache) return this.readinessCache
|
||||
|
||||
this.readinessCache = applyRouteReadinessGate(await this.repository.getRouteReadiness())
|
||||
this.readinessCache = await this.repository.getRouteReadiness()
|
||||
return this.readinessCache
|
||||
}
|
||||
|
||||
@@ -89,7 +88,7 @@ export class GuideRouteUseCase {
|
||||
return error.message
|
||||
}
|
||||
|
||||
return error instanceof Error ? error.message : '路线预览生成失败'
|
||||
return error instanceof Error ? error.message : '室内导览位置关系生成失败'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
import type {
|
||||
GuideDataIntegrityReport,
|
||||
GuideFloorDetail,
|
||||
GuideRouteReadiness,
|
||||
GuideLocationPreviewPlan,
|
||||
GuideMapDiagnostics,
|
||||
GuidePreviewStep,
|
||||
GuideStartLocation,
|
||||
MuseumPoi
|
||||
} from '@/domain/museum'
|
||||
import {
|
||||
guideRepository,
|
||||
type GuideRepository
|
||||
} from '@/repositories/GuideRepository'
|
||||
import {
|
||||
guideRepository
|
||||
} from '@/repositories/createGuideRepository'
|
||||
import {
|
||||
guideModelRepository,
|
||||
type GuideModelRepository
|
||||
@@ -114,6 +119,24 @@ export class GuideUseCase {
|
||||
return this.guide.getPoiById(id)
|
||||
}
|
||||
|
||||
getFloorDetail(floorId: string): Promise<GuideFloorDetail | null> {
|
||||
return this.guide.getFloorDetail
|
||||
? this.guide.getFloorDetail(floorId)
|
||||
: Promise.resolve(null)
|
||||
}
|
||||
|
||||
getMapDiagnostics(): Promise<GuideMapDiagnostics | null> {
|
||||
return this.guide.getMapDiagnostics
|
||||
? this.guide.getMapDiagnostics()
|
||||
: Promise.resolve(null)
|
||||
}
|
||||
|
||||
checkDataIntegrity(): Promise<GuideDataIntegrityReport | null> {
|
||||
return this.guide.checkDataIntegrity
|
||||
? this.guide.checkDataIntegrity()
|
||||
: Promise.resolve(null)
|
||||
}
|
||||
|
||||
async createLocationPreviewPlan(
|
||||
facilityId: string,
|
||||
target: string,
|
||||
|
||||
Reference in New Issue
Block a user