Skip to content

Commit bbe9ffe

Browse files
committed
before delete example
1 parent 1ee7cb9 commit bbe9ffe

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Chapter 13/myProject/Sources/App/Modules/Blog/Controllers/BlogPostAdminController.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,9 @@ struct BlogPostAdminController: AdminController {
3838
func deleteInfo(_ model: DatabaseModel) -> String {
3939
model.title
4040
}
41+
42+
func beforeDelete(_ req: Request, _ model: BlogPostModel) async throws {
43+
try await req.fs.delete(key: model.imageKey)
44+
}
4145
}
4246

0 commit comments

Comments
 (0)