Start work on populating context of communication at API layer
Remove communication stub, it's a performance enhancement.
This commit is contained in:
parent
266004624d
commit
e569bb32b7
9 changed files with 331 additions and 119 deletions
|
|
@ -28,6 +28,14 @@ func ReportInsert(ctx context.Context, txn db.Ex, m model.Report) (model.Report,
|
|||
RETURNING(table.Report.AllColumns)
|
||||
return db.ExecuteOneTx[model.Report](ctx, txn, statement)
|
||||
}
|
||||
func ReportsFromAddressID(ctx context.Context, txn db.Ex, org_id int64, address_id int64) ([]model.Report, error) {
|
||||
statement := table.Report.SELECT(
|
||||
table.Report.AllColumns,
|
||||
).FROM(table.Report).
|
||||
WHERE(table.Report.AddressID.EQ(postgres.Int(address_id)).AND(
|
||||
table.Report.OrganizationID.EQ(postgres.Int(org_id))))
|
||||
return db.ExecuteManyTx[model.Report](ctx, txn, statement)
|
||||
}
|
||||
func ReportFromID(ctx context.Context, report_id int64) (model.Report, error) {
|
||||
statement := table.Report.SELECT(
|
||||
table.Report.AllColumns,
|
||||
|
|
@ -87,6 +95,14 @@ func ReportFromPublicIDForOrg(ctx context.Context, txn db.Ex, public_id string,
|
|||
}
|
||||
return &result, nil
|
||||
}
|
||||
func ReportsFromReporterName(ctx context.Context, txn db.Ex, org_id int64, name string) ([]model.Report, error) {
|
||||
statement := table.Report.SELECT(
|
||||
table.Report.AllColumns,
|
||||
).FROM(table.Report).
|
||||
WHERE(table.Report.ReporterName.EQ(postgres.String(name)).AND(
|
||||
table.Report.OrganizationID.EQ(postgres.Int(org_id))))
|
||||
return db.ExecuteManyTx[model.Report](ctx, txn, statement)
|
||||
}
|
||||
func ReportsUnreviewedForOrganization(ctx context.Context, txn db.Ex, org_id int64) ([]model.Report, error) {
|
||||
statement := table.Report.SELECT(
|
||||
table.Report.AllColumns,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue