mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore(go): use json
instead of jsonapi
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
package api
|
||||
|
||||
type Login struct {
|
||||
Name string `jsonapi:"attr,name"`
|
||||
Password string `jsonapi:"attr,password"`
|
||||
Name string `json:"name"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
type Signup struct {
|
||||
Name string `jsonapi:"attr,name"`
|
||||
Password string `jsonapi:"attr,password"`
|
||||
Name string `json:"name"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
16
api/memo.go
16
api/memo.go
@@ -1,17 +1,17 @@
|
||||
package api
|
||||
|
||||
type Memo struct {
|
||||
Id int `jsonapi:"primary,memo"`
|
||||
CreatedTs int64 `jsonapi:"attr,createdTs"`
|
||||
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
|
||||
RowStatus string `jsonapi:"attr,rowStatus"`
|
||||
Id int `json:"id"`
|
||||
CreatedTs int64 `json:"createdTs"`
|
||||
UpdatedTs int64 `json:"updatedTs"`
|
||||
RowStatus string `json:"rowStatus"`
|
||||
|
||||
Content string `jsonapi:"attr,content"`
|
||||
CreatorId int `jsonapi:"attr,creatorId"`
|
||||
Content string `json:"content"`
|
||||
CreatorId int `json:"creatorId"`
|
||||
}
|
||||
|
||||
type MemoCreate struct {
|
||||
Content string `jsonapi:"attr,content"`
|
||||
Content string `json:"content"`
|
||||
CreatorId int
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ type MemoFind struct {
|
||||
}
|
||||
|
||||
type MemoDelete struct {
|
||||
Id *int `jsonapi:"primary,memo"`
|
||||
Id *int `json:"id"`
|
||||
CreatorId *int
|
||||
}
|
||||
|
||||
|
@@ -1,31 +1,31 @@
|
||||
package api
|
||||
|
||||
type Resource struct {
|
||||
Id int `jsonapi:"primary,resource"`
|
||||
CreatedTs int64 `jsonapi:"attr,createdTs"`
|
||||
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
|
||||
Id int `json:"id"`
|
||||
CreatedTs int64 `json:"createdTs"`
|
||||
UpdatedTs int64 `json:"updatedTs"`
|
||||
|
||||
Filename string `jsonapi:"attr,filename"`
|
||||
Blob []byte `jsonapi:"attr,blob"`
|
||||
Type string `jsonapi:"attr,type"`
|
||||
Size int64 `jsonapi:"attr,size"`
|
||||
Filename string `json:"filename"`
|
||||
Blob []byte `json:"blob"`
|
||||
Type string `json:"type"`
|
||||
Size int64 `json:"size"`
|
||||
|
||||
CreatorId int `jsonapi:"attr,creatorId"`
|
||||
CreatorId int `json:"creatorId"`
|
||||
}
|
||||
|
||||
type ResourceCreate struct {
|
||||
Filename string `jsonapi:"attr,filename"`
|
||||
Blob []byte `jsonapi:"attr,blob"`
|
||||
Type string `jsonapi:"attr,type"`
|
||||
Size int64 `jsonapi:"attr,size"`
|
||||
Filename string `json:"filename"`
|
||||
Blob []byte `json:"blob"`
|
||||
Type string `json:"type"`
|
||||
Size int64 `json:"size"`
|
||||
|
||||
CreatorId int `jsonapi:"attr,creatorId"`
|
||||
CreatorId int
|
||||
}
|
||||
|
||||
type ResourceFind struct {
|
||||
Id *int
|
||||
CreatorId *int
|
||||
Filename *string
|
||||
Id *int `json:"id"`
|
||||
CreatorId *int `json:"creatorId"`
|
||||
Filename *string `json:"filename"`
|
||||
}
|
||||
|
||||
type ResourceDelete struct {
|
||||
|
@@ -1,13 +1,13 @@
|
||||
package api
|
||||
|
||||
type Shortcut struct {
|
||||
Id int `jsonapi:"primary,shortcut"`
|
||||
CreatedTs int64 `jsonapi:"attr,createdTs"`
|
||||
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
|
||||
Id int `json:"id"`
|
||||
CreatedTs int64 `json:"createdTs"`
|
||||
UpdatedTs int64 `json:"updatedTs"`
|
||||
|
||||
Title string `jsonapi:"attr,title"`
|
||||
Payload string `jsonapi:"attr,payload"`
|
||||
PinnedTs int64 `jsonapi:"attr,pinnedTs"`
|
||||
Title string `json:"title"`
|
||||
Payload string `json:"payload"`
|
||||
RowStatus string `json:"rowStatus"`
|
||||
CreatorId int
|
||||
}
|
||||
|
||||
@@ -16,18 +16,16 @@ type ShortcutCreate struct {
|
||||
CreatorId int
|
||||
|
||||
// Domain specific fields
|
||||
Title string `jsonapi:"attr,title"`
|
||||
Payload string `jsonapi:"attr,payload"`
|
||||
Title string `json:"title"`
|
||||
Payload string `json:"payload"`
|
||||
}
|
||||
|
||||
type ShortcutPatch struct {
|
||||
Id int
|
||||
|
||||
Title *string `jsonapi:"attr,title"`
|
||||
Payload *string `jsonapi:"attr,payload"`
|
||||
PinnedTs *int64
|
||||
|
||||
Pinned *bool `jsonapi:"attr,pinned"`
|
||||
Title *string `json:"title"`
|
||||
Payload *string `json:"payload"`
|
||||
RowStatus *string `json:"rowStatus"`
|
||||
}
|
||||
|
||||
type ShortcutFind struct {
|
||||
@@ -37,7 +35,7 @@ type ShortcutFind struct {
|
||||
CreatorId *int
|
||||
|
||||
// Domain specific fields
|
||||
Title *string `jsonapi:"attr,title"`
|
||||
Title *string `json:"title"`
|
||||
}
|
||||
|
||||
type ShortcutDelete struct {
|
||||
|
34
api/user.go
34
api/user.go
@@ -1,19 +1,19 @@
|
||||
package api
|
||||
|
||||
type User struct {
|
||||
Id int `jsonapi:"primary,user"`
|
||||
CreatedTs int64 `jsonapi:"attr,createdTs"`
|
||||
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
|
||||
Id int `json:"id"`
|
||||
CreatedTs int64 `json:"createdTs"`
|
||||
UpdatedTs int64 `json:"updatedTs"`
|
||||
|
||||
OpenId string `jsonapi:"attr,openId"`
|
||||
Name string `jsonapi:"attr,name"`
|
||||
OpenId string `json:"openId"`
|
||||
Name string `json:"name"`
|
||||
Password string
|
||||
}
|
||||
|
||||
type UserCreate struct {
|
||||
OpenId string `jsonapi:"attr,openId"`
|
||||
Name string `jsonapi:"attr,name"`
|
||||
Password string `jsonapi:"attr,password"`
|
||||
OpenId string `json:"openId"`
|
||||
Name string `json:"name"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
type UserPatch struct {
|
||||
@@ -21,18 +21,26 @@ type UserPatch struct {
|
||||
|
||||
OpenId *string
|
||||
|
||||
Name *string `jsonapi:"attr,name"`
|
||||
Password *string `jsonapi:"attr,password"`
|
||||
ResetOpenId *bool `jsonapi:"attr,resetOpenId"`
|
||||
Name *string `json:"name"`
|
||||
Password *string `json:"password"`
|
||||
ResetOpenId *bool `json:"resetOpenId"`
|
||||
}
|
||||
|
||||
type UserFind struct {
|
||||
Id *int `jsonapi:"attr,id"`
|
||||
Id *int `json:"id"`
|
||||
|
||||
Name *string `jsonapi:"attr,name"`
|
||||
Name *string `json:"name"`
|
||||
OpenId *string
|
||||
}
|
||||
|
||||
type UserRenameCheck struct {
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type UserPasswordCheck struct {
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
type UserService interface {
|
||||
CreateUser(create *UserCreate) (*User, error)
|
||||
PatchUser(patch *UserPatch) (*User, error)
|
||||
|
Reference in New Issue
Block a user