mirror of
https://github.com/usual2970/certimate.git
synced 2025-06-08 21:49:52 +00:00
28 lines
672 B
Go
28 lines
672 B
Go
package domains
|
|
|
|
import (
|
|
"github.com/pocketbase/pocketbase/core"
|
|
|
|
"github.com/usual2970/certimate/internal/utils/app"
|
|
)
|
|
|
|
const tableName = "domains"
|
|
|
|
func AddEvent() error {
|
|
app := app.GetApp()
|
|
|
|
app.OnRecordAfterCreateRequest(tableName).Add(func(e *core.RecordCreateEvent) error {
|
|
return create(e.HttpContext.Request().Context(), e.Record)
|
|
})
|
|
|
|
app.OnRecordAfterUpdateRequest(tableName).Add(func(e *core.RecordUpdateEvent) error {
|
|
return update(e.HttpContext.Request().Context(), e.Record)
|
|
})
|
|
|
|
app.OnRecordAfterDeleteRequest(tableName).Add(func(e *core.RecordDeleteEvent) error {
|
|
return delete(e.HttpContext.Request().Context(), e.Record)
|
|
})
|
|
|
|
return nil
|
|
}
|