(ctx context.Context, userID bson.ObjectID, projectID string, cost float64, success bool, now time.Time)
| 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{ |
| 177 | "user_id": userID, |
| 178 | "project_id": projectID, |
| 179 | "week_bucket": bson.NewDateTimeFromTime(models.TruncateToWeek(now)), |
| 180 | } |
| 181 | return s.upsertUsage(ctx, s.weeklyCollection, filter, cost, success, now) |
| 182 | } |
| 183 | |
| 184 | func (s *UsageService) trackLifetimeUsage(ctx context.Context, userID bson.ObjectID, projectID string, cost float64, success bool, now time.Time) error { |
| 185 | filter := bson.M{ |
no test coverage detected