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
2cc5691e
Unverified
Commit
2cc5691e
authored
May 14, 2023
by
boojack
Committed by
GitHub
May 14, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update memo relation types (#1658)
parent
7726ed42
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
79 additions
and
63 deletions
+79
-63
build-artifacts.yml
.github/workflows/build-artifacts.yml
+51
-51
memo.go
api/memo.go
+4
-4
memo_relation.go
api/memo_relation.go
+5
-5
memo.go
server/memo.go
+2
-2
memo_relation_test.go
test/server/memo_relation_test.go
+1
-1
index.tsx
web/src/components/MemoEditor/index.tsx
+1
-0
memo.d.ts
web/src/types/modules/memo.d.ts
+3
-0
memoRelation.d.ts
web/src/types/modules/memoRelation.d.ts
+12
-0
No files found.
.github/workflows/build-artifacts.yml
View file @
2cc5691e
...
...
@@ -24,63 +24,63 @@ jobs:
CGO_ENABLED
:
1
steps
:
-
name
:
Checkout repository
uses
:
actions/checkout@v2
-
name
:
Checkout repository
uses
:
actions/checkout@v2
-
name
:
Clone Memos
run
:
git clone https://github.com/usememos/memos.git
-
name
:
Clone Memos
run
:
git clone https://github.com/usememos/memos.git
-
name
:
Setup Node.js
uses
:
actions/setup-node@v2
with
:
node-version
:
'
18.12.1'
-
name
:
Setup Node.js
uses
:
actions/setup-node@v2
with
:
node-version
:
"
18"
-
name
:
Build frontend (Windows)
if
:
matrix.os == 'windows-latest'
shell
:
pwsh
run
:
|
cd memos/web
npm install -g pnpm
pnpm i --frozen-lockfile
pnpm build
Remove-Item -Path ../server/dist -Recurse -Force
mv dist ../server/
-
name
:
Build frontend (Windows)
if
:
matrix.os == 'windows-latest'
shell
:
pwsh
run
:
|
cd memos/web
npm install -g pnpm
pnpm i --frozen-lockfile
pnpm build
Remove-Item -Path ../server/dist -Recurse -Force
mv dist ../server/
-
name
:
Build frontend (non-Windows)
if
:
matrix.os != 'windows-latest'
run
:
|
cd memos/web
npm install -g pnpm
pnpm i --frozen-lockfile
pnpm build
rm -rf ../server/dist
mv dist ../server/
-
name
:
Build frontend (non-Windows)
if
:
matrix.os != 'windows-latest'
run
:
|
cd memos/web
npm install -g pnpm
pnpm i --frozen-lockfile
pnpm build
rm -rf ../server/dist
mv dist ../server/
-
name
:
Setup Go
uses
:
actions/setup-go@v2
with
:
go-version
:
'
1.19.3'
-
name
:
Setup Go
uses
:
actions/setup-go@v3
with
:
go-version
:
1.19
-
name
:
Install mingw-w64 (Windows)
if
:
matrix.os == 'windows-latest'
run
:
|
choco install mingw
echo ${{ matrix.cgo_env }} >> $GITHUB_ENV
-
name
:
Install mingw-w64 (Windows)
if
:
matrix.os == 'windows-latest'
run
:
|
choco install mingw
echo ${{ matrix.cgo_env }} >> $GITHUB_ENV
-
name
:
Install gcc-aarch64-linux-gnu (Ubuntu ARM64)
if
:
matrix.os == 'ubuntu-latest' && matrix.goarch == 'arm64'
run
:
|
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
-
name
:
Install gcc-aarch64-linux-gnu (Ubuntu ARM64)
if
:
matrix.os == 'ubuntu-latest' && matrix.goarch == 'arm64'
run
:
|
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
-
name
:
Build backend
run
:
|
cd memos
go build -o memos-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.os == 'windows-latest' && '.exe' || '' }} ./main.go
-
name
:
Build backend
run
:
|
cd memos
go build -o memos-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.os == 'windows-latest' && '.exe' || '' }} ./main.go
-
name
:
Upload artifacts
uses
:
actions/upload-artifact@v2
with
:
name
:
memos-binary-${{ matrix.os }}-${{ matrix.goarch }}
path
:
memos/memos-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.os == 'windows-latest' && '.exe' || '' }}
-
name
:
Upload artifacts
uses
:
actions/upload-artifact@v2
with
:
name
:
memos-binary-${{ matrix.os }}-${{ matrix.goarch }}
path
:
memos/memos-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.os == 'windows-latest' && '.exe' || '' }}
api/memo.go
View file @
2cc5691e
...
...
@@ -57,8 +57,8 @@ type MemoCreate struct {
Content
string
`json:"content"`
// Related fields
ResourceIDList
[]
int
`json:"resourceIdList"`
MemoRelationList
[]
*
MemoRelationUpsert
`json:"memoR
elationList"`
ResourceIDList
[]
int
`json:"resourceIdList"`
RelationList
[]
*
MemoRelationUpsert
`json:"r
elationList"`
}
type
MemoPatch
struct
{
...
...
@@ -74,8 +74,8 @@ type MemoPatch struct {
Visibility
*
Visibility
`json:"visibility"`
// Related fields
ResourceIDList
[]
int
`json:"resourceIdList"`
MemoRelationList
[]
*
MemoRelationUpsert
`json:"memoR
elationList"`
ResourceIDList
[]
int
`json:"resourceIdList"`
RelationList
[]
*
MemoRelationUpsert
`json:"r
elationList"`
}
type
MemoFind
struct
{
...
...
api/memo_relation.go
View file @
2cc5691e
...
...
@@ -8,12 +8,12 @@ const (
)
type
MemoRelation
struct
{
MemoID
int
RelatedMemoID
int
Type
MemoRelationType
MemoID
int
`json:"memoId"`
RelatedMemoID
int
`json:"relatedMemoId"`
Type
MemoRelationType
`json:"type"`
}
type
MemoRelationUpsert
struct
{
RelatedMemoID
int
Type
MemoRelationType
RelatedMemoID
int
`json:"relatedMemoId"`
Type
MemoRelationType
`json:"type"`
}
server/memo.go
View file @
2cc5691e
...
...
@@ -103,7 +103,7 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
}
if
s
.
Profile
.
IsDev
()
{
for
_
,
memoRelationUpsert
:=
range
memoCreate
.
Memo
RelationList
{
for
_
,
memoRelationUpsert
:=
range
memoCreate
.
RelationList
{
if
_
,
err
:=
s
.
Store
.
UpsertMemoRelation
(
ctx
,
&
store
.
MemoRelationMessage
{
MemoID
:
memo
.
ID
,
RelatedMemoID
:
memoRelationUpsert
.
RelatedMemoID
,
...
...
@@ -171,7 +171,7 @@ func (s *Server) registerMemoRoutes(g *echo.Group) {
}
if
s
.
Profile
.
IsDev
()
{
for
_
,
memoRelationUpsert
:=
range
memoPatch
.
Memo
RelationList
{
for
_
,
memoRelationUpsert
:=
range
memoPatch
.
RelationList
{
if
_
,
err
:=
s
.
Store
.
UpsertMemoRelation
(
ctx
,
&
store
.
MemoRelationMessage
{
MemoID
:
memo
.
ID
,
RelatedMemoID
:
memoRelationUpsert
.
RelatedMemoID
,
...
...
test/server/memo_relation_test.go
View file @
2cc5691e
...
...
@@ -35,7 +35,7 @@ func TestMemoRelationServer(t *testing.T) {
require
.
Equal
(
t
,
"test memo"
,
memo
.
Content
)
memo2
,
err
:=
s
.
postMemoCreate
(
&
api
.
MemoCreate
{
Content
:
"test memo2"
,
Memo
RelationList
:
[]
*
api
.
MemoRelationUpsert
{
RelationList
:
[]
*
api
.
MemoRelationUpsert
{
{
RelatedMemoID
:
memo
.
ID
,
Type
:
api
.
MemoRelationReference
,
...
...
web/src/components/MemoEditor/index.tsx
View file @
2cc5691e
...
...
@@ -240,6 +240,7 @@ const MemoEditor = () => {
content
,
visibility
:
editorState
.
memoVisibility
,
resourceIdList
:
editorState
.
resourceList
.
map
((
resource
)
=>
resource
.
id
),
relationList
:
[],
});
filterStore
.
clearFilter
();
}
...
...
web/src/types/modules/memo.d.ts
View file @
2cc5691e
...
...
@@ -16,11 +16,13 @@ interface Memo {
creatorName
:
string
;
resourceList
:
Resource
[];
relationList
:
MemoRelation
[];
}
interface
MemoCreate
{
content
:
string
;
resourceIdList
:
ResourceId
[];
relationList
:
MemoRelationUpsert
[];
visibility
?:
Visibility
;
}
...
...
@@ -30,6 +32,7 @@ interface MemoPatch {
rowStatus
?:
RowStatus
;
content
?:
string
;
resourceIdList
?:
ResourceId
[];
relationList
?:
MemoRelationUpsert
[];
visibility
?:
Visibility
;
}
...
...
web/src/types/modules/memoRelation.d.ts
0 → 100644
View file @
2cc5691e
type
MemoRelationType
=
"REFERENCE"
|
"ADDITIONAL"
;
interface
MemoRelation
{
memoId
:
MemoId
;
relatedMemoId
:
MemoId
;
type
:
MemoRelationType
;
}
interface
MemoRelationUpsert
{
relatedMemoId
:
MemoId
;
type
:
MemoRelationType
;
}
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