Restore accidentally removed platform mailer by ID func
Needed by the mailer resource
This commit is contained in:
parent
feff03428f
commit
1c8b13b31e
3 changed files with 7 additions and 2 deletions
|
|
@ -46,7 +46,9 @@ func mailerBaseQuery() postgres.SelectStatement {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
func MailerFromPublicID(ctx context.Context, txn db.Ex, org_id int64, id int64) (*types.Mailer, error) {
|
|
||||||
|
// func MailerFromPublicID(ctx context.Context, txn db.Ex, org_id int64, id int64) (*types.Mailer, error) {
|
||||||
|
func MailerFromID(ctx context.Context, txn db.Ex, org_id int64, id int64) (*types.Mailer, error) {
|
||||||
statement := mailerBaseQuery().WHERE(
|
statement := mailerBaseQuery().WHERE(
|
||||||
table.ComplianceReportRequest.ID.EQ(postgres.Int(id)).AND(
|
table.ComplianceReportRequest.ID.EQ(postgres.Int(id)).AND(
|
||||||
table.Site.OrganizationID.EQ(postgres.Int(org_id))),
|
table.Site.OrganizationID.EQ(postgres.Int(org_id))),
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,9 @@ import (
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/platform/types"
|
"github.com/Gleipnir-Technology/nidus-sync/platform/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func MailerByID(ctx context.Context, user User, id int32) (*types.Mailer, error) {
|
||||||
|
return querypublic.MailerFromID(ctx, db.PGInstance.PGXPool, int64(user.Organization.ID), int64(id))
|
||||||
|
}
|
||||||
func MailerList(ctx context.Context, user User, limit int) ([]types.Mailer, error) {
|
func MailerList(ctx context.Context, user User, limit int) ([]types.Mailer, error) {
|
||||||
return querypublic.MailersFromOrganizationID(ctx, db.PGInstance.PGXPool, int64(user.Organization.ID), int64(limit))
|
return querypublic.MailersFromOrganizationID(ctx, db.PGInstance.PGXPool, int64(user.Organization.ID), int64(limit))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ func (res *mailerR) ByIDGet(ctx context.Context, r *http.Request, user platform.
|
||||||
}
|
}
|
||||||
return mailer, nil
|
return mailer, nil
|
||||||
}
|
}
|
||||||
func (res *mailerR) List(ctx context.Context, r *http.Request, user platform.User, query QueryParams) ([]*types.Mailer, *nhttp.ErrorWithStatus) {
|
func (res *mailerR) List(ctx context.Context, r *http.Request, user platform.User, query QueryParams) ([]types.Mailer, *nhttp.ErrorWithStatus) {
|
||||||
limit := 1000
|
limit := 1000
|
||||||
if query.Limit != nil {
|
if query.Limit != nil {
|
||||||
limit = *query.Limit
|
limit = *query.Limit
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue