refactor(transcode): relocate TranscodeService to core and flatten API package

This commit is contained in:
yiling
2026-06-16 09:47:27 +08:00
parent 7f6e41708a
commit f16a8a7069
51 changed files with 161 additions and 159 deletions
+36
View File
@@ -0,0 +1,36 @@
import { Hono } from 'hono'
import { inviteService } from '@shumai/core/src/invite/invite'
import { InviteInfo } from '@shumai/dtos'
const app = new Hono()
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const mapToInviteInfo = (inv: any): InviteInfo => {
const info: InviteInfo = {
code: inv.code,
role: inv.role!,
teamId: inv.teamId,
teamName: inv.team.name,
inviterName: inv.inviter.name,
isUsed: inv.used,
}
if (inv.project) {
info.projectId = inv.project.id
info.projectName = inv.project.name
}
return info
}
const route = app.get('/invite/:code', async (c) => {
const code = c.req.param('code')
try {
const inv = await inviteService.getInvite(code)
return c.json(mapToInviteInfo(inv))
} catch {
return c.json({ error: 'Not found' }, 404)
}
})
export default route