Split contract package
This commit is contained in:
@@ -1,33 +1,5 @@
|
||||
package contract
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"git.vakhrushev.me/av/transcriber/internal/entity"
|
||||
)
|
||||
|
||||
type JobNotFoundError struct {
|
||||
State string
|
||||
Message string
|
||||
}
|
||||
|
||||
func (e *JobNotFoundError) Error() string {
|
||||
return fmt.Sprintf("%s - %s", e.State, e.Message)
|
||||
}
|
||||
|
||||
type FileRepository interface {
|
||||
Create(file *entity.File) error
|
||||
GetByID(id string) (*entity.File, error)
|
||||
}
|
||||
|
||||
type TranscriptJobRepository interface {
|
||||
Create(job *entity.TranscribeJob) error
|
||||
Save(job *entity.TranscribeJob) error
|
||||
GetByID(id string) (*entity.TranscribeJob, error)
|
||||
FindAndAcquire(state, acquisitionId string, rottingTime time.Time) (*entity.TranscribeJob, error)
|
||||
}
|
||||
|
||||
type ObjectStorage interface {
|
||||
}
|
||||
|
||||
|
12
internal/contract/error.go
Normal file
12
internal/contract/error.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package contract
|
||||
|
||||
import "fmt"
|
||||
|
||||
type JobNotFoundError struct {
|
||||
State string
|
||||
Message string
|
||||
}
|
||||
|
||||
func (e *JobNotFoundError) Error() string {
|
||||
return fmt.Sprintf("%s - %s", e.State, e.Message)
|
||||
}
|
19
internal/contract/repository.go
Normal file
19
internal/contract/repository.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package contract
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.vakhrushev.me/av/transcriber/internal/entity"
|
||||
)
|
||||
|
||||
type FileRepository interface {
|
||||
Create(file *entity.File) error
|
||||
GetByID(id string) (*entity.File, error)
|
||||
}
|
||||
|
||||
type TranscriptJobRepository interface {
|
||||
Create(job *entity.TranscribeJob) error
|
||||
Save(job *entity.TranscribeJob) error
|
||||
GetByID(id string) (*entity.TranscribeJob, error)
|
||||
FindAndAcquire(state, acquisitionId string, rottingTime time.Time) (*entity.TranscribeJob, error)
|
||||
}
|
Reference in New Issue
Block a user