feat: migrate app routes and business modules
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
// 这些数据只用于本地视觉预览,不模拟 OpenAPI 响应。每个实体都携带
|
||||
// genealogyId,详情必须由家谱与实体 ID 共同定位,调用方只能取得副本。
|
||||
const previewCeremonies = [
|
||||
{
|
||||
ceremonyId: '501', genealogyId: '1001', ceremonyType: '祭祖', ceremonyTitle: '清明祭祖',
|
||||
ceremonyTime: '2025-04-04', location: '汤氏宗祠',
|
||||
ceremonyDesc: '缅怀先祖,整理祭扫礼序,并由长辈讲述家族往事。',
|
||||
invitees: [
|
||||
{ inviteeUserId: '2001', inviteStatus: '1' },
|
||||
{ inviteeUserId: '2002', inviteStatus: '0' }
|
||||
]
|
||||
},
|
||||
{
|
||||
ceremonyId: '502', genealogyId: '1001', ceremonyType: '家宴', ceremonyTitle: '中秋家宴',
|
||||
ceremonyTime: '2025-09-17', location: '祖居院落',
|
||||
ceremonyDesc: '家人团聚,共叙近况并整理年度家族影像。',
|
||||
invitees: [{ inviteeUserId: '2003', inviteStatus: '1' }]
|
||||
},
|
||||
{
|
||||
ceremonyId: '503', genealogyId: '1001', ceremonyType: '团拜', ceremonyTitle: '新春团拜',
|
||||
ceremonyTime: '2025-01-29', location: '家族礼堂',
|
||||
ceremonyDesc: '新春相聚,向长辈问安并记录家族近况。', invitees: []
|
||||
}
|
||||
]
|
||||
|
||||
const previewGrowthRecords = [
|
||||
{
|
||||
recordId: '701', genealogyId: '1001', lineagePersonId: '101', recordTitle: '整理第一册旧谱',
|
||||
recordDate: '1988-03', recordContent: '第一次独立整理家中保存的旧谱与口述线索。'
|
||||
},
|
||||
{
|
||||
recordId: '702', genealogyId: '1001', lineagePersonId: '104', recordTitle: '第一次参与修谱',
|
||||
recordDate: '2024-06', recordContent: '协助长辈核对照片人物与出生年份。'
|
||||
}
|
||||
]
|
||||
|
||||
const clonePreviewRecord = (record) => ({
|
||||
...record,
|
||||
...(Array.isArray(record.invitees)
|
||||
? { invitees: record.invitees.map((invitee) => ({ ...invitee })) }
|
||||
: {})
|
||||
})
|
||||
|
||||
const listScopedPreviewRecords = (records, genealogyId) => {
|
||||
const normalizedGenealogyId = String(genealogyId || '')
|
||||
if (!normalizedGenealogyId) return []
|
||||
return records
|
||||
.filter((record) => record.genealogyId === normalizedGenealogyId)
|
||||
.map(clonePreviewRecord)
|
||||
}
|
||||
|
||||
export const listPreviewCeremonies = (genealogyId) =>
|
||||
listScopedPreviewRecords(previewCeremonies, genealogyId)
|
||||
export const listPreviewGrowthRecords = (genealogyId, lineagePersonId = '') => {
|
||||
const records = listScopedPreviewRecords(previewGrowthRecords, genealogyId)
|
||||
const normalizedPersonId = String(lineagePersonId || '')
|
||||
return normalizedPersonId
|
||||
? records.filter((record) => record.lineagePersonId === normalizedPersonId)
|
||||
: records
|
||||
}
|
||||
Reference in New Issue
Block a user