2023-04-26 05:46:48 +01:00
|
|
|
// Copyright (C) 2023 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package console
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"storj.io/common/uuid"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ProjectInvitations exposes methods to manage pending project member invitations in the database.
|
|
|
|
//
|
|
|
|
// architecture: Database
|
|
|
|
type ProjectInvitations interface {
|
2023-06-23 17:34:44 +01:00
|
|
|
// Upsert updates a project member invitation if it exists and inserts it otherwise.
|
|
|
|
Upsert(ctx context.Context, invite *ProjectInvitation) (*ProjectInvitation, error)
|
2023-05-09 20:18:07 +01:00
|
|
|
// Get returns a project member invitation from the database.
|
|
|
|
Get(ctx context.Context, projectID uuid.UUID, email string) (*ProjectInvitation, error)
|
2023-04-26 05:46:48 +01:00
|
|
|
// GetByProjectID returns all of the project member invitations for the project specified by the given ID.
|
|
|
|
GetByProjectID(ctx context.Context, projectID uuid.UUID) ([]ProjectInvitation, error)
|
|
|
|
// GetByEmail returns all of the project member invitations for the specified email address.
|
|
|
|
GetByEmail(ctx context.Context, email string) ([]ProjectInvitation, error)
|
2023-05-09 20:18:07 +01:00
|
|
|
// Delete removes a project member invitation from the database.
|
2023-04-26 05:46:48 +01:00
|
|
|
Delete(ctx context.Context, projectID uuid.UUID, email string) error
|
|
|
|
}
|
|
|
|
|
|
|
|
// ProjectInvitation represents a pending project member invitation.
|
|
|
|
type ProjectInvitation struct {
|
|
|
|
ProjectID uuid.UUID
|
|
|
|
Email string
|
2023-05-09 20:18:07 +01:00
|
|
|
InviterID *uuid.UUID
|
2023-04-26 05:46:48 +01:00
|
|
|
CreatedAt time.Time
|
|
|
|
}
|