refactor: backend

This commit is contained in:
email
2022-02-03 15:32:03 +08:00
parent 3d8997a43a
commit d661134b03
42 changed files with 2601 additions and 1289 deletions

53
api/shortcut.go Normal file
View 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
}