Skip to content

Commit

Permalink
fix: use correct on-to-many relation uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
linehk committed Mar 7, 2024
1 parent 820fafa commit ca53e00
Show file tree
Hide file tree
Showing 31 changed files with 104 additions and 584 deletions.
4 changes: 2 additions & 2 deletions service/blog/rpc/internal/logic/get_blog_user_infos_logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (l *GetBlogUserInfosLogic) GetBlogUserInfos(in *blog.GetBlogUserInfosReq) (
convert.Copy(&blogUserInfos.Blog, blogResp)
convert.Copy(&blogUserInfos.BlogUserInfo, blogUserInfoModel)
blogUserInfos.BlogUserInfo.Kind = "blogger#blogPerUserInfo"
blogUserInfos.BlogUserInfo.UserId = blogUserInfoModel.UserUuid
blogUserInfos.BlogUserInfo.BlogId = blogUserInfoModel.BlogUuid
blogUserInfos.BlogUserInfo.UserId = blogUserInfoModel.UserUuid.String
blogUserInfos.BlogUserInfo.BlogId = blogUserInfoModel.BlogUuid.String
return &blogUserInfos, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestGetBlogUserInfos(t *testing.T) {
blogModel := &model.Blog{
Id: 1,
Uuid: blogId,
AppUserUuid: userId,
AppUserUuid: sql.NullString{String: userId, Valid: true},
Name: sql.NullString{String: name, Valid: true},
Description: sql.NullString{String: description, Valid: true},
Published: sql.NullTime{Time: published, Valid: true},
Expand Down Expand Up @@ -93,15 +93,15 @@ func TestGetBlogUserInfos(t *testing.T) {
SelfLink: pageSelfLink2,
}},
}

blogUserInfoUuid := uuid.NewString()
photosAlbumKey := "PhotosAlbumKey"
hasAdminAccess := true
userBlogInfoModel := &model.BlogUserInfo{
Id: 1,
Uuid: blogUserInfoUuid,
UserUuid: userId,
BlogUuid: blogId,
UserUuid: sql.NullString{String: userId, Valid: true},
BlogUuid: sql.NullString{String: blogId, Valid: true},
PhotosAlbumKey: sql.NullString{String: photosAlbumKey, Valid: true},
HasAdminAccess: sql.NullBool{Bool: hasAdminAccess, Valid: true},
}
Expand Down
2 changes: 1 addition & 1 deletion service/blog/rpc/internal/test/get_by_url_logic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestGetByUrl(t *testing.T) {
blogModel := &model.Blog{
Id: 1,
Uuid: blogId,
AppUserUuid: userId,
AppUserUuid: sql.NullString{String: userId, Valid: true},
Name: sql.NullString{String: name, Valid: true},
Description: sql.NullString{String: description, Valid: true},
Published: sql.NullTime{Time: published, Valid: true},
Expand Down
2 changes: 1 addition & 1 deletion service/blog/rpc/internal/test/get_logic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestGet(t *testing.T) {
blogModel := &model.Blog{
Id: 1,
Uuid: blogId,
AppUserUuid: userId,
AppUserUuid: sql.NullString{String: userId, Valid: true},
Name: sql.NullString{String: name, Valid: true},
Description: sql.NullString{String: description, Valid: true},
Published: sql.NullTime{Time: published, Valid: true},
Expand Down
4 changes: 2 additions & 2 deletions service/blog/rpc/internal/test/list_by_user_logic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestListByUser(t *testing.T) {
{
Id: 1,
Uuid: blogId1,
AppUserUuid: userId,
AppUserUuid: sql.NullString{String: userId, Valid: true},
Name: sql.NullString{String: name, Valid: true},
Description: sql.NullString{String: description, Valid: true},
Published: sql.NullTime{Time: published, Valid: true},
Expand All @@ -62,7 +62,7 @@ func TestListByUser(t *testing.T) {
{
Id: 2,
Uuid: blogId2,
AppUserUuid: userId,
AppUserUuid: sql.NullString{String: userId, Valid: true},
Name: sql.NullString{String: name, Valid: true},
Description: sql.NullString{String: description, Valid: true},
Published: sql.NullTime{Time: published, Valid: true},
Expand Down
6 changes: 3 additions & 3 deletions service/blog/rpc/model/blog.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CREATE TABLE blog (
id SERIAL PRIMARY KEY,
uuid VARCHAR UNIQUE NOT NULL,
app_user_uuid VARCHAR UNIQUE NOT NULL,
app_user_uuid VARCHAR,
name VARCHAR,
description VARCHAR,
published TIMESTAMP,
Expand All @@ -14,8 +14,8 @@ CREATE TABLE blog (
CREATE TABLE blog_user_info (
id SERIAL PRIMARY KEY,
uuid VARCHAR UNIQUE NOT NULL,
user_uuid VARCHAR UNIQUE NOT NULL,
blog_uuid VARCHAR UNIQUE NOT NULL,
user_uuid VARCHAR,
blog_uuid VARCHAR,
photos_album_key VARCHAR,
has_admin_access BOOLEAN
);
Expand Down
37 changes: 6 additions & 31 deletions service/blog/rpc/model/blog_model_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 7 additions & 57 deletions service/blog/rpc/model/blog_user_info_model_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 0 additions & 15 deletions service/blog/rpc/model/mock_blog_model.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 0 additions & 30 deletions service/blog/rpc/model/mock_blog_user_info_model.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions service/comment/rpc/model/comment.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
CREATE TABLE comment (
id SERIAL PRIMARY KEY,
uuid VARCHAR UNIQUE NOT NULL,
blog_uuid VARCHAR UNIQUE NOT NULL,
post_uuid VARCHAR UNIQUE NOT NULL,
blog_uuid VARCHAR,
post_uuid VARCHAR,
status VARCHAR,
published TIMESTAMP,
updated TIMESTAMP,
Expand Down
Loading

0 comments on commit ca53e00

Please sign in to comment.