feat(sql): use UTC for all dates

This commit is contained in:
Denis Gukov 2024-07-22 11:14:06 +05:00
parent 018dd93fcb
commit ffeb65c2ec
5 changed files with 7 additions and 7 deletions

View File

@ -30,7 +30,7 @@ func (d *SqlDb) getEvents(q squirrel.SelectBuilder, params db.RetrieveQueryParam
}
func (d *SqlDb) CreateEvent(evt db.Event) (newEvent db.Event, err error) {
var created = time.Now()
var created = time.Now().UTC()
_, err = d.exec(
"insert into event(user_id, project_id, object_id, object_type, description, created) values (?, ?, ?, ?, ?, ?)",

View File

@ -7,7 +7,7 @@ import (
)
func (d *SqlDb) CreateProject(project db.Project) (newProject db.Project, err error) {
project.Created = time.Now()
project.Created = time.Now().UTC()
insertId, err := d.insert(
"id",

View File

@ -12,7 +12,7 @@ func (d *SqlDb) CreateSession(session db.Session) (db.Session, error) {
}
func (d *SqlDb) CreateAPIToken(token db.APIToken) (db.APIToken, error) {
token.Created = db.GetParsedTime(time.Now())
token.Created = db.GetParsedTime(time.Now().UTC())
err := d.sql.Insert(&token)
return token, err
}
@ -56,7 +56,7 @@ func (d *SqlDb) ExpireSession(userID int, sessionID int) error {
}
func (d *SqlDb) TouchSession(userID int, sessionID int) error {
_, err := d.exec("update session set last_active=? where id=? and user_id=?", time.Now(), sessionID, userID)
_, err := d.exec("update session set last_active=? where id=? and user_id=?", time.Now().UTC(), sessionID, userID)
return err
}

View File

@ -112,7 +112,7 @@ func (d *SqlDb) CreateTaskOutput(output db.TaskOutput) (db.TaskOutput, error) {
"insert into task__output (task_id, task, output, time) VALUES (?, '', ?, ?)",
output.TaskID,
output.Output,
output.Time)
output.Time.UTC())
return output, err
}

View File

@ -16,7 +16,7 @@ func (d *SqlDb) CreateUserWithoutPassword(user db.User) (newUser db.User, err er
}
user.Password = ""
user.Created = db.GetParsedTime(time.Now())
user.Created = db.GetParsedTime(time.Now().UTC())
err = d.sql.Insert(&user)
@ -42,7 +42,7 @@ func (d *SqlDb) CreateUser(user db.UserWithPwd) (newUser db.User, err error) {
}
user.Password = string(pwdHash)
user.Created = db.GetParsedTime(time.Now())
user.Created = db.GetParsedTime(time.Now().UTC())
err = d.sql.Insert(&user.User)