(ctx context.Context, userID bson.ObjectID, projectID string, cost float64, success bool, now time.Time)
| 164 | } |
| 165 | |
| 166 | func (s *UsageService) trackHourlyUsage(ctx context.Context, userID bson.ObjectID, projectID string, cost float64, success bool, now time.Time) error { |
| 167 | filter := bson.M{ |
| 168 | "user_id": userID, |
| 169 | "project_id": projectID, |
| 170 | "hour_bucket": bson.NewDateTimeFromTime(models.TruncateToHour(now)), |
| 171 | } |
| 172 | return s.upsertUsage(ctx, s.hourlyCollection, filter, cost, success, now) |
| 173 | } |
| 174 | |
| 175 | func (s *UsageService) trackWeeklyUsage(ctx context.Context, userID bson.ObjectID, projectID string, cost float64, success bool, now time.Time) error { |
| 176 | filter := bson.M{ |
no test coverage detected