mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-08-02 09:49:13 +02:00
feat:#36 added real ip for proxy, extended error logging
This commit is contained in:
@@ -18,8 +18,12 @@ type ModulesGrpcHandler struct {
|
||||
|
||||
func (s *ModulesGrpcHandler) GetModule(ctx context.Context, in *pb.GetModuleRequest) (*pb.GetModuleResponse, error) {
|
||||
|
||||
// get module from database by UUID
|
||||
s.app.Logger().Info(
|
||||
"Protobuf - GetModule",
|
||||
"uuid", in.Uuid,
|
||||
)
|
||||
|
||||
// get module from database by UUID
|
||||
module, err := db.FindModuleByUUID(s.app, in.Uuid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -35,7 +39,6 @@ func (s *ModulesGrpcHandler) GetModule(ctx context.Context, in *pb.GetModuleRequ
|
||||
for _, event := range events {
|
||||
protoEvents = append(protoEvents, eventToProto(&event))
|
||||
}
|
||||
|
||||
//map module to proto struct
|
||||
protoModule := &pb.Module{
|
||||
Uuid: module.UUID,
|
||||
@@ -45,7 +48,6 @@ func (s *ModulesGrpcHandler) GetModule(ctx context.Context, in *pb.GetModuleRequ
|
||||
Semester: module.Semester,
|
||||
Events: protoEvents,
|
||||
}
|
||||
|
||||
// Implement your logic here to fetch module data based on the UUID
|
||||
// Example response
|
||||
return &pb.GetModuleResponse{
|
||||
@@ -70,6 +72,11 @@ func StartGRPCServer(app *pocketbase.PocketBase) {
|
||||
|
||||
func (s *ModulesGrpcHandler) GetEventsForModules(ctx context.Context, in *pb.GetModulesRequest) (*pb.GetEventsResponse, error) {
|
||||
|
||||
s.app.Logger().Info(
|
||||
"Protobuf - GetEventsForModules",
|
||||
"uuids", in.Uuids,
|
||||
)
|
||||
|
||||
events, err := db.GetPlanForModules(s.app, in.Uuids)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user