Refactor project structure
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package transcribe
|
||||
package service
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"git.vakhrushev.me/av/transcriber/internal/contract"
|
||||
"git.vakhrushev.me/av/transcriber/internal/entity"
|
||||
"git.vakhrushev.me/av/transcriber/internal/repo"
|
||||
"git.vakhrushev.me/av/transcriber/internal/repo/ffmpeg"
|
||||
"git.vakhrushev.me/av/transcriber/internal/service/s3"
|
||||
"git.vakhrushev.me/av/transcriber/internal/service/speechkit"
|
||||
@@ -19,11 +19,11 @@ import (
|
||||
const baseStorageDir = "data/files"
|
||||
|
||||
type TranscribeService struct {
|
||||
jobRepo repo.TranscriptJobRepository
|
||||
fileRepo repo.FileRepository
|
||||
jobRepo contract.TranscriptJobRepository
|
||||
fileRepo contract.FileRepository
|
||||
}
|
||||
|
||||
func NewTranscribeService(jobRepo repo.TranscriptJobRepository, fileRepo repo.FileRepository) *TranscribeService {
|
||||
func NewTranscribeService(jobRepo contract.TranscriptJobRepository, fileRepo contract.FileRepository) *TranscribeService {
|
||||
return &TranscribeService{jobRepo: jobRepo, fileRepo: fileRepo}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ func (s *TranscribeService) FindAndRunConversionJob() error {
|
||||
|
||||
job, err := s.jobRepo.FindAndAcquire(entity.StateCreated, acquisitionId, rottingTime)
|
||||
if err != nil {
|
||||
if _, ok := err.(*repo.JobNotFoundError); ok {
|
||||
if _, ok := err.(*contract.JobNotFoundError); ok {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
@@ -154,7 +154,7 @@ func (s *TranscribeService) FindAndRunTranscribeJob() error {
|
||||
|
||||
jobRecord, err := s.jobRepo.FindAndAcquire(entity.StateConverted, acquisitionId, rottingTime)
|
||||
if err != nil {
|
||||
if _, ok := err.(*repo.JobNotFoundError); ok {
|
||||
if _, ok := err.(*contract.JobNotFoundError); ok {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
@@ -222,7 +222,7 @@ func (s *TranscribeService) FindAndRunTranscribeCheckJob() error {
|
||||
|
||||
job, err := s.jobRepo.FindAndAcquire(entity.StateTranscribe, acquisitionId, rottingTime)
|
||||
if err != nil {
|
||||
if _, ok := err.(*repo.JobNotFoundError); ok {
|
||||
if _, ok := err.(*contract.JobNotFoundError); ok {
|
||||
return nil
|
||||
}
|
||||
return err
|
Reference in New Issue
Block a user