commit
b8581e5e78
2
go.sum
2
go.sum
@ -95,8 +95,6 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
|||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/retailcrm/api-client-go v1.1.0 h1:APPO6ccJAeMV7Jz7BhrtDKSOm2r1j5Ft6fuEXNP2ij4=
|
github.com/retailcrm/api-client-go v1.1.0 h1:APPO6ccJAeMV7Jz7BhrtDKSOm2r1j5Ft6fuEXNP2ij4=
|
||||||
github.com/retailcrm/api-client-go v1.1.0/go.mod h1:QRoPE2SM6ST7i2g0yEdqm7Iw98y7cYuq3q14Ot+6N8c=
|
github.com/retailcrm/api-client-go v1.1.0/go.mod h1:QRoPE2SM6ST7i2g0yEdqm7Iw98y7cYuq3q14Ot+6N8c=
|
||||||
github.com/retailcrm/mg-transport-api-client-go v1.1.20 h1:1aDJ2QVtSkMtSUm50exmzQFSsE+/FQiWYdw2pamUyLc=
|
|
||||||
github.com/retailcrm/mg-transport-api-client-go v1.1.20/go.mod h1:AWV6BueE28/6SCoyfKURTo4lF0oXYoOKmHTzehd5vAI=
|
|
||||||
github.com/retailcrm/mg-transport-api-client-go v1.1.21 h1:OKkey9uvB16ucICuO2hp/tfh0wfp3na0CxRiT2Iv3sE=
|
github.com/retailcrm/mg-transport-api-client-go v1.1.21 h1:OKkey9uvB16ucICuO2hp/tfh0wfp3na0CxRiT2Iv3sE=
|
||||||
github.com/retailcrm/mg-transport-api-client-go v1.1.21/go.mod h1:AWV6BueE28/6SCoyfKURTo4lF0oXYoOKmHTzehd5vAI=
|
github.com/retailcrm/mg-transport-api-client-go v1.1.21/go.mod h1:AWV6BueE28/6SCoyfKURTo4lF0oXYoOKmHTzehd5vAI=
|
||||||
github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf h1:6V1qxN6Usn4jy8unvggSJz/NC790tefw8Zdy6OZS5co=
|
github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf h1:6V1qxN6Usn4jy8unvggSJz/NC790tefw8Zdy6OZS5co=
|
||||||
|
2
migrations/1545914948_app.down.sql
Normal file
2
migrations/1545914948_app.down.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
alter table mg_user alter column created_at drop default;
|
||||||
|
alter table mg_user alter column updated_at drop default;
|
2
migrations/1545914948_app.up.sql
Normal file
2
migrations/1545914948_app.up.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
alter table mg_user alter column created_at set default current_timestamp;
|
||||||
|
alter table mg_user alter column updated_at set default current_timestamp;
|
@ -99,7 +99,16 @@ func getConnectionById(id int) *Connection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *User) save() error {
|
func (u *User) save() error {
|
||||||
return orm.DB.Save(u).Error
|
return orm.DB.Exec(
|
||||||
|
"INSERT INTO mg_user (external_id, user_photo_url, user_photo_id) "+
|
||||||
|
"VALUES (?, ?, ?) "+
|
||||||
|
"ON CONFLICT (external_id) DO UPDATE SET "+
|
||||||
|
"user_photo_url = excluded.user_photo_url, user_photo_id=excluded.user_photo_id, updated_at= ?",
|
||||||
|
u.ExternalID,
|
||||||
|
u.UserPhotoURL,
|
||||||
|
u.UserPhotoID,
|
||||||
|
time.Now(),
|
||||||
|
).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
func getUserByExternalID(eid int) *User {
|
func getUserByExternalID(eid int) *User {
|
||||||
|
Loading…
Reference in New Issue
Block a user