chore(auto): task completed - unknown
This commit is contained in:
@@ -25,5 +25,15 @@ export function createRecordingsRouter(): Router {
|
||||
}),
|
||||
);
|
||||
|
||||
// DELETE /api/recordings/:id
|
||||
router.delete(
|
||||
"/recordings/:id",
|
||||
asyncHandler(async (req: Request, res: Response) => {
|
||||
const { id } = req.params;
|
||||
await recordingsService.deleteById(id);
|
||||
res.json({ ok: true });
|
||||
}),
|
||||
);
|
||||
|
||||
return router;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,11 @@ export class RecordingsService {
|
||||
|
||||
return rows;
|
||||
}
|
||||
|
||||
async deleteById(id: string): Promise<void> {
|
||||
const db = getDatabase();
|
||||
await db.execute(sql`DELETE FROM voice_recordings WHERE id = ${id}`);
|
||||
}
|
||||
}
|
||||
|
||||
export const recordingsService = new RecordingsService();
|
||||
|
||||
Reference in New Issue
Block a user