1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-01-06 00:18:50 +02:00

added UploadedFiles to the record create/update events

This commit is contained in:
Gani Georgiev 2023-02-22 22:09:13 +02:00
parent 503c65a767
commit 65a148b741
2 changed files with 9 additions and 4 deletions

View File

@ -217,6 +217,7 @@ func (api *recordApi) create(c echo.Context) error {
event.HttpContext = c
event.Collection = collection
event.Record = record
event.UploadedFiles = form.FilesToUpload()
// create the record
submitErr := form.Submit(func(next forms.InterceptorNextFunc[*models.Record]) forms.InterceptorNextFunc[*models.Record] {
@ -305,6 +306,7 @@ func (api *recordApi) update(c echo.Context) error {
event.HttpContext = c
event.Collection = collection
event.Record = record
event.UploadedFiles = form.FilesToUpload()
// update the record
submitErr := form.Submit(func(next forms.InterceptorNextFunc[*models.Record]) forms.InterceptorNextFunc[*models.Record] {

View File

@ -6,6 +6,7 @@ import (
"github.com/pocketbase/pocketbase/models/schema"
"github.com/pocketbase/pocketbase/models/settings"
"github.com/pocketbase/pocketbase/tools/auth"
"github.com/pocketbase/pocketbase/tools/filesystem"
"github.com/pocketbase/pocketbase/tools/hook"
"github.com/pocketbase/pocketbase/tools/mailer"
"github.com/pocketbase/pocketbase/tools/search"
@ -160,15 +161,17 @@ type RecordViewEvent struct {
type RecordCreateEvent struct {
BaseCollectionEvent
HttpContext echo.Context
Record *models.Record
HttpContext echo.Context
Record *models.Record
UploadedFiles map[string][]*filesystem.File
}
type RecordUpdateEvent struct {
BaseCollectionEvent
HttpContext echo.Context
Record *models.Record
HttpContext echo.Context
Record *models.Record
UploadedFiles map[string][]*filesystem.File
}
type RecordDeleteEvent struct {