Andrea Fazzi преди 5 години
родител
ревизия
bacc81443c
променени са 4 файла, в които са добавени 32 реда и са изтрити 12 реда
  1. 8 5
      Dockerfile
  2. 7 7
      orm/document.go
  3. 17 0
      orm/job.go
  4. BIN
      pandoc/pandoc-2.7.3-1-amd64.deb

+ 8 - 5
Dockerfile

@@ -4,11 +4,14 @@ RUN apt-get update -qq && apt-get install -y netcat
 
 # RUN apt-get install -y -q pandoc
 
-WORKDIR /
-RUN mkdir -p /pandoc
-COPY pandoc/pandoc-2.7.3-1-amd64.deb /pandoc
-RUN ls -l
-RUN dpkg -i /pandoc/pandoc-2.7.3-1-amd64.deb
+WORKDIR /tmp
+RUN wget https://github.com/jgm/pandoc/releases/download/2.7.3/pandoc-2.7.3-1-amd64.deb
+
+# RUN mkdir -p /pandoc
+# COPY pandoc/pandoc-2.7.3-1-amd64.deb /pandoc
+# RUN ls -l
+
+RUN dpkg -i ./pandoc-2.7.3-1-amd64.deb
 
 # Install latest stable LibreOffice
 RUN apt-get install -y -q libreoffice \

+ 7 - 7
orm/document.go

@@ -20,12 +20,9 @@ type FilePath struct {
 type Document struct {
 	gorm.Model
 
-	Name          string
-	SurveyUrl     string
-	ReferencePath string
-	TemplatePath  string
+	Name string
 
-	Files []*FilePath
+	Jobs []*Job
 }
 
 type DocumentForUpdate struct {
@@ -159,8 +156,11 @@ func GetDocumentExecute(args map[string]string) (interface{}, error) {
 
 	log.Println("Execution was triggered!")
 
-	done := make(chan bool, 1)
-	log.Println("Start generator...")
+	job := new(Job)
+	jobCh := make(chan Job, 1)
+
+	log.Println("Sending JOB %d to generator...", job.ID)
+
 	go documents.Generators["list"].Run(done)
 	<-done
 	log.Println("Generator was started...")

+ 17 - 0
orm/job.go

@@ -0,0 +1,17 @@
+package orm
+
+import (
+	"time"
+
+	"github.com/jinzhu/gorm"
+)
+
+type Job struct {
+	gorm.Model
+
+	Name       string
+	DocumentID uint
+
+	Start *time.Time
+	End   *time.Time
+}

BIN
pandoc/pandoc-2.7.3-1-amd64.deb