Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
b1adaf9c
Commit
b1adaf9c
authored
May 03, 2022
by
boojack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: seed data
parent
a9a888ef
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
81 additions
and
26 deletions
+81
-26
memo.go
api/memo.go
+14
-4
resource.go
api/resource.go
+16
-8
shortcut.go
api/shortcut.go
+14
-8
user.go
api/user.go
+10
-5
10001__schema.sql
store/migration/10001__schema.sql
+1
-1
10001__user.sql
store/seed/10001__user.sql
+16
-0
10002__shortcut.sql
store/seed/10002__shortcut.sql
+10
-0
No files found.
api/memo.go
View file @
b1adaf9c
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"`
}
}
...
...
api/resource.go
View file @
b1adaf9c
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
{
...
...
api/shortcut.go
View file @
b1adaf9c
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 {
...
@@ -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
{
...
...
api/user.go
View file @
b1adaf9c
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 {
...
@@ -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
}
}
...
...
store/migration/10001__schema.sql
View file @
b1adaf9c
...
@@ -62,7 +62,7 @@ CREATE TABLE shortcut (
...
@@ -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'
,
...
...
store/seed/10001__user.sql
View file @
b1adaf9c
...
@@ -13,3 +13,19 @@ VALUES
...
@@ -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'
);
store/seed/10002__shortcut.sql
0 → 100644
View file @
b1adaf9c
INSERT
INTO
shortcut
(
`title`
,
`creator_id`
)
VALUES
(
'All my memos'
,
101
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment