fix: add binary to gitignore
feat: move images to gitlab registry and rewrite compose for obtain them fix: workaround history for get something on front
This commit is contained in:
parent
71f03c93f9
commit
f724ea19fd
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@
|
||||
out
|
||||
gen
|
||||
amocrm_templategen_back
|
||||
templategen_linux
|
||||
|
10
Makefile
Normal file
10
Makefile
Normal file
@ -0,0 +1,10 @@
|
||||
deploy:
|
||||
docker context use remote
|
||||
docker compose up --force-recreate --no-deps --build -d app
|
||||
deploy-worker:
|
||||
docker context use remote
|
||||
docker compose up --force-recreate --no-deps --build -d worker
|
||||
build-image:
|
||||
CGO_ENABLED=0 go build -o templategen_linux
|
||||
docker build -t penahub.gitlab.yandexcloud.net:5050/backend/templategen .
|
||||
docker push penahub.gitlab.yandexcloud.net:5050/backend/templategen
|
@ -2,12 +2,13 @@ package mongos
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.uber.org/zap"
|
||||
"penahub.gitlab.yandexcloud.net/backend/templategen/dal/model"
|
||||
"time"
|
||||
)
|
||||
|
||||
type History struct {
|
||||
@ -70,15 +71,14 @@ func (d *History) GetByID(ctx context.Context, id string) (*model.History, error
|
||||
}
|
||||
|
||||
type HistoryFilter struct {
|
||||
UserID string `bson:"user_id,omitempty" json:"user_id"`
|
||||
AmoID string `bson:"amo_id,omitempty" json:"amo_id"`
|
||||
WorkerTaskID string `bson:"worker_task_id,omitempty" json:"worker_task_id"`
|
||||
AmoUserID int64 `bson:"amo_user_id,omitempty" json:"amo_user_id"`
|
||||
LeadID int64 `bson:"lead_id,omitempty" json:"lead_id"`
|
||||
Trigger model.HistoryTrigger `bson:"trigger,omitempty" json:"trigger"`
|
||||
TemplateID string `bson:"template_id,omitempty" json:"template_id"`
|
||||
Source *model.HistorySource `bson:"source,omitempty" json:"source"`
|
||||
Target *model.HistoryTarget `bson:"target,omitempty" json:"target"`
|
||||
AmoID string `bson:"amo_id,omitempty" json:"amo_id"`
|
||||
// WorkerTaskID string `bson:"worker_task_id,omitempty" json:"worker_task_id"`
|
||||
AmoUserID int64 `bson:"amo_user_id,omitempty" json:"amo_user_id"`
|
||||
// LeadID int64 `bson:"lead_id,omitempty" json:"lead_id"`
|
||||
// Trigger model.HistoryTrigger `bson:"trigger,omitempty" json:"trigger"`
|
||||
// TemplateID string `bson:"template_id,omitempty" json:"template_id"`
|
||||
// Source *model.HistorySource `bson:"source,omitempty" json:"source"`
|
||||
// Target *model.HistoryTarget `bson:"target,omitempty" json:"target"`
|
||||
}
|
||||
|
||||
func (d *History) GetByFilter(ctx context.Context, filter *HistoryFilter) ([]model.History, error) {
|
||||
@ -86,7 +86,7 @@ func (d *History) GetByFilter(ctx context.Context, filter *HistoryFilter) ([]mod
|
||||
filter = &HistoryFilter{}
|
||||
}
|
||||
|
||||
cur, err := d.coll.Find(ctx, filter)
|
||||
cur, err := d.coll.Find(ctx, bson.M{})
|
||||
if err == mongo.ErrNoDocuments {
|
||||
return nil, nil
|
||||
} else {
|
||||
|
@ -33,10 +33,7 @@ services:
|
||||
- "30003:30003"
|
||||
|
||||
app:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile
|
||||
image: templategenerator:latest
|
||||
image: penahub.gitlab.yandexcloud.net:5050/backend/templategen:latest
|
||||
environment:
|
||||
MONGO_URL: mongodb://mongo1:30001,mongo2:30002,mongo3:30003/?replicaSet=penahub-rs
|
||||
ports:
|
||||
@ -52,10 +49,7 @@ services:
|
||||
- mongo3
|
||||
|
||||
worker:
|
||||
build:
|
||||
context: ../templategenworker
|
||||
dockerfile: Dockerfile
|
||||
image: templategenerator-worker:latest
|
||||
image: penahub.gitlab.yandexcloud.net:5050/backend/templategenworker:latest
|
||||
environment:
|
||||
MONGO_URL: mongodb://mongo1:30001,mongo2:30002,mongo3:30003/?replicaSet=penahub-rs
|
||||
depends_on:
|
||||
|
@ -3,6 +3,7 @@ package handlers
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
"penahub.gitlab.yandexcloud.net/backend/templategen/dal/mongos"
|
||||
)
|
||||
|
||||
@ -67,6 +68,8 @@ func (h *Handlers) GetHistoryListByFilter(w http.ResponseWriter, r *http.Request
|
||||
req.AmoUserID = amoUserID
|
||||
}
|
||||
|
||||
req.AmoID = amoData.AccountID
|
||||
|
||||
result, err := h.dal.History.GetByFilter(r.Context(), &req)
|
||||
if err != nil {
|
||||
h.reportError(w, err, http.StatusInternalServerError)
|
||||
|
Loading…
Reference in New Issue
Block a user