Initial work marking communications
And a bunch of lint fixes
This commit is contained in:
parent
67c99436d1
commit
3153e8bf13
36 changed files with 1958 additions and 487 deletions
|
|
@ -18,6 +18,13 @@ func CommunicationInsert(ctx context.Context, txn bob.Tx, m *model.Communication
|
|||
RETURNING(table.Communication.AllColumns)
|
||||
return db.ExecuteOne[model.Communication](ctx, statement)
|
||||
}
|
||||
func CommunicationFromID(ctx context.Context, comm_id int64) (*model.Communication, error) {
|
||||
statement := table.Communication.SELECT(
|
||||
table.Communication.AllColumns,
|
||||
).FROM(table.Communication).
|
||||
WHERE(table.Communication.ID.EQ(postgres.Int(comm_id)))
|
||||
return db.ExecuteOne[model.Communication](ctx, statement)
|
||||
}
|
||||
func CommunicationsFromOrganization(ctx context.Context, org_id int64) ([]*model.Communication, error) {
|
||||
statement := table.Communication.SELECT(
|
||||
table.Communication.AllColumns,
|
||||
|
|
@ -25,3 +32,35 @@ func CommunicationsFromOrganization(ctx context.Context, org_id int64) ([]*model
|
|||
WHERE(table.Communication.OrganizationID.EQ(postgres.Int(org_id)))
|
||||
return db.ExecuteMany[model.Communication](ctx, statement)
|
||||
}
|
||||
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.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.LOCALTIMESTAMP())).
|
||||
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))))
|
||||
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.LOCALTIMESTAMP())).
|
||||
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))))
|
||||
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.LOCALTIMESTAMP())).
|
||||
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))))
|
||||
return db.ExecuteNone(ctx, statement)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue