| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | package core | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							| 
									
										
										
										
											2023-05-29 21:57:50 +08:00
										 |  |  | 	"net/http" | 
					
						
							| 
									
										
										
										
											2023-08-03 17:38:02 +08:00
										 |  |  | 	"time" | 
					
						
							| 
									
										
										
										
											2023-05-29 21:57:50 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-02 05:29:45 +08:00
										 |  |  | 	"github.com/labstack/echo/v5" | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | 	"github.com/pocketbase/pocketbase/daos" | 
					
						
							|  |  |  | 	"github.com/pocketbase/pocketbase/models" | 
					
						
							|  |  |  | 	"github.com/pocketbase/pocketbase/models/schema" | 
					
						
							| 
									
										
										
										
											2022-11-26 20:42:45 +08:00
										 |  |  | 	"github.com/pocketbase/pocketbase/models/settings" | 
					
						
							| 
									
										
										
										
											2023-01-15 23:00:28 +08:00
										 |  |  | 	"github.com/pocketbase/pocketbase/tools/auth" | 
					
						
							| 
									
										
										
										
											2023-02-23 04:09:13 +08:00
										 |  |  | 	"github.com/pocketbase/pocketbase/tools/filesystem" | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	"github.com/pocketbase/pocketbase/tools/hook" | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | 	"github.com/pocketbase/pocketbase/tools/mailer" | 
					
						
							|  |  |  | 	"github.com/pocketbase/pocketbase/tools/search" | 
					
						
							|  |  |  | 	"github.com/pocketbase/pocketbase/tools/subscriptions" | 
					
						
							| 
									
										
										
										
											2023-05-29 21:57:50 +08:00
										 |  |  | 	"golang.org/x/crypto/acme/autocert" | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-05 01:33:35 +08:00
										 |  |  | var ( | 
					
						
							|  |  |  | 	_ hook.Tagger = (*BaseModelEvent)(nil) | 
					
						
							|  |  |  | 	_ hook.Tagger = (*BaseCollectionEvent)(nil) | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type BaseModelEvent struct { | 
					
						
							|  |  |  | 	Model models.Model | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func (e *BaseModelEvent) Tags() []string { | 
					
						
							|  |  |  | 	if e.Model == nil { | 
					
						
							|  |  |  | 		return nil | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if r, ok := e.Model.(*models.Record); ok && r.Collection() != nil { | 
					
						
							|  |  |  | 		return []string{r.Collection().Id, r.Collection().Name} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return []string{e.Model.TableName()} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | type BaseCollectionEvent struct { | 
					
						
							|  |  |  | 	Collection *models.Collection | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func (e *BaseCollectionEvent) Tags() []string { | 
					
						
							|  |  |  | 	if e.Collection == nil { | 
					
						
							|  |  |  | 		return nil | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	tags := make([]string, 0, 2) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if e.Collection.Id != "" { | 
					
						
							|  |  |  | 		tags = append(tags, e.Collection.Id) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if e.Collection.Name != "" { | 
					
						
							|  |  |  | 		tags = append(tags, e.Collection.Name) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return tags | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | // -------------------------------------------------------------------
 | 
					
						
							|  |  |  | // Serve events data
 | 
					
						
							|  |  |  | // -------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-26 20:42:45 +08:00
										 |  |  | type BootstrapEvent struct { | 
					
						
							|  |  |  | 	App App | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-09 02:52:40 +08:00
										 |  |  | type TerminateEvent struct { | 
					
						
							|  |  |  | 	App App | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | type ServeEvent struct { | 
					
						
							| 
									
										
										
										
											2023-05-29 21:57:50 +08:00
										 |  |  | 	App         App | 
					
						
							|  |  |  | 	Router      *echo.Echo | 
					
						
							|  |  |  | 	Server      *http.Server | 
					
						
							|  |  |  | 	CertManager *autocert.Manager | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-02 22:36:15 +08:00
										 |  |  | type ApiErrorEvent struct { | 
					
						
							|  |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Error       error | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | // -------------------------------------------------------------------
 | 
					
						
							|  |  |  | // Model DAO events data
 | 
					
						
							|  |  |  | // -------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type ModelEvent struct { | 
					
						
							| 
									
										
										
										
											2023-04-05 01:33:35 +08:00
										 |  |  | 	BaseModelEvent | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-05 01:33:35 +08:00
										 |  |  | 	Dao *daos.Dao | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | // -------------------------------------------------------------------
 | 
					
						
							|  |  |  | // Mailer events data
 | 
					
						
							|  |  |  | // -------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-30 16:28:14 +08:00
										 |  |  | type MailerRecordEvent struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | 	MailClient mailer.Mailer | 
					
						
							| 
									
										
										
										
											2022-11-21 20:53:05 +08:00
										 |  |  | 	Message    *mailer.Message | 
					
						
							| 
									
										
										
										
											2022-10-30 16:28:14 +08:00
										 |  |  | 	Record     *models.Record | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | 	Meta       map[string]any | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type MailerAdminEvent struct { | 
					
						
							|  |  |  | 	MailClient mailer.Mailer | 
					
						
							| 
									
										
										
										
											2022-11-21 20:53:05 +08:00
										 |  |  | 	Message    *mailer.Message | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | 	Admin      *models.Admin | 
					
						
							|  |  |  | 	Meta       map[string]any | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // -------------------------------------------------------------------
 | 
					
						
							|  |  |  | // Realtime API events data
 | 
					
						
							|  |  |  | // -------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type RealtimeConnectEvent struct { | 
					
						
							|  |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Client      subscriptions.Client | 
					
						
							| 
									
										
										
										
											2023-08-03 17:38:02 +08:00
										 |  |  | 	IdleTimeout time.Duration | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-02 20:25:36 +08:00
										 |  |  | type RealtimeDisconnectEvent struct { | 
					
						
							|  |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Client      subscriptions.Client | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type RealtimeMessageEvent struct { | 
					
						
							|  |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Client      subscriptions.Client | 
					
						
							|  |  |  | 	Message     *subscriptions.Message | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | type RealtimeSubscribeEvent struct { | 
					
						
							|  |  |  | 	HttpContext   echo.Context | 
					
						
							|  |  |  | 	Client        subscriptions.Client | 
					
						
							|  |  |  | 	Subscriptions []string | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // -------------------------------------------------------------------
 | 
					
						
							|  |  |  | // Settings API events data
 | 
					
						
							|  |  |  | // -------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type SettingsListEvent struct { | 
					
						
							|  |  |  | 	HttpContext      echo.Context | 
					
						
							| 
									
										
										
										
											2022-11-26 20:42:45 +08:00
										 |  |  | 	RedactedSettings *settings.Settings | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type SettingsUpdateEvent struct { | 
					
						
							|  |  |  | 	HttpContext echo.Context | 
					
						
							| 
									
										
										
										
											2022-11-26 20:42:45 +08:00
										 |  |  | 	OldSettings *settings.Settings | 
					
						
							|  |  |  | 	NewSettings *settings.Settings | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // -------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2022-12-03 20:50:02 +08:00
										 |  |  | // Record CRUD API events data
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | // -------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type RecordsListEvent struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Records     []*models.Record | 
					
						
							|  |  |  | 	Result      *search.Result | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type RecordViewEvent struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Record      *models.Record | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type RecordCreateEvent struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-23 04:09:13 +08:00
										 |  |  | 	HttpContext   echo.Context | 
					
						
							|  |  |  | 	Record        *models.Record | 
					
						
							|  |  |  | 	UploadedFiles map[string][]*filesystem.File | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type RecordUpdateEvent struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-23 04:09:13 +08:00
										 |  |  | 	HttpContext   echo.Context | 
					
						
							|  |  |  | 	Record        *models.Record | 
					
						
							|  |  |  | 	UploadedFiles map[string][]*filesystem.File | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type RecordDeleteEvent struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Record      *models.Record | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // -------------------------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2022-12-03 20:50:02 +08:00
										 |  |  | // Auth Record API events data
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | // -------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-03 20:50:02 +08:00
										 |  |  | type RecordAuthEvent struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | 	HttpContext echo.Context | 
					
						
							| 
									
										
										
										
											2022-12-03 20:50:02 +08:00
										 |  |  | 	Record      *models.Record | 
					
						
							|  |  |  | 	Token       string | 
					
						
							|  |  |  | 	Meta        any | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-15 23:00:28 +08:00
										 |  |  | type RecordAuthWithPasswordEvent struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-15 23:00:28 +08:00
										 |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Record      *models.Record | 
					
						
							|  |  |  | 	Identity    string | 
					
						
							|  |  |  | 	Password    string | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type RecordAuthWithOAuth2Event struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-27 00:32:23 +08:00
										 |  |  | 	HttpContext    echo.Context | 
					
						
							|  |  |  | 	ProviderName   string | 
					
						
							|  |  |  | 	ProviderClient auth.Provider | 
					
						
							|  |  |  | 	Record         *models.Record | 
					
						
							|  |  |  | 	OAuth2User     *auth.AuthUser | 
					
						
							|  |  |  | 	IsNewRecord    bool | 
					
						
							| 
									
										
										
										
											2023-01-15 23:00:28 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type RecordAuthRefreshEvent struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-15 23:00:28 +08:00
										 |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Record      *models.Record | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-03 20:50:02 +08:00
										 |  |  | type RecordRequestPasswordResetEvent struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | 	HttpContext echo.Context | 
					
						
							| 
									
										
										
										
											2022-12-03 20:50:02 +08:00
										 |  |  | 	Record      *models.Record | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-03 20:50:02 +08:00
										 |  |  | type RecordConfirmPasswordResetEvent struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | 	HttpContext echo.Context | 
					
						
							| 
									
										
										
										
											2022-12-03 20:50:02 +08:00
										 |  |  | 	Record      *models.Record | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-03 20:50:02 +08:00
										 |  |  | type RecordRequestVerificationEvent struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | 	HttpContext echo.Context | 
					
						
							| 
									
										
										
										
											2022-12-03 20:50:02 +08:00
										 |  |  | 	Record      *models.Record | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-03 20:50:02 +08:00
										 |  |  | type RecordConfirmVerificationEvent struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | 	HttpContext echo.Context | 
					
						
							| 
									
										
										
										
											2022-12-03 20:50:02 +08:00
										 |  |  | 	Record      *models.Record | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-03 20:50:02 +08:00
										 |  |  | type RecordRequestEmailChangeEvent struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | 	HttpContext echo.Context | 
					
						
							| 
									
										
										
										
											2022-12-03 20:50:02 +08:00
										 |  |  | 	Record      *models.Record | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-03 20:50:02 +08:00
										 |  |  | type RecordConfirmEmailChangeEvent struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | 	HttpContext echo.Context | 
					
						
							| 
									
										
										
										
											2022-10-30 16:28:14 +08:00
										 |  |  | 	Record      *models.Record | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-30 16:28:14 +08:00
										 |  |  | type RecordListExternalAuthsEvent struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-31 18:38:31 +08:00
										 |  |  | 	HttpContext   echo.Context | 
					
						
							| 
									
										
										
										
											2022-10-30 16:28:14 +08:00
										 |  |  | 	Record        *models.Record | 
					
						
							| 
									
										
										
										
											2022-08-31 18:38:31 +08:00
										 |  |  | 	ExternalAuths []*models.ExternalAuth | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-30 16:28:14 +08:00
										 |  |  | type RecordUnlinkExternalAuthEvent struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-31 18:38:31 +08:00
										 |  |  | 	HttpContext  echo.Context | 
					
						
							| 
									
										
										
										
											2022-10-30 16:28:14 +08:00
										 |  |  | 	Record       *models.Record | 
					
						
							| 
									
										
										
										
											2022-08-31 18:38:31 +08:00
										 |  |  | 	ExternalAuth *models.ExternalAuth | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-03 20:50:02 +08:00
										 |  |  | // -------------------------------------------------------------------
 | 
					
						
							|  |  |  | // Admin API events data
 | 
					
						
							|  |  |  | // -------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type AdminsListEvent struct { | 
					
						
							|  |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Admins      []*models.Admin | 
					
						
							|  |  |  | 	Result      *search.Result | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type AdminViewEvent struct { | 
					
						
							|  |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Admin       *models.Admin | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type AdminCreateEvent struct { | 
					
						
							|  |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Admin       *models.Admin | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type AdminUpdateEvent struct { | 
					
						
							|  |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Admin       *models.Admin | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type AdminDeleteEvent struct { | 
					
						
							|  |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Admin       *models.Admin | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type AdminAuthEvent struct { | 
					
						
							|  |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Admin       *models.Admin | 
					
						
							|  |  |  | 	Token       string | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-15 23:00:28 +08:00
										 |  |  | type AdminAuthWithPasswordEvent struct { | 
					
						
							|  |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Admin       *models.Admin | 
					
						
							|  |  |  | 	Identity    string | 
					
						
							|  |  |  | 	Password    string | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type AdminAuthRefreshEvent struct { | 
					
						
							|  |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Admin       *models.Admin | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type AdminRequestPasswordResetEvent struct { | 
					
						
							|  |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Admin       *models.Admin | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type AdminConfirmPasswordResetEvent struct { | 
					
						
							|  |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Admin       *models.Admin | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | // -------------------------------------------------------------------
 | 
					
						
							|  |  |  | // Collection API events data
 | 
					
						
							|  |  |  | // -------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type CollectionsListEvent struct { | 
					
						
							|  |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Collections []*models.Collection | 
					
						
							|  |  |  | 	Result      *search.Result | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type CollectionViewEvent struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type CollectionCreateEvent struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type CollectionUpdateEvent struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type CollectionDeleteEvent struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-08 01:58:21 +08:00
										 |  |  | type CollectionsImportEvent struct { | 
					
						
							|  |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Collections []*models.Collection | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | // -------------------------------------------------------------------
 | 
					
						
							|  |  |  | // File API events data
 | 
					
						
							|  |  |  | // -------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-05 01:33:35 +08:00
										 |  |  | type FileTokenEvent struct { | 
					
						
							|  |  |  | 	BaseModelEvent | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Token       string | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | type FileDownloadEvent struct { | 
					
						
							| 
									
										
										
										
											2023-01-28 04:19:08 +08:00
										 |  |  | 	BaseCollectionEvent | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-07 05:19:05 +08:00
										 |  |  | 	HttpContext echo.Context | 
					
						
							|  |  |  | 	Record      *models.Record | 
					
						
							|  |  |  | 	FileField   *schema.SchemaField | 
					
						
							|  |  |  | 	ServedPath  string | 
					
						
							|  |  |  | 	ServedName  string | 
					
						
							|  |  |  | } |