2018-11-09 12:05:24 +00:00
|
|
|
// Copyright (C) 2018 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package satellite
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/skyrings/skyring-common/tools/uuid"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Companies exposes methods to manage Company table in database.
|
|
|
|
type Companies interface {
|
2018-11-26 14:57:55 +00:00
|
|
|
// GetByUserID is a method for querying company from the database by userID
|
2018-11-09 12:05:24 +00:00
|
|
|
GetByUserID(ctx context.Context, userID uuid.UUID) (*Company, error)
|
|
|
|
// Insert is a method for inserting company into the database
|
|
|
|
Insert(ctx context.Context, company *Company) (*Company, error)
|
2018-11-26 14:57:55 +00:00
|
|
|
// Delete is a method for deleting company by userID from the database.
|
|
|
|
Delete(ctx context.Context, userID uuid.UUID) error
|
2018-11-09 12:05:24 +00:00
|
|
|
// Update is a method for updating company entity
|
|
|
|
Update(ctx context.Context, company *Company) error
|
|
|
|
}
|
|
|
|
|
2018-11-21 15:51:43 +00:00
|
|
|
// CompanyInfo holds data needed to create/update Company
|
|
|
|
type CompanyInfo struct {
|
|
|
|
Name string
|
|
|
|
Address string
|
|
|
|
Country string
|
|
|
|
City string
|
|
|
|
State string
|
|
|
|
PostalCode string
|
|
|
|
}
|
|
|
|
|
2018-11-09 12:05:24 +00:00
|
|
|
// Company is a database object that describes Company entity
|
|
|
|
type Company struct {
|
2018-11-26 14:57:55 +00:00
|
|
|
//PK and FK on users table
|
2018-11-09 12:05:24 +00:00
|
|
|
UserID uuid.UUID
|
|
|
|
|
|
|
|
Name string
|
|
|
|
Address string
|
|
|
|
Country string
|
|
|
|
City string
|
|
|
|
State string
|
|
|
|
PostalCode string
|
|
|
|
|
|
|
|
CreatedAt time.Time
|
|
|
|
}
|