From 114aec73ed1bda3b1a3dcc9fa0bf7eea081b2aff Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Mon, 4 May 2026 20:09:56 +0000 Subject: [PATCH] Fix setting timestamp for when action is taken --- db/query/arcgis/oauth.go | 3 ++- db/query/public/communication.go | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/db/query/arcgis/oauth.go b/db/query/arcgis/oauth.go index 340469a1..f283cc2b 100644 --- a/db/query/arcgis/oauth.go +++ b/db/query/arcgis/oauth.go @@ -2,6 +2,7 @@ package arcgis import ( "context" + "time" "github.com/Gleipnir-Technology/nidus-sync/db" "github.com/Gleipnir-Technology/nidus-sync/db/gen/nidus-sync/arcgis/model" @@ -16,7 +17,7 @@ func OAuthTokenInsert(ctx context.Context, m *model.OAuthToken) (*model.OAuthTok } func OAuthTokenInvalidate(ctx context.Context, id int64) error { statement := table.OAuthToken.UPDATE(). - SET(table.OAuthToken.InvalidatedAt.SET(postgres.LOCALTIMESTAMP())). + SET(table.OAuthToken.InvalidatedAt.SET(postgres.TimestampT(time.Now()))). WHERE(table.OAuthToken.ID.EQ(postgres.Int(id))) return db.ExecuteNone(ctx, statement) } diff --git a/db/query/public/communication.go b/db/query/public/communication.go index eba16e2e..004b188d 100644 --- a/db/query/public/communication.go +++ b/db/query/public/communication.go @@ -34,7 +34,7 @@ func CommunicationsFromOrganization(ctx context.Context, org_id int64) ([]*model } func CommunicationMarkInvalid(ctx context.Context, org_id int64, user_id int64, comm_id int64) error { statement := table.Communication.UPDATE(). - SET(table.Communication.Invalidated.SET(postgres.LOCALTIMESTAMP())). + SET(table.Communication.Invalidated.SET(postgres.TimestampT(time.Now()))). SET(table.Communication.InvalidatedBy.SET(postgres.Int(user_id))). WHERE(table.Communication.OrganizationID.EQ(postgres.Int(org_id)).AND( table.Communication.ID.EQ(postgres.Int(comm_id)))) @@ -42,7 +42,7 @@ func CommunicationMarkInvalid(ctx context.Context, org_id int64, user_id int64, } func CommunicationMarkPendingResponse(ctx context.Context, org_id int64, user_id int64, comm_id int64) error { statement := table.Communication.UPDATE(). - SET(table.Communication.SetPending.SET(postgres.LOCALTIMESTAMP())). + SET(table.Communication.SetPending.SET(postgres.TimestampT(time.Now()))). SET(table.Communication.SetPendingBy.SET(postgres.Int(user_id))). WHERE(table.Communication.OrganizationID.EQ(postgres.Int(org_id)).AND( table.Communication.ID.EQ(postgres.Int(comm_id)))) @@ -50,7 +50,7 @@ func CommunicationMarkPendingResponse(ctx context.Context, org_id int64, user_id } func CommunicationMarkPossibleIssue(ctx context.Context, org_id int64, user_id int64, comm_id int64) error { statement := table.Communication.UPDATE(). - SET(table.Communication.SetPossibleIssue.SET(postgres.LOCALTIMESTAMP())). + SET(table.Communication.SetPossibleIssue.SET(postgres.TimestampT(time.Now()))). SET(table.Communication.SetPossibleIssueBy.SET(postgres.Int(user_id))). WHERE(table.Communication.OrganizationID.EQ(postgres.Int(org_id)).AND( table.Communication.ID.EQ(postgres.Int(comm_id)))) @@ -58,7 +58,7 @@ func CommunicationMarkPossibleIssue(ctx context.Context, org_id int64, user_id i } func CommunicationMarkPossibleResolved(ctx context.Context, org_id int64, user_id int64, comm_id int64) error { statement := table.Communication.UPDATE(). - SET(table.Communication.SetPossibleResolved.SET(postgres.LOCALTIMESTAMP())). + SET(table.Communication.SetPossibleResolved.SET(postgres.TimestampT(time.Now()))). SET(table.Communication.SetPossibleResolvedBy.SET(postgres.Int(user_id))). WHERE(table.Communication.OrganizationID.EQ(postgres.Int(org_id)).AND( table.Communication.ID.EQ(postgres.Int(comm_id))))