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_DATABASE_NAME: "verification"
|
||||
CUSTOMER_SVC_ADDRESS: "10.8.0.6:8065"
|
||||
STAGING_URL: "sadmin.pena"
|
||||
STAGING_URL: "https://sadmin.pena"
|
||||
|
||||
tty: true
|
||||
|
@ -1,14 +1 @@
|
||||
New verification:
|
||||
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 }}
|
||||
Пользователь {{ .UserURL }} подал запрос на верификацию
|
||||
|
@ -1,14 +1 @@
|
||||
Updated verification:
|
||||
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 }}
|
||||
Пользователь {{ .UserURL }} подал запрос на верификацию
|
||||
|
@ -35,6 +35,7 @@ func NewTelegram(deps Deps) *Telegram {
|
||||
}
|
||||
|
||||
func (t *Telegram) SendVerification(data *models.Verification, url string, isUpdate bool) error {
|
||||
fmt.Println("VERT", data, url,isUpdate)
|
||||
var tplPath string
|
||||
if isUpdate {
|
||||
tplPath = UpdatedVerification
|
||||
@ -42,14 +43,13 @@ func (t *Telegram) SendVerification(data *models.Verification, url string, isUpd
|
||||
tplPath = NewVerification
|
||||
}
|
||||
|
||||
fmt.Println("VERT1", tplPath)
|
||||
var userURL string
|
||||
if url == t.stagingURL {
|
||||
userURL = fmt.Sprintf("%s/users/%s", t.stagingURL, data.UserID)
|
||||
} else {
|
||||
userURL = fmt.Sprintf("https://admin.pena/users/%s", data.UserID)
|
||||
}
|
||||
userURL = fmt.Sprintf("%s/users/%s", t.stagingURL, data.UserID)
|
||||
fmt.Println("VERT2", userURL)
|
||||
|
||||
tpl, err := template.New("verification_template").Parse(tplPath)
|
||||
fmt.Println("VERT333", tpl,err)
|
||||
if err != nil {
|
||||
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)
|
||||
fmt.Println("VERT433", err)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error executing template: %w", err)
|
||||
}
|
||||
|
||||
msg := tgbotapi.NewMessage(t.chatID, text.String())
|
||||
|
||||
fmt.Println("VERT433", err, t.chatID, text.String())
|
||||
_, err = t.bot.Send(msg)
|
||||
if err != nil {
|
||||
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,
|
||||
}
|
||||
|
||||
objId, _ := primitive.ObjectIDFromHex(record.ID)
|
||||
|
||||
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) {
|
||||
return nil, err
|
||||
}
|
||||
@ -286,7 +284,12 @@ func (r *VerificationRepository) UpdateFile(ctx context.Context, userID, fileNam
|
||||
if r.err(err) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if verification == nil {
|
||||
return nil, fmt.Errorf("no verification found")
|
||||
}
|
||||
|
||||
fmt.Println("BUG",verification.Files)
|
||||
found := false
|
||||
for iterator, file := range verification.Files {
|
||||
if file.Name != fileName {
|
||||
|
Loading…
Reference in New Issue
Block a user