Remove fmt.Prinln and add Zerolog logging system
All checks were successful
Build and Push Docker Image / build_and_push (push) Successful in 1m51s
All checks were successful
Build and Push Docker Image / build_and_push (push) Successful in 1m51s
This commit is contained in:
@@ -2,9 +2,9 @@ package grpcapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"git.coopgo.io/coopgo-platform/agenda/storage"
|
||||
"github.com/rs/zerolog/log"
|
||||
"google.golang.org/protobuf/encoding/protojson"
|
||||
"google.golang.org/protobuf/types/known/structpb"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
@@ -12,23 +12,23 @@ import (
|
||||
|
||||
func (e Event) ToStorageType() storage.Event {
|
||||
event := storage.Event{
|
||||
ID: e.Id,
|
||||
Namespace: e.Namespace,
|
||||
Owners: e.Owners,
|
||||
RestrictedTo: e.RestrictedTo,
|
||||
Type: e.Type,
|
||||
Name: e.Name,
|
||||
Description: e.Description,
|
||||
Startdate: e.Startdate.AsTime(),
|
||||
Enddate: e.Enddate.AsTime(),
|
||||
Starttime: e.Starttime,
|
||||
Endtime: e.Endtime,
|
||||
Allday: e.Allday,
|
||||
MaxSubscribers: e.MaxSubscribers,
|
||||
Subscriptions: []storage.Subscription{},
|
||||
ID: e.Id,
|
||||
Namespace: e.Namespace,
|
||||
Owners: e.Owners,
|
||||
RestrictedTo: e.RestrictedTo,
|
||||
Type: e.Type,
|
||||
Name: e.Name,
|
||||
Description: e.Description,
|
||||
Startdate: e.Startdate.AsTime(),
|
||||
Enddate: e.Enddate.AsTime(),
|
||||
Starttime: e.Starttime,
|
||||
Endtime: e.Endtime,
|
||||
Allday: e.Allday,
|
||||
MaxSubscribers: e.MaxSubscribers,
|
||||
Subscriptions: []storage.Subscription{},
|
||||
DeletedSubscription: []storage.Subscription{},
|
||||
Data: map[string]any{},
|
||||
Deleted: e.Deleted,
|
||||
Data: map[string]any{},
|
||||
Deleted: e.Deleted,
|
||||
}
|
||||
|
||||
for _, v := range e.Subscriptions {
|
||||
@@ -42,7 +42,7 @@ func (e Event) ToStorageType() storage.Event {
|
||||
for k, d := range e.Data.GetFields() {
|
||||
jsondata, err := protojson.Marshal(d)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
log.Error().Err(err).Msg("")
|
||||
break
|
||||
}
|
||||
var data any
|
||||
@@ -73,7 +73,7 @@ func EventFromStorageType(event *storage.Event) (*Event, error) {
|
||||
|
||||
data, err := structpb.NewStruct(d)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
log.Error().Err(err).Msg("")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -91,23 +91,23 @@ func EventFromStorageType(event *storage.Event) (*Event, error) {
|
||||
}
|
||||
|
||||
return &Event{
|
||||
Id: event.ID,
|
||||
Namespace: event.Namespace,
|
||||
Type: event.Type,
|
||||
Owners: event.Owners,
|
||||
RestrictedTo: event.RestrictedTo,
|
||||
Name: event.Name,
|
||||
Description: event.Description,
|
||||
Startdate: timestamppb.New(event.Startdate),
|
||||
Enddate: timestamppb.New(event.Enddate),
|
||||
Starttime: event.Starttime,
|
||||
Endtime: event.Endtime,
|
||||
Allday: event.Allday,
|
||||
MaxSubscribers: event.MaxSubscribers,
|
||||
Subscriptions: subscriptions,
|
||||
Id: event.ID,
|
||||
Namespace: event.Namespace,
|
||||
Type: event.Type,
|
||||
Owners: event.Owners,
|
||||
RestrictedTo: event.RestrictedTo,
|
||||
Name: event.Name,
|
||||
Description: event.Description,
|
||||
Startdate: timestamppb.New(event.Startdate),
|
||||
Enddate: timestamppb.New(event.Enddate),
|
||||
Starttime: event.Starttime,
|
||||
Endtime: event.Endtime,
|
||||
Allday: event.Allday,
|
||||
MaxSubscribers: event.MaxSubscribers,
|
||||
Subscriptions: subscriptions,
|
||||
DeletedSubscription: deletedsubscription,
|
||||
Data: data,
|
||||
Deleted: event.Deleted,
|
||||
Data: data,
|
||||
Deleted: event.Deleted,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ func SubscriptionFromStorageType(s storage.Subscription) (*Subscription, error)
|
||||
data, err := structpb.NewStruct(d)
|
||||
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
log.Error().Err(err).Msg("")
|
||||
return nil, err
|
||||
}
|
||||
subscription := Subscription{
|
||||
|
||||
Reference in New Issue
Block a user