Add status to invitation
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -29,14 +29,15 @@ import (
|
||||
|
||||
type (
|
||||
Invitation struct {
|
||||
ID gid.GID `db:"id"`
|
||||
OrganizationID gid.GID `db:"organization_id"`
|
||||
Email string `db:"email"`
|
||||
FullName string `db:"full_name"`
|
||||
Role string `db:"role"`
|
||||
ExpiresAt time.Time `db:"expires_at"`
|
||||
AcceptedAt *time.Time `db:"accepted_at"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
ID gid.GID `db:"id"`
|
||||
OrganizationID gid.GID `db:"organization_id"`
|
||||
Email string `db:"email"`
|
||||
FullName string `db:"full_name"`
|
||||
Role string `db:"role"`
|
||||
Status InvitationStatus `db:"status"`
|
||||
ExpiresAt time.Time `db:"expires_at"`
|
||||
AcceptedAt *time.Time `db:"accepted_at"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
}
|
||||
|
||||
Invitations []*Invitation
|
||||
@@ -116,7 +117,20 @@ func (i *Invitation) LoadByID(
|
||||
id gid.GID,
|
||||
) error {
|
||||
query := `
|
||||
SELECT id, organization_id, email, full_name, role, expires_at, accepted_at, created_at
|
||||
SELECT
|
||||
id,
|
||||
organization_id,
|
||||
email,
|
||||
full_name,
|
||||
role,
|
||||
CASE
|
||||
WHEN accepted_at IS NOT NULL THEN 'ACCEPTED'
|
||||
WHEN expires_at < NOW() THEN 'EXPIRED'
|
||||
ELSE 'PENDING'
|
||||
END as status,
|
||||
expires_at,
|
||||
accepted_at,
|
||||
created_at
|
||||
FROM authz_invitations
|
||||
WHERE id = @id AND %s
|
||||
`
|
||||
@@ -207,7 +221,20 @@ func (i *Invitations) LoadByEmail(
|
||||
filter *InvitationFilter,
|
||||
) error {
|
||||
query := `
|
||||
SELECT id, organization_id, email, full_name, role, expires_at, accepted_at, created_at
|
||||
SELECT
|
||||
id,
|
||||
organization_id,
|
||||
email,
|
||||
full_name,
|
||||
role,
|
||||
CASE
|
||||
WHEN accepted_at IS NOT NULL THEN 'ACCEPTED'
|
||||
WHEN expires_at < NOW() THEN 'EXPIRED'
|
||||
ELSE 'PENDING'
|
||||
END as status,
|
||||
expires_at,
|
||||
accepted_at,
|
||||
created_at
|
||||
FROM authz_invitations
|
||||
WHERE email = @email
|
||||
AND %s
|
||||
@@ -244,7 +271,20 @@ func (i *Invitations) LoadByOrganizationID(
|
||||
cursor *page.Cursor[InvitationOrderField],
|
||||
) error {
|
||||
query := `
|
||||
SELECT id, organization_id, email, full_name, role, expires_at, accepted_at, created_at
|
||||
SELECT
|
||||
id,
|
||||
organization_id,
|
||||
email,
|
||||
full_name,
|
||||
role,
|
||||
CASE
|
||||
WHEN accepted_at IS NOT NULL THEN 'ACCEPTED'
|
||||
WHEN expires_at < NOW() THEN 'EXPIRED'
|
||||
ELSE 'PENDING'
|
||||
END as status,
|
||||
expires_at,
|
||||
accepted_at,
|
||||
created_at
|
||||
FROM authz_invitations
|
||||
WHERE organization_id = @organization_id AND %s
|
||||
AND %s
|
||||
|
||||
@@ -20,19 +20,19 @@ import (
|
||||
|
||||
type (
|
||||
InvitationFilter struct {
|
||||
onlyPending *bool
|
||||
status *InvitationStatus
|
||||
}
|
||||
)
|
||||
|
||||
func NewInvitationFilter(onlyPending *bool) *InvitationFilter {
|
||||
func NewInvitationFilter(status *InvitationStatus) *InvitationFilter {
|
||||
return &InvitationFilter{
|
||||
onlyPending: onlyPending,
|
||||
status: status,
|
||||
}
|
||||
}
|
||||
|
||||
func (f *InvitationFilter) SQLArguments() pgx.NamedArgs {
|
||||
return pgx.NamedArgs{
|
||||
"only_pending": f.onlyPending,
|
||||
"status": f.status,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,10 +40,13 @@ func (f *InvitationFilter) SQLFragment() string {
|
||||
return `
|
||||
(
|
||||
CASE
|
||||
WHEN @only_pending::boolean IS NOT NULL AND @only_pending::boolean = true THEN
|
||||
(accepted_at IS NULL AND expires_at > NOW())
|
||||
WHEN @status::text IS NOT NULL THEN
|
||||
(CASE
|
||||
WHEN accepted_at IS NOT NULL THEN 'ACCEPTED'
|
||||
WHEN expires_at < NOW() THEN 'EXPIRED'
|
||||
ELSE 'PENDING'
|
||||
END) = @status::text
|
||||
ELSE TRUE
|
||||
END
|
||||
)`
|
||||
}
|
||||
|
||||
|
||||
60
pkg/coredata/invitation_status.go
Normal file
60
pkg/coredata/invitation_status.go
Normal file
@@ -0,0 +1,60 @@
|
||||
// Copyright (c) 2025 Probo Inc <hello@getprobo.com>.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
package coredata
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type InvitationStatus string
|
||||
|
||||
const (
|
||||
InvitationStatusPending InvitationStatus = "PENDING"
|
||||
InvitationStatusAccepted InvitationStatus = "ACCEPTED"
|
||||
InvitationStatusExpired InvitationStatus = "EXPIRED"
|
||||
)
|
||||
|
||||
func (tcv InvitationStatus) String() string {
|
||||
return string(tcv)
|
||||
}
|
||||
|
||||
func (tcv *InvitationStatus) Scan(value any) error {
|
||||
var s string
|
||||
switch v := value.(type) {
|
||||
case string:
|
||||
s = v
|
||||
case []byte:
|
||||
s = string(v)
|
||||
default:
|
||||
return fmt.Errorf("unsupported type for TrustCenterVisibility: %T", value)
|
||||
}
|
||||
|
||||
switch s {
|
||||
case "PENDING":
|
||||
*tcv = InvitationStatusPending
|
||||
case "ACCEPTED":
|
||||
*tcv = InvitationStatusAccepted
|
||||
case "EXPIRED":
|
||||
*tcv = InvitationStatusExpired
|
||||
default:
|
||||
return fmt.Errorf("invalid InvitationStatus value: %q", s)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (tcv InvitationStatus) Value() (driver.Value, error) {
|
||||
return tcv.String(), nil
|
||||
}
|
||||
@@ -92,6 +92,16 @@ enum PeopleKind
|
||||
)
|
||||
}
|
||||
|
||||
enum InvitationStatus
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.InvitationStatus") {
|
||||
PENDING
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.InvitationStatusPending")
|
||||
ACCEPTED
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.InvitationStatusAccepted")
|
||||
EXPIRED
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.InvitationStatusExpired")
|
||||
}
|
||||
|
||||
enum DocumentStatus
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.DocumentStatus") {
|
||||
DRAFT
|
||||
@@ -1466,7 +1476,7 @@ input InvitationOrder {
|
||||
}
|
||||
|
||||
input InvitationFilter {
|
||||
onlyPending: Boolean
|
||||
status: InvitationStatus
|
||||
}
|
||||
|
||||
input DocumentVersionFilter {
|
||||
@@ -1759,6 +1769,7 @@ type Invitation implements Node {
|
||||
email: String!
|
||||
fullName: String!
|
||||
role: String!
|
||||
status: InvitationStatus!
|
||||
expiresAt: Datetime!
|
||||
acceptedAt: Datetime
|
||||
createdAt: Datetime!
|
||||
|
||||
@@ -771,6 +771,7 @@ type ComplexityRoot struct {
|
||||
ID func(childComplexity int) int
|
||||
Organization func(childComplexity int) int
|
||||
Role func(childComplexity int) int
|
||||
Status func(childComplexity int) int
|
||||
}
|
||||
|
||||
InvitationConnection struct {
|
||||
@@ -4171,6 +4172,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
|
||||
|
||||
return e.complexity.Invitation.Role(childComplexity), true
|
||||
|
||||
case "Invitation.status":
|
||||
if e.complexity.Invitation.Status == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.Invitation.Status(childComplexity), true
|
||||
|
||||
case "InvitationConnection.edges":
|
||||
if e.complexity.InvitationConnection.Edges == nil {
|
||||
break
|
||||
@@ -9134,6 +9142,16 @@ enum PeopleKind
|
||||
)
|
||||
}
|
||||
|
||||
enum InvitationStatus
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.InvitationStatus") {
|
||||
PENDING
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.InvitationStatusPending")
|
||||
ACCEPTED
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.InvitationStatusAccepted")
|
||||
EXPIRED
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.InvitationStatusExpired")
|
||||
}
|
||||
|
||||
enum DocumentStatus
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.DocumentStatus") {
|
||||
DRAFT
|
||||
@@ -10508,7 +10526,7 @@ input InvitationOrder {
|
||||
}
|
||||
|
||||
input InvitationFilter {
|
||||
onlyPending: Boolean
|
||||
status: InvitationStatus
|
||||
}
|
||||
|
||||
input DocumentVersionFilter {
|
||||
@@ -10801,6 +10819,7 @@ type Invitation implements Node {
|
||||
email: String!
|
||||
fullName: String!
|
||||
role: String!
|
||||
status: InvitationStatus!
|
||||
expiresAt: Datetime!
|
||||
acceptedAt: Datetime
|
||||
createdAt: Datetime!
|
||||
@@ -21778,6 +21797,8 @@ func (ec *executionContext) fieldContext_AcceptInvitationPayload_invitation(_ co
|
||||
return ec.fieldContext_Invitation_fullName(ctx, field)
|
||||
case "role":
|
||||
return ec.fieldContext_Invitation_role(ctx, field)
|
||||
case "status":
|
||||
return ec.fieldContext_Invitation_status(ctx, field)
|
||||
case "expiresAt":
|
||||
return ec.fieldContext_Invitation_expiresAt(ctx, field)
|
||||
case "acceptedAt":
|
||||
@@ -36420,6 +36441,50 @@ func (ec *executionContext) fieldContext_Invitation_role(_ context.Context, fiel
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Invitation_status(ctx context.Context, field graphql.CollectedField, obj *types.Invitation) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Invitation_status(ctx, field)
|
||||
if err != nil {
|
||||
return graphql.Null
|
||||
}
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return obj.Status, nil
|
||||
})
|
||||
if err != nil {
|
||||
ec.Error(ctx, err)
|
||||
return graphql.Null
|
||||
}
|
||||
if resTmp == nil {
|
||||
if !graphql.HasFieldError(ctx, fc) {
|
||||
ec.Errorf(ctx, "must not be null")
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(coredata.InvitationStatus)
|
||||
fc.Result = res
|
||||
return ec.marshalNInvitationStatus2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐInvitationStatus(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) fieldContext_Invitation_status(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
fc = &graphql.FieldContext{
|
||||
Object: "Invitation",
|
||||
Field: field,
|
||||
IsMethod: false,
|
||||
IsResolver: false,
|
||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||
return nil, errors.New("field of type InvitationStatus does not have child fields")
|
||||
},
|
||||
}
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _Invitation_expiresAt(ctx context.Context, field graphql.CollectedField, obj *types.Invitation) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_Invitation_expiresAt(ctx, field)
|
||||
if err != nil {
|
||||
@@ -36896,6 +36961,8 @@ func (ec *executionContext) fieldContext_InvitationEdge_node(_ context.Context,
|
||||
return ec.fieldContext_Invitation_fullName(ctx, field)
|
||||
case "role":
|
||||
return ec.fieldContext_Invitation_role(ctx, field)
|
||||
case "status":
|
||||
return ec.fieldContext_Invitation_status(ctx, field)
|
||||
case "expiresAt":
|
||||
return ec.fieldContext_Invitation_expiresAt(ctx, field)
|
||||
case "acceptedAt":
|
||||
@@ -72048,20 +72115,20 @@ func (ec *executionContext) unmarshalInputInvitationFilter(ctx context.Context,
|
||||
asMap[k] = v
|
||||
}
|
||||
|
||||
fieldsInOrder := [...]string{"onlyPending"}
|
||||
fieldsInOrder := [...]string{"status"}
|
||||
for _, k := range fieldsInOrder {
|
||||
v, ok := asMap[k]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
switch k {
|
||||
case "onlyPending":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("onlyPending"))
|
||||
data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v)
|
||||
case "status":
|
||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("status"))
|
||||
data, err := ec.unmarshalOInvitationStatus2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐInvitationStatus(ctx, v)
|
||||
if err != nil {
|
||||
return it, err
|
||||
}
|
||||
it.OnlyPending = data
|
||||
it.Status = data
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82256,6 +82323,11 @@ func (ec *executionContext) _Invitation(ctx context.Context, sel ast.SelectionSe
|
||||
if out.Values[i] == graphql.Null {
|
||||
atomic.AddUint32(&out.Invalids, 1)
|
||||
}
|
||||
case "status":
|
||||
out.Values[i] = ec._Invitation_status(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
atomic.AddUint32(&out.Invalids, 1)
|
||||
}
|
||||
case "expiresAt":
|
||||
out.Values[i] = ec._Invitation_expiresAt(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
@@ -96418,6 +96490,36 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
func (ec *executionContext) unmarshalNInvitationStatus2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐInvitationStatus(ctx context.Context, v any) (coredata.InvitationStatus, error) {
|
||||
tmp, err := graphql.UnmarshalString(v)
|
||||
res := unmarshalNInvitationStatus2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐInvitationStatus[tmp]
|
||||
return res, graphql.ErrorOnPath(ctx, err)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNInvitationStatus2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐInvitationStatus(ctx context.Context, sel ast.SelectionSet, v coredata.InvitationStatus) graphql.Marshaler {
|
||||
_ = sel
|
||||
res := graphql.MarshalString(marshalNInvitationStatus2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐInvitationStatus[v])
|
||||
if res == graphql.Null {
|
||||
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
|
||||
ec.Errorf(ctx, "the requested element is null which the schema does not allow")
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
var (
|
||||
unmarshalNInvitationStatus2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐInvitationStatus = map[string]coredata.InvitationStatus{
|
||||
"PENDING": coredata.InvitationStatusPending,
|
||||
"ACCEPTED": coredata.InvitationStatusAccepted,
|
||||
"EXPIRED": coredata.InvitationStatusExpired,
|
||||
}
|
||||
marshalNInvitationStatus2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐInvitationStatus = map[coredata.InvitationStatus]string{
|
||||
coredata.InvitationStatusPending: "PENDING",
|
||||
coredata.InvitationStatusAccepted: "ACCEPTED",
|
||||
coredata.InvitationStatusExpired: "EXPIRED",
|
||||
}
|
||||
)
|
||||
|
||||
func (ec *executionContext) unmarshalNInviteUserInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐInviteUserInput(ctx context.Context, v any) (types.InviteUserInput, error) {
|
||||
res, err := ec.unmarshalInputInviteUserInput(ctx, v)
|
||||
return res, graphql.ErrorOnPath(ctx, err)
|
||||
@@ -101250,6 +101352,38 @@ func (ec *executionContext) unmarshalOInvitationOrder2ᚖgithubᚗcomᚋgetprobo
|
||||
return &res, graphql.ErrorOnPath(ctx, err)
|
||||
}
|
||||
|
||||
func (ec *executionContext) unmarshalOInvitationStatus2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐInvitationStatus(ctx context.Context, v any) (*coredata.InvitationStatus, error) {
|
||||
if v == nil {
|
||||
return nil, nil
|
||||
}
|
||||
tmp, err := graphql.UnmarshalString(v)
|
||||
res := unmarshalOInvitationStatus2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐInvitationStatus[tmp]
|
||||
return &res, graphql.ErrorOnPath(ctx, err)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalOInvitationStatus2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐInvitationStatus(ctx context.Context, sel ast.SelectionSet, v *coredata.InvitationStatus) graphql.Marshaler {
|
||||
if v == nil {
|
||||
return graphql.Null
|
||||
}
|
||||
_ = sel
|
||||
_ = ctx
|
||||
res := graphql.MarshalString(marshalOInvitationStatus2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐInvitationStatus[*v])
|
||||
return res
|
||||
}
|
||||
|
||||
var (
|
||||
unmarshalOInvitationStatus2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐInvitationStatus = map[string]coredata.InvitationStatus{
|
||||
"PENDING": coredata.InvitationStatusPending,
|
||||
"ACCEPTED": coredata.InvitationStatusAccepted,
|
||||
"EXPIRED": coredata.InvitationStatusExpired,
|
||||
}
|
||||
marshalOInvitationStatus2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐInvitationStatus = map[coredata.InvitationStatus]string{
|
||||
coredata.InvitationStatusPending: "PENDING",
|
||||
coredata.InvitationStatusAccepted: "ACCEPTED",
|
||||
coredata.InvitationStatusExpired: "EXPIRED",
|
||||
}
|
||||
)
|
||||
|
||||
func (ec *executionContext) marshalOMeasure2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐMeasure(ctx context.Context, sel ast.SelectionSet, v *types.Measure) graphql.Marshaler {
|
||||
if v == nil {
|
||||
return graphql.Null
|
||||
|
||||
@@ -1208,14 +1208,15 @@ type ImportMeasurePayload struct {
|
||||
}
|
||||
|
||||
type Invitation struct {
|
||||
ID gid.GID `json:"id"`
|
||||
Email string `json:"email"`
|
||||
FullName string `json:"fullName"`
|
||||
Role string `json:"role"`
|
||||
ExpiresAt time.Time `json:"expiresAt"`
|
||||
AcceptedAt *time.Time `json:"acceptedAt,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
Organization *Organization `json:"organization"`
|
||||
ID gid.GID `json:"id"`
|
||||
Email string `json:"email"`
|
||||
FullName string `json:"fullName"`
|
||||
Role string `json:"role"`
|
||||
Status coredata.InvitationStatus `json:"status"`
|
||||
ExpiresAt time.Time `json:"expiresAt"`
|
||||
AcceptedAt *time.Time `json:"acceptedAt,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
Organization *Organization `json:"organization"`
|
||||
}
|
||||
|
||||
func (Invitation) IsNode() {}
|
||||
@@ -1227,7 +1228,7 @@ type InvitationEdge struct {
|
||||
}
|
||||
|
||||
type InvitationFilter struct {
|
||||
OnlyPending *bool `json:"onlyPending,omitempty"`
|
||||
Status *coredata.InvitationStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
type InvitationOrder struct {
|
||||
|
||||
@@ -919,7 +919,7 @@ func (r *invitationConnectionResolver) TotalCount(ctx context.Context, obj *type
|
||||
|
||||
invitationFilter := coredata.NewInvitationFilter(nil)
|
||||
if obj.Filter != nil {
|
||||
invitationFilter = coredata.NewInvitationFilter(obj.Filter.OnlyPending)
|
||||
invitationFilter = coredata.NewInvitationFilter(obj.Filter.Status)
|
||||
}
|
||||
|
||||
count, err := r.authzSvc.CountUserInvitations(ctx, user.EmailAddress, invitationFilter)
|
||||
@@ -5353,7 +5353,7 @@ func (r *viewerResolver) Invitations(ctx context.Context, obj *types.Viewer, fir
|
||||
|
||||
invitationFilter := coredata.NewInvitationFilter(nil)
|
||||
if filter != nil {
|
||||
invitationFilter = coredata.NewInvitationFilter(filter.OnlyPending)
|
||||
invitationFilter = coredata.NewInvitationFilter(filter.Status)
|
||||
}
|
||||
|
||||
invitations, err := r.authzSvc.GetUserInvitations(ctx, user.EmailAddress, cursor, invitationFilter)
|
||||
|
||||
Reference in New Issue
Block a user