Skip to content

Commit

Permalink
fix: avatar and groups_bill route
Browse files Browse the repository at this point in the history
  • Loading branch information
brian030128 committed Jun 24, 2024
1 parent a89dac0 commit cff6b36
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 15 deletions.
3 changes: 2 additions & 1 deletion migrations/2406210105_default_avatar.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ INSERT INTO confirmed_file(
confirmed_at
) VALUES (
'00000000-0000-0000-0000-000000000000',
'/default_avatar.png',
'default_avatar.png',
1,
'00000000-0000-0000-0000-000000000000',
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP
);


ALTER TABLE user_identity ADD COLUMN avatar_id uuid DEFAULT '00000000-0000-0000-0000-000000000000' NOT NULL;
16 changes: 8 additions & 8 deletions protobuf/gen/go/group_bill.pb.go

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

6 changes: 3 additions & 3 deletions protobuf/gen/go/group_bill.pb.gw.go

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

2 changes: 1 addition & 1 deletion protobuf/gen/monify.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@
]
}
},
"/v1/group_bill/history": {
"/v1/groups_bill/history": {
"get": {
"operationId": "GroupsBillService_GetHistory",
"responses": {
Expand Down
2 changes: 1 addition & 1 deletion protobuf/group_bill.proto
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ service GroupsBillService{
rpc GetHistory(GetHistoryRequest) returns (GetHistoryResponse) {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) ={security: {security_requirement: {key: "Bearer"}}};
option (google.api.http) = {
get: "/v1/group_bill/history"
get: "/v1/groups_bill/history"
};
}
}
Expand Down
6 changes: 5 additions & 1 deletion services/api/controllers/group_bill/get_history.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import (
"go.uber.org/zap"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"
"monify/lib"
monify "monify/protobuf/gen/go"
"monify/services/api/controllers/group"
"time"
)

func (s Service) GetHistory(ctx context.Context, req *monify.GetHistoryRequest) (*monify.GetHistoryResponse, error) {
Expand Down Expand Up @@ -48,10 +50,12 @@ func (s Service) GetHistory(ctx context.Context, req *monify.GetHistoryRequest)
var histories []*monify.GroupBillHistory
for rows.Next() {
var history monify.GroupBillHistory
if err := rows.Scan(&history.Type, &history.Title, &history.Timestamp, &history.OperatorName); err != nil {
var t time.Time
if err := rows.Scan(&history.Type, &history.Title, &history.OperatorName, &t); err != nil {
logger.Error("Failed to scan group bill history", zap.Error(err))
return nil, status.Error(codes.Internal, "Internal")
}
history.Timestamp = timestamppb.New(t)
histories = append(histories, &history)
}
return &monify.GetHistoryResponse{Histories: histories}, nil
Expand Down

0 comments on commit cff6b36

Please sign in to comment.