24 lines
650 B
Go
24 lines
650 B
Go
package attachment
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type AttachmentRepository interface {
|
|
// WithPublication holds the file's hash lock through the callback and commit.
|
|
// Publication is valid only inside the callback. Any callback error rolls back.
|
|
WithPublication(ctx context.Context, attachment Attachment, fn func(Publication) error) error
|
|
GetForMember(ctx context.Context, attachmentID, actorID uuid.UUID) (Attachment, error)
|
|
}
|
|
|
|
type Publication interface {
|
|
FileReady() bool
|
|
SaveReady(ctx context.Context) error
|
|
}
|
|
|
|
type ChatMembership interface {
|
|
IsMember(ctx context.Context, chatID, actorID uuid.UUID) (bool, error)
|
|
}
|