Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zizdlp committed Aug 24, 2024
1 parent 0ebda8d commit da27d7d
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 160 deletions.
6 changes: 5 additions & 1 deletion zbook_backend/db/query/repo_relation.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ WHERE r.repo_id=$1 AND rr.relation_type = 'visi' AND (u.blocked='false' OR @role
-- name: QueryUserByRepo :many
SELECT
u.*,ts_rank(fts_username, plainto_tsquery(@query)) as rank,
CASE WHEN MAX(rr.user_id) IS NOT NULL THEN true ELSE false END AS is_visible
CASE
WHEN MAX(CASE WHEN rr.relation_type = 'visi' THEN rr.user_id END) IS NOT NULL
THEN true
ELSE false
END AS is_visible
FROM
users as u
LEFT JOIN
Expand Down
6 changes: 5 additions & 1 deletion zbook_backend/db/sqlc/repo_relation.sql.go

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

6 changes: 4 additions & 2 deletions zbook_backend/gapi/reporelation_delete_repo_visibility.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ func (server *Server) DeleteRepoVisibility(ctx context.Context, req *rpcs.Delete
UserID: user.UserID,
RelationType: util.RelationTypeVisi,
}
server.store.DeleteRepoRelation(ctx, arg)

err = server.store.DeleteRepoRelation(ctx, arg)
if err != nil {
return nil, status.Errorf(codes.Internal, "DeleteRepoRelation failed: %s", err)
}
rsp := &rpcs.DeleteRepoVisibilityResponse{}
return rsp, nil
}
Expand Down
Loading

0 comments on commit da27d7d

Please sign in to comment.