Add conversion job logic
This commit is contained in:
@@ -125,3 +125,24 @@ func (h *TranscribeHandler) GetTranscribeJobStatus(c *gin.Context) {
|
||||
CreatedAt: job.CreatedAt,
|
||||
})
|
||||
}
|
||||
|
||||
func (h *TranscribeHandler) RunConversionJob(c *gin.Context) {
|
||||
acquisitionId := uuid.NewString()
|
||||
rottingTime := time.Now().Add(-1 * time.Hour)
|
||||
|
||||
job, err := h.jobRepo.FindAndAcquire(entity.StateCreated, acquisitionId, rottingTime)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
job.MoveToState(entity.StateConverted)
|
||||
|
||||
err = h.jobRepo.Save(job)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
c.Status(http.StatusOK)
|
||||
}
|
||||
|
Reference in New Issue
Block a user