Merge branch 'dev' into 'staging'
add logs See merge request pena-services/verification!5
This commit is contained in:
commit
e340db441f
@ -23,6 +23,6 @@ services:
|
|||||||
MONGO_AUTH: "verification"
|
MONGO_AUTH: "verification"
|
||||||
MONGO_DATABASE_NAME: "verification"
|
MONGO_DATABASE_NAME: "verification"
|
||||||
CUSTOMER_SVC_ADDRESS: "10.8.0.6:8065"
|
CUSTOMER_SVC_ADDRESS: "10.8.0.6:8065"
|
||||||
STAGING_URL: "sadmin.pena"
|
STAGING_URL: "https://sadmin.pena"
|
||||||
|
|
||||||
tty: true
|
tty: true
|
||||||
|
@ -1,14 +1 @@
|
|||||||
New verification:
|
Пользователь {{ .UserURL }} подал запрос на верификацию
|
||||||
ID: {{ .ID }}
|
|
||||||
UserID: {{ .UserID }}
|
|
||||||
UserURL: {{ .UserURL }}
|
|
||||||
Accepted: {{ .Accepted }}
|
|
||||||
Status: {{ .Status }}
|
|
||||||
UpdatedAt: {{ .UpdatedAt.Format "Mon, 02 Jan 2006 15:04:05 MST"}}
|
|
||||||
Comment: {{ .Comment }}
|
|
||||||
=============================
|
|
||||||
Files
|
|
||||||
=============================
|
|
||||||
{{ range .Files }}
|
|
||||||
Название: {{ .Name }} ({{ .Url }})
|
|
||||||
{{ end }}
|
|
||||||
|
@ -1,14 +1 @@
|
|||||||
Updated verification:
|
Пользователь {{ .UserURL }} подал запрос на верификацию
|
||||||
ID: {{ .ID }}
|
|
||||||
UserID: {{ .UserID }}
|
|
||||||
UserURL: {{ .UserURL }}
|
|
||||||
Accepted: {{ .Accepted }}
|
|
||||||
Status: {{ .Status }}
|
|
||||||
UpdatedAt: {{ .UpdatedAt.Format "Mon, 02 Jan 2006 15:04:05 MST"}}
|
|
||||||
Comment: {{ .Comment }}
|
|
||||||
=============================
|
|
||||||
Files
|
|
||||||
=============================
|
|
||||||
{{ range .Files }}
|
|
||||||
Название: {{ .Name }} ({{ .Url }})
|
|
||||||
{{ end }}
|
|
||||||
|
@ -35,6 +35,7 @@ func NewTelegram(deps Deps) *Telegram {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *Telegram) SendVerification(data *models.Verification, url string, isUpdate bool) error {
|
func (t *Telegram) SendVerification(data *models.Verification, url string, isUpdate bool) error {
|
||||||
|
fmt.Println("VERT", data, url,isUpdate)
|
||||||
var tplPath string
|
var tplPath string
|
||||||
if isUpdate {
|
if isUpdate {
|
||||||
tplPath = UpdatedVerification
|
tplPath = UpdatedVerification
|
||||||
@ -42,14 +43,13 @@ func (t *Telegram) SendVerification(data *models.Verification, url string, isUpd
|
|||||||
tplPath = NewVerification
|
tplPath = NewVerification
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Println("VERT1", tplPath)
|
||||||
var userURL string
|
var userURL string
|
||||||
if url == t.stagingURL {
|
userURL = fmt.Sprintf("%s/users/%s", t.stagingURL, data.UserID)
|
||||||
userURL = fmt.Sprintf("%s/users/%s", t.stagingURL, data.UserID)
|
fmt.Println("VERT2", userURL)
|
||||||
} else {
|
|
||||||
userURL = fmt.Sprintf("https://admin.pena/users/%s", data.UserID)
|
|
||||||
}
|
|
||||||
|
|
||||||
tpl, err := template.New("verification_template").Parse(tplPath)
|
tpl, err := template.New("verification_template").Parse(tplPath)
|
||||||
|
fmt.Println("VERT333", tpl,err)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error parsing template: %w", err)
|
return fmt.Errorf("error parsing template: %w", err)
|
||||||
}
|
}
|
||||||
@ -69,12 +69,14 @@ func (t *Telegram) SendVerification(data *models.Verification, url string, isUpd
|
|||||||
}
|
}
|
||||||
|
|
||||||
err = tpl.Execute(&text, toTG)
|
err = tpl.Execute(&text, toTG)
|
||||||
|
fmt.Println("VERT433", err)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error executing template: %w", err)
|
return fmt.Errorf("error executing template: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
msg := tgbotapi.NewMessage(t.chatID, text.String())
|
msg := tgbotapi.NewMessage(t.chatID, text.String())
|
||||||
|
|
||||||
|
fmt.Println("VERT433", err, t.chatID, text.String())
|
||||||
_, err = t.bot.Send(msg)
|
_, err = t.bot.Send(msg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error sending message: %w", err)
|
return fmt.Errorf("error sending message: %w", err)
|
||||||
|
@ -255,10 +255,8 @@ func (r *VerificationRepository) Update(ctx context.Context, record *models.Veri
|
|||||||
TaxNumber: record.TaxNumber,
|
TaxNumber: record.TaxNumber,
|
||||||
}
|
}
|
||||||
|
|
||||||
objId, _ := primitive.ObjectIDFromHex(record.ID)
|
|
||||||
|
|
||||||
var result models.Verification
|
var result models.Verification
|
||||||
err := r.mongo.FindOneAndUpdate(ctx, bson.M{"_id": objId}, bson.M{"$set": test}, options.FindOneAndUpdate().SetReturnDocument(options.After)).Decode(&result)
|
err := r.mongo.FindOneAndUpdate(ctx, bson.M{"_id": record.ID}, bson.M{"$set": test}, options.FindOneAndUpdate().SetReturnDocument(options.After)).Decode(&result)
|
||||||
if r.err(err) {
|
if r.err(err) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -286,7 +284,12 @@ func (r *VerificationRepository) UpdateFile(ctx context.Context, userID, fileNam
|
|||||||
if r.err(err) {
|
if r.err(err) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if verification == nil {
|
||||||
|
return nil, fmt.Errorf("no verification found")
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("BUG",verification.Files)
|
||||||
found := false
|
found := false
|
||||||
for iterator, file := range verification.Files {
|
for iterator, file := range verification.Files {
|
||||||
if file.Name != fileName {
|
if file.Name != fileName {
|
||||||
|
Loading…
Reference in New Issue
Block a user