update: seed data

pull/49/head
boojack 3 years ago
parent a9a888ef54
commit b1adaf9c4e

@ -1,31 +1,41 @@
package api 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"`
} }

@ -1,31 +1,39 @@
package api 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"`
CreatorID *int `json:"creatorId"`
Filename *string `json:"filename"` // Standard fields
CreatorID *int `json:"creatorId"`
// Domain specific fields
Filename *string `json:"filename"`
} }
type ResourceDelete struct { type ResourceDelete struct {

@ -1,14 +1,17 @@
package api package api
type Shortcut struct { type Shortcut struct {
ID int `json:"id"` ID int `json:"id"`
CreatedTs int64 `json:"createdTs"`
UpdatedTs int64 `json:"updatedTs"`
Title string `json:"title"` // Standard fields
Payload string `json:"payload"`
RowStatus string `json:"rowStatus"`
CreatorID int CreatorID int
CreatedTs int64 `json:"createdTs"`
UpdatedTs int64 `json:"updatedTs"`
RowStatus string `json:"rowStatus"`
// Domain specific fields
Title string `json:"title"`
Payload string `json:"payload"`
} }
type ShortcutCreate struct { type ShortcutCreate struct {
@ -23,9 +26,12 @@ type ShortcutCreate struct {
type ShortcutPatch struct { type ShortcutPatch struct {
ID int ID int
Title *string `json:"title"` // Standard fields
Payload *string `json:"payload"`
RowStatus *string `json:"rowStatus"` RowStatus *string `json:"rowStatus"`
// Domain specific fields
Title *string `json:"title"`
Payload *string `json:"payload"`
} }
type ShortcutFind struct { type ShortcutFind struct {

@ -1,16 +1,20 @@
package api 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,17 +23,18 @@ 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"`
} }
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'
);

@ -0,0 +1,10 @@
INSERT INTO
shortcut (
`title`,
`creator_id`
)
VALUES
(
'All my memos',
101
);
Loading…
Cancel
Save