diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 05c9be3..f001504 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,10 +4,10 @@
-
+
+
-
-
+
@@ -154,7 +154,6 @@
-
@@ -179,7 +178,8 @@
-
+
+
true
diff --git a/pkg/internal/grpc/events.go b/pkg/internal/grpc/events.go
new file mode 100644
index 0000000..a9ca492
--- /dev/null
+++ b/pkg/internal/grpc/events.go
@@ -0,0 +1,20 @@
+package grpc
+
+import (
+ "context"
+ "git.solsynth.dev/hydrogen/dealer/pkg/proto"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/models"
+ "git.solsynth.dev/hydrogen/passport/pkg/internal/services"
+)
+
+func (v *Server) RecordEvent(ctx context.Context, request *proto.RecordEventRequest) (*proto.RecordEventResponse, error) {
+ var user models.Account
+ var err error
+ if user, err = services.GetAccount(uint(request.GetUserId())); err != nil {
+ return nil, err
+ }
+
+ services.AddEvent(user, request.GetAction(), request.GetTarget(), request.GetIp(), request.GetUserAgent())
+
+ return &proto.RecordEventResponse{IsSuccess: true}, nil
+}
diff --git a/pkg/internal/grpc/server.go b/pkg/internal/grpc/server.go
index f1509e1..40d3fe8 100644
--- a/pkg/internal/grpc/server.go
+++ b/pkg/internal/grpc/server.go
@@ -17,6 +17,7 @@ type Server struct {
proto.UnimplementedNotifierServer
proto.UnimplementedRealmServer
proto.UnimplementedStreamControllerServer
+ proto.UnimplementedEventRecorderServer
health.UnimplementedHealthServer
srv *grpc.Server
@@ -31,6 +32,7 @@ func NewServer() *Server {
proto.RegisterNotifierServer(server.srv, server)
proto.RegisterRealmServer(server.srv, server)
proto.RegisterStreamControllerServer(server.srv, server)
+ proto.RegisterEventRecorderServer(server.srv, server)
health.RegisterHealthServer(server.srv, server)
reflection.Register(server.srv)