Fix setting timestamp for when action is taken
This commit is contained in:
parent
60bf09e813
commit
114aec73ed
2 changed files with 6 additions and 5 deletions
|
|
@ -2,6 +2,7 @@ package arcgis
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/db"
|
"github.com/Gleipnir-Technology/nidus-sync/db"
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/db/gen/nidus-sync/arcgis/model"
|
"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 {
|
func OAuthTokenInvalidate(ctx context.Context, id int64) error {
|
||||||
statement := table.OAuthToken.UPDATE().
|
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)))
|
WHERE(table.OAuthToken.ID.EQ(postgres.Int(id)))
|
||||||
return db.ExecuteNone(ctx, statement)
|
return db.ExecuteNone(ctx, statement)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
func CommunicationMarkInvalid(ctx context.Context, org_id int64, user_id int64, comm_id int64) error {
|
||||||
statement := table.Communication.UPDATE().
|
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))).
|
SET(table.Communication.InvalidatedBy.SET(postgres.Int(user_id))).
|
||||||
WHERE(table.Communication.OrganizationID.EQ(postgres.Int(org_id)).AND(
|
WHERE(table.Communication.OrganizationID.EQ(postgres.Int(org_id)).AND(
|
||||||
table.Communication.ID.EQ(postgres.Int(comm_id))))
|
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 {
|
func CommunicationMarkPendingResponse(ctx context.Context, org_id int64, user_id int64, comm_id int64) error {
|
||||||
statement := table.Communication.UPDATE().
|
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))).
|
SET(table.Communication.SetPendingBy.SET(postgres.Int(user_id))).
|
||||||
WHERE(table.Communication.OrganizationID.EQ(postgres.Int(org_id)).AND(
|
WHERE(table.Communication.OrganizationID.EQ(postgres.Int(org_id)).AND(
|
||||||
table.Communication.ID.EQ(postgres.Int(comm_id))))
|
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 {
|
func CommunicationMarkPossibleIssue(ctx context.Context, org_id int64, user_id int64, comm_id int64) error {
|
||||||
statement := table.Communication.UPDATE().
|
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))).
|
SET(table.Communication.SetPossibleIssueBy.SET(postgres.Int(user_id))).
|
||||||
WHERE(table.Communication.OrganizationID.EQ(postgres.Int(org_id)).AND(
|
WHERE(table.Communication.OrganizationID.EQ(postgres.Int(org_id)).AND(
|
||||||
table.Communication.ID.EQ(postgres.Int(comm_id))))
|
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 {
|
func CommunicationMarkPossibleResolved(ctx context.Context, org_id int64, user_id int64, comm_id int64) error {
|
||||||
statement := table.Communication.UPDATE().
|
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))).
|
SET(table.Communication.SetPossibleResolvedBy.SET(postgres.Int(user_id))).
|
||||||
WHERE(table.Communication.OrganizationID.EQ(postgres.Int(org_id)).AND(
|
WHERE(table.Communication.OrganizationID.EQ(postgres.Int(org_id)).AND(
|
||||||
table.Communication.ID.EQ(postgres.Int(comm_id))))
|
table.Communication.ID.EQ(postgres.Int(comm_id))))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue