Fix failing to set timestamp in mark query

I accidentally didn't understand how this API works.
This commit is contained in:
Eli Ribble 2026-05-04 20:30:36 +00:00
parent 5f3fcc2b3e
commit 040ab106b4
No known key found for this signature in database
3 changed files with 42 additions and 23 deletions

View file

@ -34,32 +34,40 @@ 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.TimestampT(time.Now()))).
SET(table.Communication.InvalidatedBy.SET(postgres.Int(user_id))).
SET(
table.Communication.Invalidated.SET(postgres.TimestampT(time.Now())),
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))))
return db.ExecuteNone(ctx, statement)
}
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.TimestampT(time.Now()))).
SET(table.Communication.SetPendingBy.SET(postgres.Int(user_id))).
SET(
table.Communication.SetPending.SET(postgres.TimestampT(time.Now())),
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))))
return db.ExecuteNone(ctx, statement)
}
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.TimestampT(time.Now()))).
SET(table.Communication.SetPossibleIssueBy.SET(postgres.Int(user_id))).
SET(
table.Communication.SetPossibleIssue.SET(postgres.TimestampT(time.Now())),
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))))
return db.ExecuteNone(ctx, statement)
}
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.TimestampT(time.Now()))).
SET(table.Communication.SetPossibleResolvedBy.SET(postgres.Int(user_id))).
SET(
table.Communication.SetPossibleResolved.SET(postgres.TimestampT(time.Now())),
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))))
return db.ExecuteNone(ctx, statement)