mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
refactor: backend
This commit is contained in:
53
api/shortcut.go
Normal file
53
api/shortcut.go
Normal file
@ -0,0 +1,53 @@
|
||||
package api
|
||||
|
||||
type Shortcut struct {
|
||||
Id int `jsonapi:"primary,shortcut"`
|
||||
CreatedTs int64 `jsonapi:"attr,createdTs"`
|
||||
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
|
||||
|
||||
Title string `jsonapi:"attr,title"`
|
||||
Payload string `jsonapi:"attr,payload"`
|
||||
PinnedTs int64 `jsonapi:"attr,pinnedTs"`
|
||||
CreatorId int
|
||||
}
|
||||
|
||||
type ShortcutCreate struct {
|
||||
// Standard fields
|
||||
CreatorId int
|
||||
|
||||
// Domain specific fields
|
||||
Title string `jsonapi:"attr,title"`
|
||||
Payload string `jsonapi:"attr,payload"`
|
||||
}
|
||||
|
||||
type ShortcutPatch struct {
|
||||
Id int
|
||||
|
||||
Title *string `jsonapi:"attr,title"`
|
||||
Payload *string `jsonapi:"attr,payload"`
|
||||
PinnedTs *int64
|
||||
|
||||
Pinned *bool `jsonapi:"attr,pinned"`
|
||||
}
|
||||
|
||||
type ShortcutFind struct {
|
||||
Id *int
|
||||
|
||||
// Standard fields
|
||||
CreatorId *int
|
||||
|
||||
// Domain specific fields
|
||||
Title *string `jsonapi:"attr,title"`
|
||||
}
|
||||
|
||||
type ShortcutDelete struct {
|
||||
Id int
|
||||
}
|
||||
|
||||
type ShortcutService interface {
|
||||
CreateShortcut(create *ShortcutCreate) (*Shortcut, error)
|
||||
PatchShortcut(patch *ShortcutPatch) (*Shortcut, error)
|
||||
FindShortcutList(find *ShortcutFind) ([]*Shortcut, error)
|
||||
FindShortcut(find *ShortcutFind) (*Shortcut, error)
|
||||
DeleteShortcut(delete *ShortcutDelete) error
|
||||
}
|
Reference in New Issue
Block a user