You've already forked pocketbase
							
							
				mirror of
				https://github.com/pocketbase/pocketbase.git
				synced 2025-10-31 08:37:38 +02:00 
			
		
		
		
	[#47] fixed some doc and code inconsistencies and removed some redundant parentheses
This commit is contained in:
		| @@ -38,13 +38,13 @@ func InitApi(app core.App) (*echo.Echo, error) { | ||||
| 		var apiErr *rest.ApiError | ||||
|  | ||||
| 		switch v := err.(type) { | ||||
| 		case (*echo.HTTPError): | ||||
| 		case *echo.HTTPError: | ||||
| 			if v.Internal != nil && app.IsDebug() { | ||||
| 				log.Println(v.Internal) | ||||
| 			} | ||||
| 			msg := fmt.Sprintf("%v", v.Message) | ||||
| 			apiErr = rest.NewApiError(v.Code, msg, v) | ||||
| 		case (*rest.ApiError): | ||||
| 		case *rest.ApiError: | ||||
| 			if app.IsDebug() && v.RawData() != nil { | ||||
| 				log.Println(v.RawData()) | ||||
| 			} | ||||
|   | ||||
| @@ -204,11 +204,11 @@ func ActivityLogger(app core.App) echo.MiddlewareFunc { | ||||
|  | ||||
| 			if err != nil { | ||||
| 				switch v := err.(type) { | ||||
| 				case (*echo.HTTPError): | ||||
| 				case *echo.HTTPError: | ||||
| 					status = v.Code | ||||
| 					meta["errorMessage"] = v.Message | ||||
| 					meta["errorDetails"] = fmt.Sprint(v.Internal) | ||||
| 				case (*rest.ApiError): | ||||
| 				case *rest.ApiError: | ||||
| 					status = v.Code | ||||
| 					meta["errorMessage"] = v.Message | ||||
| 					meta["errorDetails"] = fmt.Sprint(v.RawData()) | ||||
| @@ -259,7 +259,7 @@ func ActivityLogger(app core.App) echo.MiddlewareFunc { | ||||
| 				// --- | ||||
| 				now := time.Now() | ||||
| 				lastLogsDeletedAt := cast.ToTime(app.Cache().Get("lastLogsDeletedAt")) | ||||
| 				daysDiff := (now.Sub(lastLogsDeletedAt).Hours() * 24) | ||||
| 				daysDiff := now.Sub(lastLogsDeletedAt).Hours() * 24 | ||||
|  | ||||
| 				if daysDiff > float64(app.Settings().Logs.MaxDays) { | ||||
| 					deleteErr := app.LogsDao().DeleteOldRequests(now.AddDate(0, 0, -1*app.Settings().Logs.MaxDays)) | ||||
|   | ||||
| @@ -148,12 +148,12 @@ func (s *Settings) Merge(other *Settings) error { | ||||
| } | ||||
|  | ||||
| // Clone creates a new deep copy of the current settings. | ||||
| func (c *Settings) Clone() (*Settings, error) { | ||||
| 	new := &Settings{} | ||||
| 	if err := new.Merge(c); err != nil { | ||||
| func (s *Settings) Clone() (*Settings, error) { | ||||
| 	settings := &Settings{} | ||||
| 	if err := settings.Merge(s); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return new, nil | ||||
| 	return settings, nil | ||||
| } | ||||
|  | ||||
| // RedactClone creates a new deep copy of the current settings, | ||||
|   | ||||
| @@ -45,7 +45,7 @@ func (dao *Dao) FindAdminByEmail(email string) (*models.Admin, error) { | ||||
| 	return model, nil | ||||
| } | ||||
|  | ||||
| // FindAdminByEmail finds the admin associated with the provided JWT token. | ||||
| // FindAdminByToken finds the admin associated with the provided JWT token. | ||||
| // | ||||
| // Returns an error if the JWT token is invalid or expired. | ||||
| func (dao *Dao) FindAdminByToken(token string, baseTokenKey string) (*models.Admin, error) { | ||||
|   | ||||
| @@ -8,7 +8,7 @@ import ( | ||||
| 	"github.com/pocketbase/pocketbase/models" | ||||
| ) | ||||
|  | ||||
| // UserEmailChangeConfirm defines a user email change request form. | ||||
| // UserEmailChangeRequest defines a user email change request form. | ||||
| type UserEmailChangeRequest struct { | ||||
| 	app  core.App | ||||
| 	user *models.User | ||||
|   | ||||
| @@ -53,7 +53,7 @@ func (m *BaseModel) GetCreated() types.DateTime { | ||||
| 	return m.Created | ||||
| } | ||||
|  | ||||
| // GetCreated returns the model's Updated datetime. | ||||
| // GetUpdated returns the model's Updated datetime. | ||||
| func (m *BaseModel) GetUpdated() types.DateTime { | ||||
| 	return m.Updated | ||||
| } | ||||
| @@ -71,7 +71,7 @@ func (m *BaseModel) RefreshCreated() { | ||||
| 	m.Created = types.NowDateTime() | ||||
| } | ||||
|  | ||||
| // RefreshCreated updates the model's Created field with the current datetime. | ||||
| // RefreshUpdated updates the model's Created field with the current datetime. | ||||
| func (m *BaseModel) RefreshUpdated() { | ||||
| 	m.Updated = types.NowDateTime() | ||||
| } | ||||
|   | ||||
| @@ -77,12 +77,12 @@ func NewRecordsFromNullStringMaps(collection *Collection, rows []dbx.NullStringM | ||||
| 	return result | ||||
| } | ||||
|  | ||||
| // Returns the table name associated to the current Record model. | ||||
| // TableName returns the table name associated to the current Record model. | ||||
| func (m *Record) TableName() string { | ||||
| 	return m.collection.Name | ||||
| } | ||||
|  | ||||
| // Returns the Collection model associated to the current Record model. | ||||
| // Collection returns the Collection model associated to the current Record model. | ||||
| func (m *Record) Collection() *Collection { | ||||
| 	return m.collection | ||||
| } | ||||
|   | ||||
| @@ -29,7 +29,7 @@ type Provider interface { | ||||
| 	// SetClientId sets the provider client's ID. | ||||
| 	SetClientId(clientId string) | ||||
|  | ||||
| 	// ClientId returns the provider client's app secret. | ||||
| 	// ClientSecret returns the provider client's app secret. | ||||
| 	ClientSecret() string | ||||
|  | ||||
| 	// SetClientSecret sets the provider client's app secret. | ||||
|   | ||||
| @@ -10,7 +10,7 @@ import ( | ||||
|  | ||||
| var cachedPatterns = map[string]*regexp.Regexp{} | ||||
|  | ||||
| // ExustInSlice checks whether a comparable element exists in a slice of the same type. | ||||
| // ExistInSlice checks whether a comparable element exists in a slice of the same type. | ||||
| func ExistInSlice[T comparable](item T, list []T) bool { | ||||
| 	if len(list) == 0 { | ||||
| 		return false | ||||
|   | ||||
		Reference in New Issue
	
	Block a user