add http server

This commit is contained in:
2024-08-10 02:15:00 +03:00
parent 6a2489a65c
commit ba6ac26bac
9 changed files with 380 additions and 14 deletions

View File

@ -69,17 +69,17 @@ func (s deviceStatsDB) asDomain() entities.DeviceStatistics {
}
}
func (r statsRepository) Upsert(ctx context.Context, id entities.DeviceID, stats entities.DeviceStatistics) error {
func (r statsRepository) Upsert(ctx context.Context, stats entities.DeviceStatistics) error {
opts := options.Update().SetUpsert(true)
filter := bson.D{
{
Key: "_id",
Value: id,
Value: stats.ID,
},
}
document := deviceStatsDB{
DeviceID: string(id),
DeviceID: string(stats.ID),
IncomingTraffic: stats.IncomingTrafficBytes,
OutgoinfTraffic: stats.OutgoingTrafficBytes,
IncomingRPS: stats.IncomingRPS,