mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2025-10-29 17:25:32 +00:00
resetbutton & almanach edit start
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"log/slog"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/tools/types"
|
||||
)
|
||||
|
||||
var _ core.RecordProxy = (*Entry)(nil)
|
||||
@@ -243,3 +244,19 @@ func (e *Entry) Editor() string {
|
||||
func (e *Entry) SetEditor(editor string) {
|
||||
e.Set(EDITOR_FIELD, editor)
|
||||
}
|
||||
|
||||
func (e *Entry) Updated() types.DateTime {
|
||||
return e.GetDateTime(UPDATED_FIELD)
|
||||
}
|
||||
|
||||
func (e *Entry) SetUpdated(updated types.DateTime) {
|
||||
e.Set(UPDATED_FIELD, updated)
|
||||
}
|
||||
|
||||
func (e *Entry) Created() types.DateTime {
|
||||
return e.GetDateTime(CREATED_FIELD)
|
||||
}
|
||||
|
||||
func (e *Entry) SetCreated(created types.DateTime) {
|
||||
e.Set(CREATED_FIELD, created)
|
||||
}
|
||||
|
||||
@@ -133,6 +133,42 @@ func Series_ID(app core.App, id string) (*Series, error) {
|
||||
return &ret, err
|
||||
}
|
||||
|
||||
func Users_ID(app core.App, id string) (*User, error) {
|
||||
ret, err := TableByID[User](app, USERS_TABLE, id)
|
||||
return &ret, err
|
||||
}
|
||||
|
||||
func Sessions_ID(app core.App, id string) (*Session, error) {
|
||||
ret, err := TableByID[Session](app, SESSIONS_TABLE, id)
|
||||
return &ret, err
|
||||
}
|
||||
|
||||
func AccessTokens_Token(app core.App, token string) (*AccessToken, error) {
|
||||
t := HashStringSHA256(token)
|
||||
return TableByField[*AccessToken](
|
||||
app,
|
||||
ACCESS_TOKENS_TABLE,
|
||||
ACCESS_TOKENS_TOKEN_FIELD,
|
||||
t,
|
||||
)
|
||||
}
|
||||
|
||||
func Users_Email(app core.App, email string) (*User, error) {
|
||||
ret, err := TableByField[User](app, USERS_TABLE, USERS_EMAIL_FIELD, email)
|
||||
return &ret, err
|
||||
}
|
||||
|
||||
func Sessions_Token(app core.App, token string) (*Session, error) {
|
||||
t := HashStringSHA256(token)
|
||||
ret, err := TableByField[Session](
|
||||
app,
|
||||
SESSIONS_TABLE,
|
||||
SESSIONS_TOKEN_FIELD,
|
||||
t,
|
||||
)
|
||||
return &ret, err
|
||||
}
|
||||
|
||||
func Places_IDs(app core.App, ids []any) ([]*Place, error) {
|
||||
return TableByIDs[*Place](app, PLACES_TABLE, ids)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user