mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
update: seed data
This commit is contained in:
14
api/memo.go
14
api/memo.go
@ -2,30 +2,40 @@ package api
|
|||||||
|
|
||||||
type Memo struct {
|
type Memo struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id"`
|
||||||
|
|
||||||
|
// Standard fields
|
||||||
CreatedTs int64 `json:"createdTs"`
|
CreatedTs int64 `json:"createdTs"`
|
||||||
UpdatedTs int64 `json:"updatedTs"`
|
UpdatedTs int64 `json:"updatedTs"`
|
||||||
RowStatus string `json:"rowStatus"`
|
RowStatus string `json:"rowStatus"`
|
||||||
|
|
||||||
|
// Domain specific fields
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
CreatorID int `json:"creatorId"`
|
CreatorID int `json:"creatorId"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MemoCreate struct {
|
type MemoCreate struct {
|
||||||
|
// Standard fields
|
||||||
CreatorID int
|
CreatorID int
|
||||||
|
|
||||||
|
// Domain specific fields
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MemoPatch struct {
|
type MemoPatch struct {
|
||||||
ID int
|
ID int
|
||||||
|
|
||||||
Content *string `json:"content"`
|
// Standard fields
|
||||||
RowStatus *string `json:"rowStatus"`
|
|
||||||
CreatedTs *int64 `json:"createdTs"`
|
CreatedTs *int64 `json:"createdTs"`
|
||||||
|
RowStatus *string `json:"rowStatus"`
|
||||||
|
|
||||||
|
// Domain specific fields
|
||||||
|
Content *string `json:"content"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MemoFind struct {
|
type MemoFind struct {
|
||||||
ID *int `json:"id"`
|
ID *int `json:"id"`
|
||||||
|
|
||||||
|
// Standard fields
|
||||||
CreatorID *int `json:"creatorId"`
|
CreatorID *int `json:"creatorId"`
|
||||||
RowStatus *string `json:"rowStatus"`
|
RowStatus *string `json:"rowStatus"`
|
||||||
}
|
}
|
||||||
|
@ -2,29 +2,37 @@ package api
|
|||||||
|
|
||||||
type Resource struct {
|
type Resource struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id"`
|
||||||
|
|
||||||
|
// Standard fields
|
||||||
|
CreatorID int `json:"creatorId"`
|
||||||
CreatedTs int64 `json:"createdTs"`
|
CreatedTs int64 `json:"createdTs"`
|
||||||
UpdatedTs int64 `json:"updatedTs"`
|
UpdatedTs int64 `json:"updatedTs"`
|
||||||
|
|
||||||
|
// Domain specific fields
|
||||||
Filename string `json:"filename"`
|
Filename string `json:"filename"`
|
||||||
Blob []byte `json:"blob"`
|
Blob []byte `json:"blob"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
Size int64 `json:"size"`
|
Size int64 `json:"size"`
|
||||||
|
|
||||||
CreatorID int `json:"creatorId"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResourceCreate struct {
|
type ResourceCreate struct {
|
||||||
|
// Standard fields
|
||||||
|
CreatorID int
|
||||||
|
|
||||||
|
// Domain specific fields
|
||||||
Filename string `json:"filename"`
|
Filename string `json:"filename"`
|
||||||
Blob []byte `json:"blob"`
|
Blob []byte `json:"blob"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
Size int64 `json:"size"`
|
Size int64 `json:"size"`
|
||||||
|
|
||||||
CreatorID int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResourceFind struct {
|
type ResourceFind struct {
|
||||||
ID *int `json:"id"`
|
ID *int `json:"id"`
|
||||||
|
|
||||||
|
// Standard fields
|
||||||
CreatorID *int `json:"creatorId"`
|
CreatorID *int `json:"creatorId"`
|
||||||
|
|
||||||
|
// Domain specific fields
|
||||||
Filename *string `json:"filename"`
|
Filename *string `json:"filename"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,13 +2,16 @@ package api
|
|||||||
|
|
||||||
type Shortcut struct {
|
type Shortcut struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id"`
|
||||||
|
|
||||||
|
// Standard fields
|
||||||
|
CreatorID int
|
||||||
CreatedTs int64 `json:"createdTs"`
|
CreatedTs int64 `json:"createdTs"`
|
||||||
UpdatedTs int64 `json:"updatedTs"`
|
UpdatedTs int64 `json:"updatedTs"`
|
||||||
|
RowStatus string `json:"rowStatus"`
|
||||||
|
|
||||||
|
// Domain specific fields
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
Payload string `json:"payload"`
|
Payload string `json:"payload"`
|
||||||
RowStatus string `json:"rowStatus"`
|
|
||||||
CreatorID int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ShortcutCreate struct {
|
type ShortcutCreate struct {
|
||||||
@ -23,9 +26,12 @@ type ShortcutCreate struct {
|
|||||||
type ShortcutPatch struct {
|
type ShortcutPatch struct {
|
||||||
ID int
|
ID int
|
||||||
|
|
||||||
|
// Standard fields
|
||||||
|
RowStatus *string `json:"rowStatus"`
|
||||||
|
|
||||||
|
// Domain specific fields
|
||||||
Title *string `json:"title"`
|
Title *string `json:"title"`
|
||||||
Payload *string `json:"payload"`
|
Payload *string `json:"payload"`
|
||||||
RowStatus *string `json:"rowStatus"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ShortcutFind struct {
|
type ShortcutFind struct {
|
||||||
|
@ -2,15 +2,19 @@ package api
|
|||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id"`
|
||||||
|
|
||||||
|
// Standard fields
|
||||||
CreatedTs int64 `json:"createdTs"`
|
CreatedTs int64 `json:"createdTs"`
|
||||||
UpdatedTs int64 `json:"updatedTs"`
|
UpdatedTs int64 `json:"updatedTs"`
|
||||||
|
|
||||||
|
// Domain specific fields
|
||||||
OpenID string `json:"openId"`
|
OpenID string `json:"openId"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
PasswordHash string `json:"-"`
|
PasswordHash string `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserCreate struct {
|
type UserCreate struct {
|
||||||
|
// Domain specific fields
|
||||||
OpenID string
|
OpenID string
|
||||||
Name string
|
Name string
|
||||||
PasswordHash string
|
PasswordHash string
|
||||||
@ -19,9 +23,9 @@ type UserCreate struct {
|
|||||||
type UserPatch struct {
|
type UserPatch struct {
|
||||||
ID int
|
ID int
|
||||||
|
|
||||||
|
// Domain specific fields
|
||||||
OpenID *string
|
OpenID *string
|
||||||
PasswordHash *string
|
PasswordHash *string
|
||||||
|
|
||||||
Name *string `json:"name"`
|
Name *string `json:"name"`
|
||||||
Password *string `json:"password"`
|
Password *string `json:"password"`
|
||||||
ResetOpenID *bool `json:"resetOpenId"`
|
ResetOpenID *bool `json:"resetOpenId"`
|
||||||
@ -30,6 +34,7 @@ type UserPatch struct {
|
|||||||
type UserFind struct {
|
type UserFind struct {
|
||||||
ID *int `json:"id"`
|
ID *int `json:"id"`
|
||||||
|
|
||||||
|
// Domain specific fields
|
||||||
Name *string `json:"name"`
|
Name *string `json:"name"`
|
||||||
OpenID *string
|
OpenID *string
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ CREATE TABLE shortcut (
|
|||||||
updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),
|
updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),
|
||||||
|
|
||||||
title TEXT NOT NULL DEFAULT '',
|
title TEXT NOT NULL DEFAULT '',
|
||||||
payload TEXT NOT NULL DEFAULT '',
|
payload TEXT NOT NULL DEFAULT '{}',
|
||||||
creator_id INTEGER NOT NULL,
|
creator_id INTEGER NOT NULL,
|
||||||
-- allowed row status are 'NORMAL', 'ARCHIVED'.
|
-- allowed row status are 'NORMAL', 'ARCHIVED'.
|
||||||
row_status TEXT NOT NULL DEFAULT 'NORMAL',
|
row_status TEXT NOT NULL DEFAULT 'NORMAL',
|
||||||
|
@ -13,3 +13,19 @@ VALUES
|
|||||||
-- "secret"
|
-- "secret"
|
||||||
'$2a$14$ajq8Q7fbtFRQvXpdCq7Jcuy.Rx1h/L4J60Otx.gyNLbAYctGMJ9tK'
|
'$2a$14$ajq8Q7fbtFRQvXpdCq7Jcuy.Rx1h/L4J60Otx.gyNLbAYctGMJ9tK'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
INSERT INTO
|
||||||
|
user (
|
||||||
|
`id`,
|
||||||
|
`name`,
|
||||||
|
`open_id`,
|
||||||
|
`password_hash`
|
||||||
|
)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
102,
|
||||||
|
'dear_musk',
|
||||||
|
'guest_open_id',
|
||||||
|
-- "secret"
|
||||||
|
'$2a$14$ajq8Q7fbtFRQvXpdCq7Jcuy.Rx1h/L4J60Otx.gyNLbAYctGMJ9tK'
|
||||||
|
);
|
||||||
|
10
store/seed/10002__shortcut.sql
Normal file
10
store/seed/10002__shortcut.sql
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
INSERT INTO
|
||||||
|
shortcut (
|
||||||
|
`title`,
|
||||||
|
`creator_id`
|
||||||
|
)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
'All my memos',
|
||||||
|
101
|
||||||
|
);
|
Reference in New Issue
Block a user