Initial commit: Open sourcing all of the Maple Open Technologies code.
This commit is contained in:
commit
755d54a99d
2010 changed files with 448675 additions and 0 deletions
|
|
@ -0,0 +1,23 @@
|
|||
// monorepo/cloud/maplefile-backend/internal/maplefile/domain/storageusageevent/interface.go
|
||||
package storageusageevent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/gocql/gocql"
|
||||
)
|
||||
|
||||
// StorageUsageEventRepository defines the interface for storage usage events
|
||||
type StorageUsageEventRepository interface {
|
||||
Create(ctx context.Context, event *StorageUsageEvent) error
|
||||
CreateMany(ctx context.Context, events []*StorageUsageEvent) error
|
||||
GetByUserAndDay(ctx context.Context, userID gocql.UUID, eventDay time.Time) ([]*StorageUsageEvent, error)
|
||||
GetByUserDateRange(ctx context.Context, userID gocql.UUID, startDay, endDay time.Time) ([]*StorageUsageEvent, error)
|
||||
DeleteByUserAndDay(ctx context.Context, userID gocql.UUID, eventDay time.Time) error
|
||||
DeleteByUserID(ctx context.Context, userID gocql.UUID) error
|
||||
GetLast7DaysEvents(ctx context.Context, userID gocql.UUID) ([]*StorageUsageEvent, error)
|
||||
GetLastNDaysEvents(ctx context.Context, userID gocql.UUID, days int) ([]*StorageUsageEvent, error)
|
||||
GetMonthlyEvents(ctx context.Context, userID gocql.UUID, year int, month time.Month) ([]*StorageUsageEvent, error)
|
||||
GetYearlyEvents(ctx context.Context, userID gocql.UUID, year int) ([]*StorageUsageEvent, error)
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
// monorepo/cloud/maplefile-backend/internal/maplefile/domain/storageusageevent/model.go
|
||||
package storageusageevent
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/gocql/gocql"
|
||||
)
|
||||
|
||||
type StorageUsageEvent struct {
|
||||
UserID gocql.UUID `json:"user_id"` // Partition key
|
||||
EventDay time.Time `json:"event_day"` // Partition key (date only)
|
||||
EventTime time.Time `json:"event_time"` // Clustering key
|
||||
FileSize int64 `json:"file_size"` // Bytes
|
||||
Operation string `json:"operation"` // "add" or "remove"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue