diff --git a/cmd/cli/cmd/organization/create.go b/cmd/cli/cmd/organization/create.go index c442924b..689ffcd7 100644 --- a/cmd/cli/cmd/organization/create.go +++ b/cmd/cli/cmd/organization/create.go @@ -3,9 +3,11 @@ package org import ( "context" + "github.com/99designs/gqlgen/graphql" "github.com/spf13/cobra" "github.com/theopenlane/core/cmd/cli/cmd" + "github.com/theopenlane/core/pkg/objects" "github.com/theopenlane/core/pkg/openlaneclient" ) @@ -26,6 +28,7 @@ func init() { createCmd.Flags().StringP("description", "d", "", "description of the organization") createCmd.Flags().StringP("parent-org-id", "p", "", "parent organization id, leave empty to create a root org") createCmd.Flags().StringSlice("tags", []string{}, "tags associated with the organization") + createCmd.Flags().StringP("avatar-file", "a", "", "local of avatar file to upload") // TODO: https://github.com/theopenlane/core/issues/734 // remove flag once the feature is implemented @@ -33,10 +36,10 @@ func init() { } // createValidation validates the required fields for the command -func createValidation() (input openlaneclient.CreateOrganizationInput, err error) { +func createValidation() (input openlaneclient.CreateOrganizationInput, avatarFile *graphql.Upload, err error) { input.Name = cmd.Config.String("name") if input.Name == "" { - return input, cmd.NewRequiredFieldMissingError("organization name") + return input, nil, cmd.NewRequiredFieldMissingError("organization name") } displayName := cmd.Config.String("display-name") @@ -64,7 +67,22 @@ func createValidation() (input openlaneclient.CreateOrganizationInput, err error input.Tags = tags } - return input, nil + avatarFileLoc := cmd.Config.String("avatar-file") + if avatarFileLoc != "" { + file, err := objects.NewUploadFile(avatarFileLoc) + if err != nil { + return input, nil, err + } + + avatarFile = &graphql.Upload{ + File: file.File, + Filename: file.Filename, + Size: file.Size, + ContentType: file.ContentType, + } + } + + return input, avatarFile, nil } // create an organization in the platform @@ -78,10 +96,10 @@ func create(ctx context.Context) error { defer cmd.StoreSessionCookies(client) } - input, err := createValidation() + input, avatarFile, err := createValidation() cobra.CheckErr(err) - o, err := client.CreateOrganization(ctx, input) + o, err := client.CreateOrganization(ctx, input, avatarFile) cobra.CheckErr(err) return consoleOutput(o) diff --git a/cmd/cli/cmd/organization/update.go b/cmd/cli/cmd/organization/update.go index 329f0665..f1ef5ed0 100644 --- a/cmd/cli/cmd/organization/update.go +++ b/cmd/cli/cmd/organization/update.go @@ -3,9 +3,11 @@ package org import ( "context" + "github.com/99designs/gqlgen/graphql" "github.com/spf13/cobra" "github.com/theopenlane/core/cmd/cli/cmd" + "github.com/theopenlane/core/pkg/objects" "github.com/theopenlane/core/pkg/openlaneclient" ) @@ -28,10 +30,10 @@ func init() { } // updateValidation validates the required fields for the command -func updateValidation() (id string, input openlaneclient.UpdateOrganizationInput, err error) { +func updateValidation() (id string, input openlaneclient.UpdateOrganizationInput, avatarFile *graphql.Upload, err error) { id = cmd.Config.String("id") if id == "" { - return id, input, cmd.NewRequiredFieldMissingError("organization id") + return id, input, nil, cmd.NewRequiredFieldMissingError("organization id") } name := cmd.Config.String("name") @@ -49,7 +51,22 @@ func updateValidation() (id string, input openlaneclient.UpdateOrganizationInput input.Description = &description } - return id, input, nil + avatarFileLoc := cmd.Config.String("avatar-file") + if avatarFileLoc != "" { + file, err := objects.NewUploadFile(avatarFileLoc) + if err != nil { + return id, input, nil, err + } + + avatarFile = &graphql.Upload{ + File: file.File, + Filename: file.Filename, + Size: file.Size, + ContentType: file.ContentType, + } + } + + return id, input, avatarFile, nil } // update an existing organization in the platform @@ -63,10 +80,10 @@ func update(ctx context.Context) error { defer cmd.StoreSessionCookies(client) } - id, input, err := updateValidation() + id, input, avatarFile, err := updateValidation() cobra.CheckErr(err) - o, err := client.UpdateOrganization(ctx, id, input) + o, err := client.UpdateOrganization(ctx, id, input, avatarFile) cobra.CheckErr(err) return consoleOutput(o) diff --git a/cmd/serve.go b/cmd/serve.go index fbcd21d4..672adc4b 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -111,6 +111,7 @@ func serve(ctx context.Context) error { ent.EntConfig(&so.Config.Settings.EntConfig), ent.Emailer(&so.Config.Settings.Email), ent.EntitlementManager(so.Config.Handler.Entitlements), + ent.ObjectManager(so.Config.ObjectManager), ) // Setup DB connection diff --git a/config/.env.example b/config/.env.example index 0aa940e2..22a240d5 100644 --- a/config/.env.example +++ b/config/.env.example @@ -150,6 +150,7 @@ CORE_OBJECTSTORAGE_REGION="" CORE_OBJECTSTORAGE_SECRETKEY="" CORE_OBJECTSTORAGE_CREDENTIALSJSON="" CORE_OBJECTSTORAGE_DEFAULTBUCKET="file_uploads" +CORE_OBJECTSTORAGE_LOCALURL="http://localhost:17608/files/" CORE_OBJECTSTORAGE_KEYS="[uploadFile]" CORE_SUBSCRIPTION_ENABLED="false" CORE_SUBSCRIPTION_PUBLICSTRIPEKEY="" diff --git a/config/config-dev.example.yaml b/config/config-dev.example.yaml index 40230e17..245d40dc 100644 --- a/config/config-dev.example.yaml +++ b/config/config-dev.example.yaml @@ -98,9 +98,19 @@ entConfig: useListUserService: true objectStorage: + # when using local storage, we serve the files up on a static handler + # if switching to s3, be sure to use the below defaultBucket instead + defaultBucket: "file_uploads # uncomment and update to enable s3, otherwise it will default to local storage # accessKey: "REDACTED" # secretKey: "REDACTED" # region: "us-east-2" - # defaultBucket: "openlane" + # defaultBucket: "openlane-development" # provider: "s3" + +subscription: + enabled: false + privateStripeKey: "sk_test_REDCATED" + publicStripeKey: "pk_test_REDACTED" + trialSubscriptionPriceID: price_REDACTED + stripeBillingPortalSuccessURL: http://localhost:3001/organization-settings/billing \ No newline at end of file diff --git a/config/config.example.yaml b/config/config.example.yaml index 50203947..219cb64d 100644 --- a/config/config.example.yaml +++ b/config/config.example.yaml @@ -112,6 +112,7 @@ objectStorage: enabled: true keys: - uploadFile + localURL: http://localhost:17608/files/ provider: "" region: "" secretKey: "" diff --git a/config/configmap.yaml b/config/configmap.yaml index 84376e61..ea6e4cdd 100644 --- a/config/configmap.yaml +++ b/config/configmap.yaml @@ -162,6 +162,7 @@ data: CORE_OBJECTSTORAGE_SECRETKEY: {{ .Values.core.objectStorage.secretKey }} CORE_OBJECTSTORAGE_CREDENTIALSJSON: {{ .Values.core.objectStorage.credentialsJSON }} CORE_OBJECTSTORAGE_DEFAULTBUCKET: {{ .Values.core.objectStorage.defaultBucket | default "file_uploads" }} + CORE_OBJECTSTORAGE_LOCALURL: {{ .Values.core.objectStorage.localURL | default "http://localhost:17608/files/" }} CORE_OBJECTSTORAGE_KEYS: {{ .Values.core.objectStorage.keys | default "uploadFile" }} CORE_SUBSCRIPTION_ENABLED: {{ .Values.core.subscription.enabled | default false }} CORE_SUBSCRIPTION_PUBLICSTRIPEKEY: {{ .Values.core.subscription.publicStripeKey }} diff --git a/db/migrations-goose-postgres/20250114212723_avatar_files.sql b/db/migrations-goose-postgres/20250114212723_avatar_files.sql new file mode 100644 index 00000000..dca5fefa --- /dev/null +++ b/db/migrations-goose-postgres/20250114212723_avatar_files.sql @@ -0,0 +1,19 @@ +-- +goose Up +-- modify "organization_history" table +ALTER TABLE "organization_history" ADD COLUMN "avatar_local_file_id" character varying NULL, ADD COLUMN "avatar_updated_at" timestamptz NULL; +-- modify "user_history" table +ALTER TABLE "user_history" DROP COLUMN "avatar_local_file"; +-- modify "organizations" table +ALTER TABLE "organizations" ADD COLUMN "avatar_updated_at" timestamptz NULL, ADD COLUMN "avatar_local_file_id" character varying NULL, ADD CONSTRAINT "organizations_files_avatar_file" FOREIGN KEY ("avatar_local_file_id") REFERENCES "files" ("id") ON UPDATE NO ACTION ON DELETE SET NULL; +-- modify "users" table +ALTER TABLE "users" DROP CONSTRAINT "users_files_file", DROP COLUMN "avatar_local_file", ADD CONSTRAINT "users_files_avatar_file" FOREIGN KEY ("avatar_local_file_id") REFERENCES "files" ("id") ON UPDATE NO ACTION ON DELETE SET NULL; + +-- +goose Down +-- reverse: modify "users" table +ALTER TABLE "users" DROP CONSTRAINT "users_files_avatar_file", ADD COLUMN "avatar_local_file" character varying NULL, ADD CONSTRAINT "users_files_file" FOREIGN KEY ("avatar_local_file_id") REFERENCES "files" ("id") ON UPDATE NO ACTION ON DELETE SET NULL; +-- reverse: modify "organizations" table +ALTER TABLE "organizations" DROP CONSTRAINT "organizations_files_avatar_file", DROP COLUMN "avatar_local_file_id", DROP COLUMN "avatar_updated_at"; +-- reverse: modify "user_history" table +ALTER TABLE "user_history" ADD COLUMN "avatar_local_file" character varying NULL; +-- reverse: modify "organization_history" table +ALTER TABLE "organization_history" DROP COLUMN "avatar_updated_at", DROP COLUMN "avatar_local_file_id"; diff --git a/db/migrations-goose-postgres/atlas.sum b/db/migrations-goose-postgres/atlas.sum index dba4233a..a3be1e93 100644 --- a/db/migrations-goose-postgres/atlas.sum +++ b/db/migrations-goose-postgres/atlas.sum @@ -1,7 +1,8 @@ -h1:qOVARrtau4JhKV7gKSBoYBVqrfJctYhpjEu7VsnI0cY= +h1:I6+x6Xrpl6vRY8YmytqV1hS1C6AN5rIiydu0/AibHFo= 20241211231032_init.sql h1:Cj6GduEDECy6Y+8DfI6767WosqG2AKWybIyJJ6AgKqA= 20241212223714_consistent_naming.sql h1:RvnNmsStlHkmAdSCnX1fFh/KYgfj1RMYYEc4iCN9JcQ= 20250109002850_billing_address.sql h1:m0ek3WXqRgS3+ZbSa/DcIMB16vb8Tjm2MgNqyRll3rU= 20250109054654_remove_stripe_id.sql h1:OfeshKT2+ydfx+36e4uBrdQ31tuurcJsKXyYDp1ZiZg= 20250110162830_subscription_price.sql h1:ju8ocKPbqtOalaBZ1aGk8qCDLbgxFCDoA0Dmkr9bLzA= 20250110233413_orgsubsfeatures.sql h1:bEdXn+bDT7GuWRRkCYiFCK6t91DxjeEmkFWme2K/lCw= +20250114212723_avatar_files.sql h1:CmUGP2CRigFaGGhFdUt0uIDTOSy1HhIqao++18/KWsU= diff --git a/db/migrations/20250114212722_avatar_files.sql b/db/migrations/20250114212722_avatar_files.sql new file mode 100644 index 00000000..7fc6a528 --- /dev/null +++ b/db/migrations/20250114212722_avatar_files.sql @@ -0,0 +1,8 @@ +-- Modify "organization_history" table +ALTER TABLE "organization_history" ADD COLUMN "avatar_local_file_id" character varying NULL, ADD COLUMN "avatar_updated_at" timestamptz NULL; +-- Modify "user_history" table +ALTER TABLE "user_history" DROP COLUMN "avatar_local_file"; +-- Modify "organizations" table +ALTER TABLE "organizations" ADD COLUMN "avatar_updated_at" timestamptz NULL, ADD COLUMN "avatar_local_file_id" character varying NULL, ADD CONSTRAINT "organizations_files_avatar_file" FOREIGN KEY ("avatar_local_file_id") REFERENCES "files" ("id") ON UPDATE NO ACTION ON DELETE SET NULL; +-- Modify "users" table +ALTER TABLE "users" DROP CONSTRAINT "users_files_file", DROP COLUMN "avatar_local_file", ADD CONSTRAINT "users_files_avatar_file" FOREIGN KEY ("avatar_local_file_id") REFERENCES "files" ("id") ON UPDATE NO ACTION ON DELETE SET NULL; diff --git a/db/migrations/atlas.sum b/db/migrations/atlas.sum index 438a1f4f..7f5d6c58 100644 --- a/db/migrations/atlas.sum +++ b/db/migrations/atlas.sum @@ -1,7 +1,8 @@ -h1:FGyFOEh4ppoGd8KFzmyYNWHxBSlqreNG+TaZcAn068s= +h1:nnvTXfxLz/fAZVJmA5IH5Wq/G2NRRReWMDac4P6EMmY= 20241211231032_init.sql h1:TxjpHzKPB/5L2i7V2JfO1y+Cep/AyQN5wGjhY7saCeE= 20241212223712_consistent_naming.sql h1:tbdYOtixhW66Jmvy3aCm+X6neI/SRVvItKM0Bdn26TA= 20250109002849_billing_address.sql h1:mspCGbJ6HVmx3r4j+d/WvruzirJdJ8u5x18WF9R9ESE= 20250109054653_remove_stripe_id.sql h1:dB086/w/Ws7ZK8OvbRWX7ejN4HfizCKxcE3q/+Jv4U8= 20250110162828_subscription_price.sql h1:RlvrTtH6+PIFuJ+Fp5S06w0ho3B2O/Nn6QcWqSHLWEA= 20250110233411_orgsubsfeatures.sql h1:ZPBc/gedwoVMzJz6M/AN3yhtRmqdTuZsPvfIsWQj4fY= +20250114212722_avatar_files.sql h1:exooeELaAAu1jCnyjtok9WDC7WUxoPIeE6EBGFwhplU= diff --git a/internal/ent/generate/entc.go b/internal/ent/generate/entc.go index e4cdcf07..61eb4fa0 100644 --- a/internal/ent/generate/entc.go +++ b/internal/ent/generate/entc.go @@ -27,6 +27,7 @@ import ( "github.com/theopenlane/core/internal/ent/entconfig" "github.com/theopenlane/core/pkg/entitlements" + "github.com/theopenlane/core/pkg/objects" "github.com/theopenlane/core/internal/genhelpers" ) @@ -123,6 +124,10 @@ func main() { entc.DependencyName("EntitlementManager"), entc.DependencyType(&entitlements.StripeClient{}), ), + entc.Dependency( + entc.DependencyName("ObjectManager"), + entc.DependencyType(&objects.Objects{}), + ), entc.TemplateDir("./internal/ent/templates"), entc.Extensions( gqlExt, diff --git a/internal/ent/generated/auditing.go b/internal/ent/generated/auditing.go index 9544bc00..4f54278d 100644 --- a/internal/ent/generated/auditing.go +++ b/internal/ent/generated/auditing.go @@ -1435,6 +1435,12 @@ func (oh *OrganizationHistory) changes(new *OrganizationHistory) []Change { if !reflect.DeepEqual(oh.AvatarRemoteURL, new.AvatarRemoteURL) { changes = append(changes, NewChange(organizationhistory.FieldAvatarRemoteURL, oh.AvatarRemoteURL, new.AvatarRemoteURL)) } + if !reflect.DeepEqual(oh.AvatarLocalFileID, new.AvatarLocalFileID) { + changes = append(changes, NewChange(organizationhistory.FieldAvatarLocalFileID, oh.AvatarLocalFileID, new.AvatarLocalFileID)) + } + if !reflect.DeepEqual(oh.AvatarUpdatedAt, new.AvatarUpdatedAt) { + changes = append(changes, NewChange(organizationhistory.FieldAvatarUpdatedAt, oh.AvatarUpdatedAt, new.AvatarUpdatedAt)) + } if !reflect.DeepEqual(oh.DedicatedDb, new.DedicatedDb) { changes = append(changes, NewChange(organizationhistory.FieldDedicatedDb, oh.DedicatedDb, new.DedicatedDb)) } @@ -2203,9 +2209,6 @@ func (uh *UserHistory) changes(new *UserHistory) []Change { if !reflect.DeepEqual(uh.AvatarRemoteURL, new.AvatarRemoteURL) { changes = append(changes, NewChange(userhistory.FieldAvatarRemoteURL, uh.AvatarRemoteURL, new.AvatarRemoteURL)) } - if !reflect.DeepEqual(uh.AvatarLocalFile, new.AvatarLocalFile) { - changes = append(changes, NewChange(userhistory.FieldAvatarLocalFile, uh.AvatarLocalFile, new.AvatarLocalFile)) - } if !reflect.DeepEqual(uh.AvatarLocalFileID, new.AvatarLocalFileID) { changes = append(changes, NewChange(userhistory.FieldAvatarLocalFileID, uh.AvatarLocalFileID, new.AvatarLocalFileID)) } diff --git a/internal/ent/generated/client.go b/internal/ent/generated/client.go index 21352d12..99121baf 100644 --- a/internal/ent/generated/client.go +++ b/internal/ent/generated/client.go @@ -90,6 +90,7 @@ import ( "github.com/theopenlane/core/internal/ent/generated/usersettinghistory" "github.com/theopenlane/core/internal/ent/generated/webauthn" "github.com/theopenlane/core/pkg/entitlements" + "github.com/theopenlane/core/pkg/objects" "github.com/theopenlane/emailtemplates" "github.com/theopenlane/iam/fgax" "github.com/theopenlane/iam/sessions" @@ -362,6 +363,7 @@ type ( Emailer *emailtemplates.Config TOTP *totp.Manager EntitlementManager *entitlements.StripeClient + ObjectManager *objects.Objects // Job is the job client to insert jobs into the queue. Job riverqueue.JobClient @@ -466,6 +468,13 @@ func EntitlementManager(v *entitlements.StripeClient) Option { } } +// ObjectManager configures the ObjectManager. +func ObjectManager(v *objects.Objects) Option { + return func(c *config) { + c.ObjectManager = v + } +} + // Open opens a database/sql.DB specified by the driver name and // the data source name, and returns a new client attached to it. // Optional parameters can be added for configuring the client. @@ -9786,6 +9795,25 @@ func (c *OrganizationClient) QueryFiles(o *Organization) *FileQuery { return query } +// QueryAvatarFile queries the avatar_file edge of a Organization. +func (c *OrganizationClient) QueryAvatarFile(o *Organization) *FileQuery { + query := (&FileClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := o.ID + step := sqlgraph.NewStep( + sqlgraph.From(organization.Table, organization.FieldID, id), + sqlgraph.To(file.Table, file.FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, organization.AvatarFileTable, organization.AvatarFileColumn), + ) + schemaConfig := o.schemaConfig + step.To.Schema = schemaConfig.File + step.Edge.Schema = schemaConfig.Organization + fromV = sqlgraph.Neighbors(o.driver.Dialect(), step) + return fromV, nil + } + return query +} + // QueryEntities queries the entities edge of a Organization. func (c *OrganizationClient) QueryEntities(o *Organization) *EntityQuery { query := (&EntityClient{config: c.config}).Query() @@ -14782,15 +14810,15 @@ func (c *UserClient) QueryFiles(u *User) *FileQuery { return query } -// QueryFile queries the file edge of a User. -func (c *UserClient) QueryFile(u *User) *FileQuery { +// QueryAvatarFile queries the avatar_file edge of a User. +func (c *UserClient) QueryAvatarFile(u *User) *FileQuery { query := (&FileClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := u.ID step := sqlgraph.NewStep( sqlgraph.From(user.Table, user.FieldID, id), sqlgraph.To(file.Table, file.FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, user.FileTable, user.FileColumn), + sqlgraph.Edge(sqlgraph.M2O, false, user.AvatarFileTable, user.AvatarFileColumn), ) schemaConfig := u.schemaConfig step.To.Schema = schemaConfig.File diff --git a/internal/ent/generated/entql.go b/internal/ent/generated/entql.go index 1c023d70..f427442e 100644 --- a/internal/ent/generated/entql.go +++ b/internal/ent/generated/entql.go @@ -1282,6 +1282,8 @@ var schemaGraph = func() *sqlgraph.Schema { organization.FieldParentOrganizationID: {Type: field.TypeString, Column: organization.FieldParentOrganizationID}, organization.FieldPersonalOrg: {Type: field.TypeBool, Column: organization.FieldPersonalOrg}, organization.FieldAvatarRemoteURL: {Type: field.TypeString, Column: organization.FieldAvatarRemoteURL}, + organization.FieldAvatarLocalFileID: {Type: field.TypeString, Column: organization.FieldAvatarLocalFileID}, + organization.FieldAvatarUpdatedAt: {Type: field.TypeTime, Column: organization.FieldAvatarUpdatedAt}, organization.FieldDedicatedDb: {Type: field.TypeBool, Column: organization.FieldDedicatedDb}, }, } @@ -1313,6 +1315,8 @@ var schemaGraph = func() *sqlgraph.Schema { organizationhistory.FieldParentOrganizationID: {Type: field.TypeString, Column: organizationhistory.FieldParentOrganizationID}, organizationhistory.FieldPersonalOrg: {Type: field.TypeBool, Column: organizationhistory.FieldPersonalOrg}, organizationhistory.FieldAvatarRemoteURL: {Type: field.TypeString, Column: organizationhistory.FieldAvatarRemoteURL}, + organizationhistory.FieldAvatarLocalFileID: {Type: field.TypeString, Column: organizationhistory.FieldAvatarLocalFileID}, + organizationhistory.FieldAvatarUpdatedAt: {Type: field.TypeTime, Column: organizationhistory.FieldAvatarUpdatedAt}, organizationhistory.FieldDedicatedDb: {Type: field.TypeBool, Column: organizationhistory.FieldDedicatedDb}, }, } @@ -2016,7 +2020,6 @@ var schemaGraph = func() *sqlgraph.Schema { user.FieldLastName: {Type: field.TypeString, Column: user.FieldLastName}, user.FieldDisplayName: {Type: field.TypeString, Column: user.FieldDisplayName}, user.FieldAvatarRemoteURL: {Type: field.TypeString, Column: user.FieldAvatarRemoteURL}, - user.FieldAvatarLocalFile: {Type: field.TypeString, Column: user.FieldAvatarLocalFile}, user.FieldAvatarLocalFileID: {Type: field.TypeString, Column: user.FieldAvatarLocalFileID}, user.FieldAvatarUpdatedAt: {Type: field.TypeTime, Column: user.FieldAvatarUpdatedAt}, user.FieldLastSeen: {Type: field.TypeTime, Column: user.FieldLastSeen}, @@ -2053,7 +2056,6 @@ var schemaGraph = func() *sqlgraph.Schema { userhistory.FieldLastName: {Type: field.TypeString, Column: userhistory.FieldLastName}, userhistory.FieldDisplayName: {Type: field.TypeString, Column: userhistory.FieldDisplayName}, userhistory.FieldAvatarRemoteURL: {Type: field.TypeString, Column: userhistory.FieldAvatarRemoteURL}, - userhistory.FieldAvatarLocalFile: {Type: field.TypeString, Column: userhistory.FieldAvatarLocalFile}, userhistory.FieldAvatarLocalFileID: {Type: field.TypeString, Column: userhistory.FieldAvatarLocalFileID}, userhistory.FieldAvatarUpdatedAt: {Type: field.TypeTime, Column: userhistory.FieldAvatarUpdatedAt}, userhistory.FieldLastSeen: {Type: field.TypeTime, Column: userhistory.FieldLastSeen}, @@ -4184,6 +4186,18 @@ var schemaGraph = func() *sqlgraph.Schema { "Organization", "File", ) + graph.MustAddE( + "avatar_file", + &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: organization.AvatarFileTable, + Columns: []string{organization.AvatarFileColumn}, + Bidi: false, + }, + "Organization", + "File", + ) graph.MustAddE( "entities", &sqlgraph.EdgeSpec{ @@ -5301,12 +5315,12 @@ var schemaGraph = func() *sqlgraph.Schema { "File", ) graph.MustAddE( - "file", + "avatar_file", &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: false, - Table: user.FileTable, - Columns: []string{user.FileColumn}, + Table: user.AvatarFileTable, + Columns: []string{user.AvatarFileColumn}, Bidi: false, }, "User", @@ -12443,6 +12457,16 @@ func (f *OrganizationFilter) WhereAvatarRemoteURL(p entql.StringP) { f.Where(p.Field(organization.FieldAvatarRemoteURL)) } +// WhereAvatarLocalFileID applies the entql string predicate on the avatar_local_file_id field. +func (f *OrganizationFilter) WhereAvatarLocalFileID(p entql.StringP) { + f.Where(p.Field(organization.FieldAvatarLocalFileID)) +} + +// WhereAvatarUpdatedAt applies the entql time.Time predicate on the avatar_updated_at field. +func (f *OrganizationFilter) WhereAvatarUpdatedAt(p entql.TimeP) { + f.Where(p.Field(organization.FieldAvatarUpdatedAt)) +} + // WhereDedicatedDb applies the entql bool predicate on the dedicated_db field. func (f *OrganizationFilter) WhereDedicatedDb(p entql.BoolP) { f.Where(p.Field(organization.FieldDedicatedDb)) @@ -12798,6 +12822,20 @@ func (f *OrganizationFilter) WhereHasFilesWith(preds ...predicate.File) { }))) } +// WhereHasAvatarFile applies a predicate to check if query has an edge avatar_file. +func (f *OrganizationFilter) WhereHasAvatarFile() { + f.Where(entql.HasEdge("avatar_file")) +} + +// WhereHasAvatarFileWith applies a predicate to check if query has an edge avatar_file with a given conditions (other predicates). +func (f *OrganizationFilter) WhereHasAvatarFileWith(preds ...predicate.File) { + f.Where(entql.HasEdgeWith("avatar_file", sqlgraph.WrapFunc(func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }))) +} + // WhereHasEntities applies a predicate to check if query has an edge entities. func (f *OrganizationFilter) WhereHasEntities() { f.Where(entql.HasEdge("entities")) @@ -13119,6 +13157,16 @@ func (f *OrganizationHistoryFilter) WhereAvatarRemoteURL(p entql.StringP) { f.Where(p.Field(organizationhistory.FieldAvatarRemoteURL)) } +// WhereAvatarLocalFileID applies the entql string predicate on the avatar_local_file_id field. +func (f *OrganizationHistoryFilter) WhereAvatarLocalFileID(p entql.StringP) { + f.Where(p.Field(organizationhistory.FieldAvatarLocalFileID)) +} + +// WhereAvatarUpdatedAt applies the entql time.Time predicate on the avatar_updated_at field. +func (f *OrganizationHistoryFilter) WhereAvatarUpdatedAt(p entql.TimeP) { + f.Where(p.Field(organizationhistory.FieldAvatarUpdatedAt)) +} + // WhereDedicatedDb applies the entql bool predicate on the dedicated_db field. func (f *OrganizationHistoryFilter) WhereDedicatedDb(p entql.BoolP) { f.Where(p.Field(organizationhistory.FieldDedicatedDb)) @@ -17039,11 +17087,6 @@ func (f *UserFilter) WhereAvatarRemoteURL(p entql.StringP) { f.Where(p.Field(user.FieldAvatarRemoteURL)) } -// WhereAvatarLocalFile applies the entql string predicate on the avatar_local_file field. -func (f *UserFilter) WhereAvatarLocalFile(p entql.StringP) { - f.Where(p.Field(user.FieldAvatarLocalFile)) -} - // WhereAvatarLocalFileID applies the entql string predicate on the avatar_local_file_id field. func (f *UserFilter) WhereAvatarLocalFileID(p entql.StringP) { f.Where(p.Field(user.FieldAvatarLocalFileID)) @@ -17205,14 +17248,14 @@ func (f *UserFilter) WhereHasFilesWith(preds ...predicate.File) { }))) } -// WhereHasFile applies a predicate to check if query has an edge file. -func (f *UserFilter) WhereHasFile() { - f.Where(entql.HasEdge("file")) +// WhereHasAvatarFile applies a predicate to check if query has an edge avatar_file. +func (f *UserFilter) WhereHasAvatarFile() { + f.Where(entql.HasEdge("avatar_file")) } -// WhereHasFileWith applies a predicate to check if query has an edge file with a given conditions (other predicates). -func (f *UserFilter) WhereHasFileWith(preds ...predicate.File) { - f.Where(entql.HasEdgeWith("file", sqlgraph.WrapFunc(func(s *sql.Selector) { +// WhereHasAvatarFileWith applies a predicate to check if query has an edge avatar_file with a given conditions (other predicates). +func (f *UserFilter) WhereHasAvatarFileWith(preds ...predicate.File) { + f.Where(entql.HasEdgeWith("avatar_file", sqlgraph.WrapFunc(func(s *sql.Selector) { for _, p := range preds { p(s) } @@ -17465,11 +17508,6 @@ func (f *UserHistoryFilter) WhereAvatarRemoteURL(p entql.StringP) { f.Where(p.Field(userhistory.FieldAvatarRemoteURL)) } -// WhereAvatarLocalFile applies the entql string predicate on the avatar_local_file field. -func (f *UserHistoryFilter) WhereAvatarLocalFile(p entql.StringP) { - f.Where(p.Field(userhistory.FieldAvatarLocalFile)) -} - // WhereAvatarLocalFileID applies the entql string predicate on the avatar_local_file_id field. func (f *UserHistoryFilter) WhereAvatarLocalFileID(p entql.StringP) { f.Where(p.Field(userhistory.FieldAvatarLocalFileID)) diff --git a/internal/ent/generated/file.go b/internal/ent/generated/file.go index 049965a1..b0fd5b86 100644 --- a/internal/ent/generated/file.go +++ b/internal/ent/generated/file.go @@ -66,6 +66,8 @@ type File struct { // The values are being populated by the FileQuery when eager-loading is set. Edges FileEdges `json:"edges"` selectValues sql.SelectValues + + PresignedURL string `json:"presignedURL,omitempty"` } // FileEdges holds the relations/edges for other nodes in the graph. diff --git a/internal/ent/generated/file/file.go b/internal/ent/generated/file/file.go index 3c4a02c7..57eb4e95 100644 --- a/internal/ent/generated/file/file.go +++ b/internal/ent/generated/file/file.go @@ -220,7 +220,7 @@ func ValidColumn(column string) bool { // import _ "github.com/theopenlane/core/internal/ent/generated/runtime" var ( Hooks [3]ent.Hook - Interceptors [2]ent.Interceptor + Interceptors [3]ent.Interceptor Policy ent.Policy // DefaultCreatedAt holds the default value on creation for the "created_at" field. DefaultCreatedAt func() time.Time diff --git a/internal/ent/generated/gql_collection.go b/internal/ent/generated/gql_collection.go index 3337be00..24d422a6 100644 --- a/internal/ent/generated/gql_collection.go +++ b/internal/ent/generated/gql_collection.go @@ -8009,6 +8009,21 @@ func (o *OrganizationQuery) collectField(ctx context.Context, oneNode bool, opCt *wq = *query }) + case "avatarFile": + var ( + alias = field.Alias + path = append(path, alias) + query = (&FileClient{config: o.config}).Query() + ) + if err := query.collectField(ctx, oneNode, opCtx, field, path, mayAddCondition(satisfies, fileImplementors)...); err != nil { + return err + } + o.withAvatarFile = query + if _, ok := fieldSeen[organization.FieldAvatarLocalFileID]; !ok { + selectedFields = append(selectedFields, organization.FieldAvatarLocalFileID) + fieldSeen[organization.FieldAvatarLocalFileID] = struct{}{} + } + case "entities": var ( alias = field.Alias @@ -8250,6 +8265,16 @@ func (o *OrganizationQuery) collectField(ctx context.Context, oneNode bool, opCt selectedFields = append(selectedFields, organization.FieldAvatarRemoteURL) fieldSeen[organization.FieldAvatarRemoteURL] = struct{}{} } + case "avatarLocalFileID": + if _, ok := fieldSeen[organization.FieldAvatarLocalFileID]; !ok { + selectedFields = append(selectedFields, organization.FieldAvatarLocalFileID) + fieldSeen[organization.FieldAvatarLocalFileID] = struct{}{} + } + case "avatarUpdatedAt": + if _, ok := fieldSeen[organization.FieldAvatarUpdatedAt]; !ok { + selectedFields = append(selectedFields, organization.FieldAvatarUpdatedAt) + fieldSeen[organization.FieldAvatarUpdatedAt] = struct{}{} + } case "dedicatedDb": if _, ok := fieldSeen[organization.FieldDedicatedDb]; !ok { selectedFields = append(selectedFields, organization.FieldDedicatedDb) @@ -8414,6 +8439,16 @@ func (oh *OrganizationHistoryQuery) collectField(ctx context.Context, oneNode bo selectedFields = append(selectedFields, organizationhistory.FieldAvatarRemoteURL) fieldSeen[organizationhistory.FieldAvatarRemoteURL] = struct{}{} } + case "avatarLocalFileID": + if _, ok := fieldSeen[organizationhistory.FieldAvatarLocalFileID]; !ok { + selectedFields = append(selectedFields, organizationhistory.FieldAvatarLocalFileID) + fieldSeen[organizationhistory.FieldAvatarLocalFileID] = struct{}{} + } + case "avatarUpdatedAt": + if _, ok := fieldSeen[organizationhistory.FieldAvatarUpdatedAt]; !ok { + selectedFields = append(selectedFields, organizationhistory.FieldAvatarUpdatedAt) + fieldSeen[organizationhistory.FieldAvatarUpdatedAt] = struct{}{} + } case "dedicatedDb": if _, ok := fieldSeen[organizationhistory.FieldDedicatedDb]; !ok { selectedFields = append(selectedFields, organizationhistory.FieldDedicatedDb) @@ -12589,7 +12624,7 @@ func (u *UserQuery) collectField(ctx context.Context, oneNode bool, opCtx *graph *wq = *query }) - case "file": + case "avatarFile": var ( alias = field.Alias path = append(path, alias) @@ -12598,7 +12633,7 @@ func (u *UserQuery) collectField(ctx context.Context, oneNode bool, opCtx *graph if err := query.collectField(ctx, oneNode, opCtx, field, path, mayAddCondition(satisfies, fileImplementors)...); err != nil { return err } - u.withFile = query + u.withAvatarFile = query if _, ok := fieldSeen[user.FieldAvatarLocalFileID]; !ok { selectedFields = append(selectedFields, user.FieldAvatarLocalFileID) fieldSeen[user.FieldAvatarLocalFileID] = struct{}{} @@ -12780,11 +12815,6 @@ func (u *UserQuery) collectField(ctx context.Context, oneNode bool, opCtx *graph selectedFields = append(selectedFields, user.FieldAvatarRemoteURL) fieldSeen[user.FieldAvatarRemoteURL] = struct{}{} } - case "avatarLocalFile": - if _, ok := fieldSeen[user.FieldAvatarLocalFile]; !ok { - selectedFields = append(selectedFields, user.FieldAvatarLocalFile) - fieldSeen[user.FieldAvatarLocalFile] = struct{}{} - } case "avatarLocalFileID": if _, ok := fieldSeen[user.FieldAvatarLocalFileID]; !ok { selectedFields = append(selectedFields, user.FieldAvatarLocalFileID) @@ -12974,11 +13004,6 @@ func (uh *UserHistoryQuery) collectField(ctx context.Context, oneNode bool, opCt selectedFields = append(selectedFields, userhistory.FieldAvatarRemoteURL) fieldSeen[userhistory.FieldAvatarRemoteURL] = struct{}{} } - case "avatarLocalFile": - if _, ok := fieldSeen[userhistory.FieldAvatarLocalFile]; !ok { - selectedFields = append(selectedFields, userhistory.FieldAvatarLocalFile) - fieldSeen[userhistory.FieldAvatarLocalFile] = struct{}{} - } case "avatarLocalFileID": if _, ok := fieldSeen[userhistory.FieldAvatarLocalFileID]; !ok { selectedFields = append(selectedFields, userhistory.FieldAvatarLocalFileID) diff --git a/internal/ent/generated/gql_edge.go b/internal/ent/generated/gql_edge.go index b61f7717..dd4bc03d 100644 --- a/internal/ent/generated/gql_edge.go +++ b/internal/ent/generated/gql_edge.go @@ -1933,6 +1933,14 @@ func (o *Organization) Files(ctx context.Context) (result []*File, err error) { return result, err } +func (o *Organization) AvatarFile(ctx context.Context) (*File, error) { + result, err := o.Edges.AvatarFileOrErr() + if IsNotLoaded(err) { + result, err = o.QueryAvatarFile().Only(ctx) + } + return result, MaskNotFound(err) +} + func (o *Organization) Entities(ctx context.Context) (result []*Entity, err error) { if fc := graphql.GetFieldContext(ctx); fc != nil && fc.Field.Alias != "" { result, err = o.NamedEntities(graphql.GetFieldContext(ctx).Field.Alias) @@ -2941,10 +2949,10 @@ func (u *User) Files(ctx context.Context) (result []*File, err error) { return result, err } -func (u *User) File(ctx context.Context) (*File, error) { - result, err := u.Edges.FileOrErr() +func (u *User) AvatarFile(ctx context.Context) (*File, error) { + result, err := u.Edges.AvatarFileOrErr() if IsNotLoaded(err) { - result, err = u.QueryFile().Only(ctx) + result, err = u.QueryAvatarFile().Only(ctx) } return result, MaskNotFound(err) } diff --git a/internal/ent/generated/gql_mutation_input.go b/internal/ent/generated/gql_mutation_input.go index cdc61846..e424f3b6 100644 --- a/internal/ent/generated/gql_mutation_input.go +++ b/internal/ent/generated/gql_mutation_input.go @@ -4098,6 +4098,7 @@ type CreateOrganizationInput struct { Description *string PersonalOrg *bool AvatarRemoteURL *string + AvatarUpdatedAt *time.Time DedicatedDb *bool ControlCreatorIDs []string ControlObjectiveCreatorIDs []string @@ -4123,6 +4124,7 @@ type CreateOrganizationInput struct { EventIDs []string SecretIDs []string FileIDs []string + AvatarFileID *string EntityIDs []string EntityTypeIDs []string ContactIDs []string @@ -4156,6 +4158,9 @@ func (i *CreateOrganizationInput) Mutate(m *OrganizationMutation) { if v := i.AvatarRemoteURL; v != nil { m.SetAvatarRemoteURL(*v) } + if v := i.AvatarUpdatedAt; v != nil { + m.SetAvatarUpdatedAt(*v) + } if v := i.DedicatedDb; v != nil { m.SetDedicatedDb(*v) } @@ -4231,6 +4236,9 @@ func (i *CreateOrganizationInput) Mutate(m *OrganizationMutation) { if v := i.FileIDs; len(v) > 0 { m.AddFileIDs(v...) } + if v := i.AvatarFileID; v != nil { + m.SetAvatarFileID(*v) + } if v := i.EntityIDs; len(v) > 0 { m.AddEntityIDs(v...) } @@ -4289,6 +4297,8 @@ type UpdateOrganizationInput struct { Description *string ClearAvatarRemoteURL bool AvatarRemoteURL *string + ClearAvatarUpdatedAt bool + AvatarUpdatedAt *time.Time ClearControlCreators bool AddControlCreatorIDs []string RemoveControlCreatorIDs []string @@ -4357,6 +4367,8 @@ type UpdateOrganizationInput struct { ClearFiles bool AddFileIDs []string RemoveFileIDs []string + ClearAvatarFile bool + AvatarFileID *string ClearEntities bool AddEntityIDs []string RemoveEntityIDs []string @@ -4427,6 +4439,12 @@ func (i *UpdateOrganizationInput) Mutate(m *OrganizationMutation) { if v := i.AvatarRemoteURL; v != nil { m.SetAvatarRemoteURL(*v) } + if i.ClearAvatarUpdatedAt { + m.ClearAvatarUpdatedAt() + } + if v := i.AvatarUpdatedAt; v != nil { + m.SetAvatarUpdatedAt(*v) + } if i.ClearControlCreators { m.ClearControlCreators() } @@ -4631,6 +4649,12 @@ func (i *UpdateOrganizationInput) Mutate(m *OrganizationMutation) { if v := i.RemoveFileIDs; len(v) > 0 { m.RemoveFileIDs(v...) } + if i.ClearAvatarFile { + m.ClearAvatarFile() + } + if v := i.AvatarFileID; v != nil { + m.SetAvatarFileID(*v) + } if i.ClearEntities { m.ClearEntities() } @@ -7212,7 +7236,6 @@ type CreateUserInput struct { LastName *string DisplayName string AvatarRemoteURL *string - AvatarLocalFile *string AvatarUpdatedAt *time.Time LastSeen *time.Time Password *string @@ -7228,7 +7251,7 @@ type CreateUserInput struct { OrganizationIDs []string WebauthnIDs []string FileIDs []string - FileID *string + AvatarFileID *string EventIDs []string ActionPlanIDs []string SubcontrolIDs []string @@ -7253,9 +7276,6 @@ func (i *CreateUserInput) Mutate(m *UserMutation) { if v := i.AvatarRemoteURL; v != nil { m.SetAvatarRemoteURL(*v) } - if v := i.AvatarLocalFile; v != nil { - m.SetAvatarLocalFile(*v) - } if v := i.AvatarUpdatedAt; v != nil { m.SetAvatarUpdatedAt(*v) } @@ -7299,8 +7319,8 @@ func (i *CreateUserInput) Mutate(m *UserMutation) { if v := i.FileIDs; len(v) > 0 { m.AddFileIDs(v...) } - if v := i.FileID; v != nil { - m.SetFileID(*v) + if v := i.AvatarFileID; v != nil { + m.SetAvatarFileID(*v) } if v := i.EventIDs; len(v) > 0 { m.AddEventIDs(v...) @@ -7341,8 +7361,6 @@ type UpdateUserInput struct { DisplayName *string ClearAvatarRemoteURL bool AvatarRemoteURL *string - ClearAvatarLocalFile bool - AvatarLocalFile *string ClearAvatarUpdatedAt bool AvatarUpdatedAt *time.Time ClearLastSeen bool @@ -7379,8 +7397,8 @@ type UpdateUserInput struct { ClearFiles bool AddFileIDs []string RemoveFileIDs []string - ClearFile bool - FileID *string + ClearAvatarFile bool + AvatarFileID *string ClearEvents bool AddEventIDs []string RemoveEventIDs []string @@ -7436,12 +7454,6 @@ func (i *UpdateUserInput) Mutate(m *UserMutation) { if v := i.AvatarRemoteURL; v != nil { m.SetAvatarRemoteURL(*v) } - if i.ClearAvatarLocalFile { - m.ClearAvatarLocalFile() - } - if v := i.AvatarLocalFile; v != nil { - m.SetAvatarLocalFile(*v) - } if i.ClearAvatarUpdatedAt { m.ClearAvatarUpdatedAt() } @@ -7550,11 +7562,11 @@ func (i *UpdateUserInput) Mutate(m *UserMutation) { if v := i.RemoveFileIDs; len(v) > 0 { m.RemoveFileIDs(v...) } - if i.ClearFile { - m.ClearFile() + if i.ClearAvatarFile { + m.ClearAvatarFile() } - if v := i.FileID; v != nil { - m.SetFileID(*v) + if v := i.AvatarFileID; v != nil { + m.SetAvatarFileID(*v) } if i.ClearEvents { m.ClearEvents() diff --git a/internal/ent/generated/gql_where_input.go b/internal/ent/generated/gql_where_input.go index 5de60a2d..ee58fd15 100644 --- a/internal/ent/generated/gql_where_input.go +++ b/internal/ent/generated/gql_where_input.go @@ -35226,6 +35226,35 @@ type OrganizationWhereInput struct { AvatarRemoteURLEqualFold *string `json:"avatarRemoteURLEqualFold,omitempty"` AvatarRemoteURLContainsFold *string `json:"avatarRemoteURLContainsFold,omitempty"` + // "avatar_local_file_id" field predicates. + AvatarLocalFileID *string `json:"avatarLocalFileID,omitempty"` + AvatarLocalFileIDNEQ *string `json:"avatarLocalFileIDNEQ,omitempty"` + AvatarLocalFileIDIn []string `json:"avatarLocalFileIDIn,omitempty"` + AvatarLocalFileIDNotIn []string `json:"avatarLocalFileIDNotIn,omitempty"` + AvatarLocalFileIDGT *string `json:"avatarLocalFileIDGT,omitempty"` + AvatarLocalFileIDGTE *string `json:"avatarLocalFileIDGTE,omitempty"` + AvatarLocalFileIDLT *string `json:"avatarLocalFileIDLT,omitempty"` + AvatarLocalFileIDLTE *string `json:"avatarLocalFileIDLTE,omitempty"` + AvatarLocalFileIDContains *string `json:"avatarLocalFileIDContains,omitempty"` + AvatarLocalFileIDHasPrefix *string `json:"avatarLocalFileIDHasPrefix,omitempty"` + AvatarLocalFileIDHasSuffix *string `json:"avatarLocalFileIDHasSuffix,omitempty"` + AvatarLocalFileIDIsNil bool `json:"avatarLocalFileIDIsNil,omitempty"` + AvatarLocalFileIDNotNil bool `json:"avatarLocalFileIDNotNil,omitempty"` + AvatarLocalFileIDEqualFold *string `json:"avatarLocalFileIDEqualFold,omitempty"` + AvatarLocalFileIDContainsFold *string `json:"avatarLocalFileIDContainsFold,omitempty"` + + // "avatar_updated_at" field predicates. + AvatarUpdatedAt *time.Time `json:"avatarUpdatedAt,omitempty"` + AvatarUpdatedAtNEQ *time.Time `json:"avatarUpdatedAtNEQ,omitempty"` + AvatarUpdatedAtIn []time.Time `json:"avatarUpdatedAtIn,omitempty"` + AvatarUpdatedAtNotIn []time.Time `json:"avatarUpdatedAtNotIn,omitempty"` + AvatarUpdatedAtGT *time.Time `json:"avatarUpdatedAtGT,omitempty"` + AvatarUpdatedAtGTE *time.Time `json:"avatarUpdatedAtGTE,omitempty"` + AvatarUpdatedAtLT *time.Time `json:"avatarUpdatedAtLT,omitempty"` + AvatarUpdatedAtLTE *time.Time `json:"avatarUpdatedAtLTE,omitempty"` + AvatarUpdatedAtIsNil bool `json:"avatarUpdatedAtIsNil,omitempty"` + AvatarUpdatedAtNotNil bool `json:"avatarUpdatedAtNotNil,omitempty"` + // "control_creators" edge predicates. HasControlCreators *bool `json:"hasControlCreators,omitempty"` HasControlCreatorsWith []*GroupWhereInput `json:"hasControlCreatorsWith,omitempty"` @@ -35326,6 +35355,10 @@ type OrganizationWhereInput struct { HasFiles *bool `json:"hasFiles,omitempty"` HasFilesWith []*FileWhereInput `json:"hasFilesWith,omitempty"` + // "avatar_file" edge predicates. + HasAvatarFile *bool `json:"hasAvatarFile,omitempty"` + HasAvatarFileWith []*FileWhereInput `json:"hasAvatarFileWith,omitempty"` + // "entities" edge predicates. HasEntities *bool `json:"hasEntities,omitempty"` HasEntitiesWith []*EntityWhereInput `json:"hasEntitiesWith,omitempty"` @@ -35850,6 +35883,81 @@ func (i *OrganizationWhereInput) P() (predicate.Organization, error) { if i.AvatarRemoteURLContainsFold != nil { predicates = append(predicates, organization.AvatarRemoteURLContainsFold(*i.AvatarRemoteURLContainsFold)) } + if i.AvatarLocalFileID != nil { + predicates = append(predicates, organization.AvatarLocalFileIDEQ(*i.AvatarLocalFileID)) + } + if i.AvatarLocalFileIDNEQ != nil { + predicates = append(predicates, organization.AvatarLocalFileIDNEQ(*i.AvatarLocalFileIDNEQ)) + } + if len(i.AvatarLocalFileIDIn) > 0 { + predicates = append(predicates, organization.AvatarLocalFileIDIn(i.AvatarLocalFileIDIn...)) + } + if len(i.AvatarLocalFileIDNotIn) > 0 { + predicates = append(predicates, organization.AvatarLocalFileIDNotIn(i.AvatarLocalFileIDNotIn...)) + } + if i.AvatarLocalFileIDGT != nil { + predicates = append(predicates, organization.AvatarLocalFileIDGT(*i.AvatarLocalFileIDGT)) + } + if i.AvatarLocalFileIDGTE != nil { + predicates = append(predicates, organization.AvatarLocalFileIDGTE(*i.AvatarLocalFileIDGTE)) + } + if i.AvatarLocalFileIDLT != nil { + predicates = append(predicates, organization.AvatarLocalFileIDLT(*i.AvatarLocalFileIDLT)) + } + if i.AvatarLocalFileIDLTE != nil { + predicates = append(predicates, organization.AvatarLocalFileIDLTE(*i.AvatarLocalFileIDLTE)) + } + if i.AvatarLocalFileIDContains != nil { + predicates = append(predicates, organization.AvatarLocalFileIDContains(*i.AvatarLocalFileIDContains)) + } + if i.AvatarLocalFileIDHasPrefix != nil { + predicates = append(predicates, organization.AvatarLocalFileIDHasPrefix(*i.AvatarLocalFileIDHasPrefix)) + } + if i.AvatarLocalFileIDHasSuffix != nil { + predicates = append(predicates, organization.AvatarLocalFileIDHasSuffix(*i.AvatarLocalFileIDHasSuffix)) + } + if i.AvatarLocalFileIDIsNil { + predicates = append(predicates, organization.AvatarLocalFileIDIsNil()) + } + if i.AvatarLocalFileIDNotNil { + predicates = append(predicates, organization.AvatarLocalFileIDNotNil()) + } + if i.AvatarLocalFileIDEqualFold != nil { + predicates = append(predicates, organization.AvatarLocalFileIDEqualFold(*i.AvatarLocalFileIDEqualFold)) + } + if i.AvatarLocalFileIDContainsFold != nil { + predicates = append(predicates, organization.AvatarLocalFileIDContainsFold(*i.AvatarLocalFileIDContainsFold)) + } + if i.AvatarUpdatedAt != nil { + predicates = append(predicates, organization.AvatarUpdatedAtEQ(*i.AvatarUpdatedAt)) + } + if i.AvatarUpdatedAtNEQ != nil { + predicates = append(predicates, organization.AvatarUpdatedAtNEQ(*i.AvatarUpdatedAtNEQ)) + } + if len(i.AvatarUpdatedAtIn) > 0 { + predicates = append(predicates, organization.AvatarUpdatedAtIn(i.AvatarUpdatedAtIn...)) + } + if len(i.AvatarUpdatedAtNotIn) > 0 { + predicates = append(predicates, organization.AvatarUpdatedAtNotIn(i.AvatarUpdatedAtNotIn...)) + } + if i.AvatarUpdatedAtGT != nil { + predicates = append(predicates, organization.AvatarUpdatedAtGT(*i.AvatarUpdatedAtGT)) + } + if i.AvatarUpdatedAtGTE != nil { + predicates = append(predicates, organization.AvatarUpdatedAtGTE(*i.AvatarUpdatedAtGTE)) + } + if i.AvatarUpdatedAtLT != nil { + predicates = append(predicates, organization.AvatarUpdatedAtLT(*i.AvatarUpdatedAtLT)) + } + if i.AvatarUpdatedAtLTE != nil { + predicates = append(predicates, organization.AvatarUpdatedAtLTE(*i.AvatarUpdatedAtLTE)) + } + if i.AvatarUpdatedAtIsNil { + predicates = append(predicates, organization.AvatarUpdatedAtIsNil()) + } + if i.AvatarUpdatedAtNotNil { + predicates = append(predicates, organization.AvatarUpdatedAtNotNil()) + } if i.HasControlCreators != nil { p := organization.HasControlCreators() @@ -36301,6 +36409,24 @@ func (i *OrganizationWhereInput) P() (predicate.Organization, error) { } predicates = append(predicates, organization.HasFilesWith(with...)) } + if i.HasAvatarFile != nil { + p := organization.HasAvatarFile() + if !*i.HasAvatarFile { + p = organization.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasAvatarFileWith) > 0 { + with := make([]predicate.File, 0, len(i.HasAvatarFileWith)) + for _, w := range i.HasAvatarFileWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasAvatarFileWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, organization.HasAvatarFileWith(with...)) + } if i.HasEntities != nil { p := organization.HasEntities() if !*i.HasEntities { @@ -36756,6 +36882,35 @@ type OrganizationHistoryWhereInput struct { AvatarRemoteURLNotNil bool `json:"avatarRemoteURLNotNil,omitempty"` AvatarRemoteURLEqualFold *string `json:"avatarRemoteURLEqualFold,omitempty"` AvatarRemoteURLContainsFold *string `json:"avatarRemoteURLContainsFold,omitempty"` + + // "avatar_local_file_id" field predicates. + AvatarLocalFileID *string `json:"avatarLocalFileID,omitempty"` + AvatarLocalFileIDNEQ *string `json:"avatarLocalFileIDNEQ,omitempty"` + AvatarLocalFileIDIn []string `json:"avatarLocalFileIDIn,omitempty"` + AvatarLocalFileIDNotIn []string `json:"avatarLocalFileIDNotIn,omitempty"` + AvatarLocalFileIDGT *string `json:"avatarLocalFileIDGT,omitempty"` + AvatarLocalFileIDGTE *string `json:"avatarLocalFileIDGTE,omitempty"` + AvatarLocalFileIDLT *string `json:"avatarLocalFileIDLT,omitempty"` + AvatarLocalFileIDLTE *string `json:"avatarLocalFileIDLTE,omitempty"` + AvatarLocalFileIDContains *string `json:"avatarLocalFileIDContains,omitempty"` + AvatarLocalFileIDHasPrefix *string `json:"avatarLocalFileIDHasPrefix,omitempty"` + AvatarLocalFileIDHasSuffix *string `json:"avatarLocalFileIDHasSuffix,omitempty"` + AvatarLocalFileIDIsNil bool `json:"avatarLocalFileIDIsNil,omitempty"` + AvatarLocalFileIDNotNil bool `json:"avatarLocalFileIDNotNil,omitempty"` + AvatarLocalFileIDEqualFold *string `json:"avatarLocalFileIDEqualFold,omitempty"` + AvatarLocalFileIDContainsFold *string `json:"avatarLocalFileIDContainsFold,omitempty"` + + // "avatar_updated_at" field predicates. + AvatarUpdatedAt *time.Time `json:"avatarUpdatedAt,omitempty"` + AvatarUpdatedAtNEQ *time.Time `json:"avatarUpdatedAtNEQ,omitempty"` + AvatarUpdatedAtIn []time.Time `json:"avatarUpdatedAtIn,omitempty"` + AvatarUpdatedAtNotIn []time.Time `json:"avatarUpdatedAtNotIn,omitempty"` + AvatarUpdatedAtGT *time.Time `json:"avatarUpdatedAtGT,omitempty"` + AvatarUpdatedAtGTE *time.Time `json:"avatarUpdatedAtGTE,omitempty"` + AvatarUpdatedAtLT *time.Time `json:"avatarUpdatedAtLT,omitempty"` + AvatarUpdatedAtLTE *time.Time `json:"avatarUpdatedAtLTE,omitempty"` + AvatarUpdatedAtIsNil bool `json:"avatarUpdatedAtIsNil,omitempty"` + AvatarUpdatedAtNotNil bool `json:"avatarUpdatedAtNotNil,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. @@ -37306,6 +37461,81 @@ func (i *OrganizationHistoryWhereInput) P() (predicate.OrganizationHistory, erro if i.AvatarRemoteURLContainsFold != nil { predicates = append(predicates, organizationhistory.AvatarRemoteURLContainsFold(*i.AvatarRemoteURLContainsFold)) } + if i.AvatarLocalFileID != nil { + predicates = append(predicates, organizationhistory.AvatarLocalFileIDEQ(*i.AvatarLocalFileID)) + } + if i.AvatarLocalFileIDNEQ != nil { + predicates = append(predicates, organizationhistory.AvatarLocalFileIDNEQ(*i.AvatarLocalFileIDNEQ)) + } + if len(i.AvatarLocalFileIDIn) > 0 { + predicates = append(predicates, organizationhistory.AvatarLocalFileIDIn(i.AvatarLocalFileIDIn...)) + } + if len(i.AvatarLocalFileIDNotIn) > 0 { + predicates = append(predicates, organizationhistory.AvatarLocalFileIDNotIn(i.AvatarLocalFileIDNotIn...)) + } + if i.AvatarLocalFileIDGT != nil { + predicates = append(predicates, organizationhistory.AvatarLocalFileIDGT(*i.AvatarLocalFileIDGT)) + } + if i.AvatarLocalFileIDGTE != nil { + predicates = append(predicates, organizationhistory.AvatarLocalFileIDGTE(*i.AvatarLocalFileIDGTE)) + } + if i.AvatarLocalFileIDLT != nil { + predicates = append(predicates, organizationhistory.AvatarLocalFileIDLT(*i.AvatarLocalFileIDLT)) + } + if i.AvatarLocalFileIDLTE != nil { + predicates = append(predicates, organizationhistory.AvatarLocalFileIDLTE(*i.AvatarLocalFileIDLTE)) + } + if i.AvatarLocalFileIDContains != nil { + predicates = append(predicates, organizationhistory.AvatarLocalFileIDContains(*i.AvatarLocalFileIDContains)) + } + if i.AvatarLocalFileIDHasPrefix != nil { + predicates = append(predicates, organizationhistory.AvatarLocalFileIDHasPrefix(*i.AvatarLocalFileIDHasPrefix)) + } + if i.AvatarLocalFileIDHasSuffix != nil { + predicates = append(predicates, organizationhistory.AvatarLocalFileIDHasSuffix(*i.AvatarLocalFileIDHasSuffix)) + } + if i.AvatarLocalFileIDIsNil { + predicates = append(predicates, organizationhistory.AvatarLocalFileIDIsNil()) + } + if i.AvatarLocalFileIDNotNil { + predicates = append(predicates, organizationhistory.AvatarLocalFileIDNotNil()) + } + if i.AvatarLocalFileIDEqualFold != nil { + predicates = append(predicates, organizationhistory.AvatarLocalFileIDEqualFold(*i.AvatarLocalFileIDEqualFold)) + } + if i.AvatarLocalFileIDContainsFold != nil { + predicates = append(predicates, organizationhistory.AvatarLocalFileIDContainsFold(*i.AvatarLocalFileIDContainsFold)) + } + if i.AvatarUpdatedAt != nil { + predicates = append(predicates, organizationhistory.AvatarUpdatedAtEQ(*i.AvatarUpdatedAt)) + } + if i.AvatarUpdatedAtNEQ != nil { + predicates = append(predicates, organizationhistory.AvatarUpdatedAtNEQ(*i.AvatarUpdatedAtNEQ)) + } + if len(i.AvatarUpdatedAtIn) > 0 { + predicates = append(predicates, organizationhistory.AvatarUpdatedAtIn(i.AvatarUpdatedAtIn...)) + } + if len(i.AvatarUpdatedAtNotIn) > 0 { + predicates = append(predicates, organizationhistory.AvatarUpdatedAtNotIn(i.AvatarUpdatedAtNotIn...)) + } + if i.AvatarUpdatedAtGT != nil { + predicates = append(predicates, organizationhistory.AvatarUpdatedAtGT(*i.AvatarUpdatedAtGT)) + } + if i.AvatarUpdatedAtGTE != nil { + predicates = append(predicates, organizationhistory.AvatarUpdatedAtGTE(*i.AvatarUpdatedAtGTE)) + } + if i.AvatarUpdatedAtLT != nil { + predicates = append(predicates, organizationhistory.AvatarUpdatedAtLT(*i.AvatarUpdatedAtLT)) + } + if i.AvatarUpdatedAtLTE != nil { + predicates = append(predicates, organizationhistory.AvatarUpdatedAtLTE(*i.AvatarUpdatedAtLTE)) + } + if i.AvatarUpdatedAtIsNil { + predicates = append(predicates, organizationhistory.AvatarUpdatedAtIsNil()) + } + if i.AvatarUpdatedAtNotNil { + predicates = append(predicates, organizationhistory.AvatarUpdatedAtNotNil()) + } switch len(predicates) { case 0: @@ -57336,23 +57566,6 @@ type UserWhereInput struct { AvatarRemoteURLEqualFold *string `json:"avatarRemoteURLEqualFold,omitempty"` AvatarRemoteURLContainsFold *string `json:"avatarRemoteURLContainsFold,omitempty"` - // "avatar_local_file" field predicates. - AvatarLocalFile *string `json:"avatarLocalFile,omitempty"` - AvatarLocalFileNEQ *string `json:"avatarLocalFileNEQ,omitempty"` - AvatarLocalFileIn []string `json:"avatarLocalFileIn,omitempty"` - AvatarLocalFileNotIn []string `json:"avatarLocalFileNotIn,omitempty"` - AvatarLocalFileGT *string `json:"avatarLocalFileGT,omitempty"` - AvatarLocalFileGTE *string `json:"avatarLocalFileGTE,omitempty"` - AvatarLocalFileLT *string `json:"avatarLocalFileLT,omitempty"` - AvatarLocalFileLTE *string `json:"avatarLocalFileLTE,omitempty"` - AvatarLocalFileContains *string `json:"avatarLocalFileContains,omitempty"` - AvatarLocalFileHasPrefix *string `json:"avatarLocalFileHasPrefix,omitempty"` - AvatarLocalFileHasSuffix *string `json:"avatarLocalFileHasSuffix,omitempty"` - AvatarLocalFileIsNil bool `json:"avatarLocalFileIsNil,omitempty"` - AvatarLocalFileNotNil bool `json:"avatarLocalFileNotNil,omitempty"` - AvatarLocalFileEqualFold *string `json:"avatarLocalFileEqualFold,omitempty"` - AvatarLocalFileContainsFold *string `json:"avatarLocalFileContainsFold,omitempty"` - // "avatar_local_file_id" field predicates. AvatarLocalFileID *string `json:"avatarLocalFileID,omitempty"` AvatarLocalFileIDNEQ *string `json:"avatarLocalFileIDNEQ,omitempty"` @@ -57466,9 +57679,9 @@ type UserWhereInput struct { HasFiles *bool `json:"hasFiles,omitempty"` HasFilesWith []*FileWhereInput `json:"hasFilesWith,omitempty"` - // "file" edge predicates. - HasFile *bool `json:"hasFile,omitempty"` - HasFileWith []*FileWhereInput `json:"hasFileWith,omitempty"` + // "avatar_file" edge predicates. + HasAvatarFile *bool `json:"hasAvatarFile,omitempty"` + HasAvatarFileWith []*FileWhereInput `json:"hasAvatarFileWith,omitempty"` // "events" edge predicates. HasEvents *bool `json:"hasEvents,omitempty"` @@ -58046,51 +58259,6 @@ func (i *UserWhereInput) P() (predicate.User, error) { if i.AvatarRemoteURLContainsFold != nil { predicates = append(predicates, user.AvatarRemoteURLContainsFold(*i.AvatarRemoteURLContainsFold)) } - if i.AvatarLocalFile != nil { - predicates = append(predicates, user.AvatarLocalFileEQ(*i.AvatarLocalFile)) - } - if i.AvatarLocalFileNEQ != nil { - predicates = append(predicates, user.AvatarLocalFileNEQ(*i.AvatarLocalFileNEQ)) - } - if len(i.AvatarLocalFileIn) > 0 { - predicates = append(predicates, user.AvatarLocalFileIn(i.AvatarLocalFileIn...)) - } - if len(i.AvatarLocalFileNotIn) > 0 { - predicates = append(predicates, user.AvatarLocalFileNotIn(i.AvatarLocalFileNotIn...)) - } - if i.AvatarLocalFileGT != nil { - predicates = append(predicates, user.AvatarLocalFileGT(*i.AvatarLocalFileGT)) - } - if i.AvatarLocalFileGTE != nil { - predicates = append(predicates, user.AvatarLocalFileGTE(*i.AvatarLocalFileGTE)) - } - if i.AvatarLocalFileLT != nil { - predicates = append(predicates, user.AvatarLocalFileLT(*i.AvatarLocalFileLT)) - } - if i.AvatarLocalFileLTE != nil { - predicates = append(predicates, user.AvatarLocalFileLTE(*i.AvatarLocalFileLTE)) - } - if i.AvatarLocalFileContains != nil { - predicates = append(predicates, user.AvatarLocalFileContains(*i.AvatarLocalFileContains)) - } - if i.AvatarLocalFileHasPrefix != nil { - predicates = append(predicates, user.AvatarLocalFileHasPrefix(*i.AvatarLocalFileHasPrefix)) - } - if i.AvatarLocalFileHasSuffix != nil { - predicates = append(predicates, user.AvatarLocalFileHasSuffix(*i.AvatarLocalFileHasSuffix)) - } - if i.AvatarLocalFileIsNil { - predicates = append(predicates, user.AvatarLocalFileIsNil()) - } - if i.AvatarLocalFileNotNil { - predicates = append(predicates, user.AvatarLocalFileNotNil()) - } - if i.AvatarLocalFileEqualFold != nil { - predicates = append(predicates, user.AvatarLocalFileEqualFold(*i.AvatarLocalFileEqualFold)) - } - if i.AvatarLocalFileContainsFold != nil { - predicates = append(predicates, user.AvatarLocalFileContainsFold(*i.AvatarLocalFileContainsFold)) - } if i.AvatarLocalFileID != nil { predicates = append(predicates, user.AvatarLocalFileIDEQ(*i.AvatarLocalFileID)) } @@ -58425,23 +58593,23 @@ func (i *UserWhereInput) P() (predicate.User, error) { } predicates = append(predicates, user.HasFilesWith(with...)) } - if i.HasFile != nil { - p := user.HasFile() - if !*i.HasFile { + if i.HasAvatarFile != nil { + p := user.HasAvatarFile() + if !*i.HasAvatarFile { p = user.Not(p) } predicates = append(predicates, p) } - if len(i.HasFileWith) > 0 { - with := make([]predicate.File, 0, len(i.HasFileWith)) - for _, w := range i.HasFileWith { + if len(i.HasAvatarFileWith) > 0 { + with := make([]predicate.File, 0, len(i.HasAvatarFileWith)) + for _, w := range i.HasAvatarFileWith { p, err := w.P() if err != nil { - return nil, fmt.Errorf("%w: field 'HasFileWith'", err) + return nil, fmt.Errorf("%w: field 'HasAvatarFileWith'", err) } with = append(with, p) } - predicates = append(predicates, user.HasFileWith(with...)) + predicates = append(predicates, user.HasAvatarFileWith(with...)) } if i.HasEvents != nil { p := user.HasEvents() @@ -58835,23 +59003,6 @@ type UserHistoryWhereInput struct { AvatarRemoteURLEqualFold *string `json:"avatarRemoteURLEqualFold,omitempty"` AvatarRemoteURLContainsFold *string `json:"avatarRemoteURLContainsFold,omitempty"` - // "avatar_local_file" field predicates. - AvatarLocalFile *string `json:"avatarLocalFile,omitempty"` - AvatarLocalFileNEQ *string `json:"avatarLocalFileNEQ,omitempty"` - AvatarLocalFileIn []string `json:"avatarLocalFileIn,omitempty"` - AvatarLocalFileNotIn []string `json:"avatarLocalFileNotIn,omitempty"` - AvatarLocalFileGT *string `json:"avatarLocalFileGT,omitempty"` - AvatarLocalFileGTE *string `json:"avatarLocalFileGTE,omitempty"` - AvatarLocalFileLT *string `json:"avatarLocalFileLT,omitempty"` - AvatarLocalFileLTE *string `json:"avatarLocalFileLTE,omitempty"` - AvatarLocalFileContains *string `json:"avatarLocalFileContains,omitempty"` - AvatarLocalFileHasPrefix *string `json:"avatarLocalFileHasPrefix,omitempty"` - AvatarLocalFileHasSuffix *string `json:"avatarLocalFileHasSuffix,omitempty"` - AvatarLocalFileIsNil bool `json:"avatarLocalFileIsNil,omitempty"` - AvatarLocalFileNotNil bool `json:"avatarLocalFileNotNil,omitempty"` - AvatarLocalFileEqualFold *string `json:"avatarLocalFileEqualFold,omitempty"` - AvatarLocalFileContainsFold *string `json:"avatarLocalFileContainsFold,omitempty"` - // "avatar_local_file_id" field predicates. AvatarLocalFileID *string `json:"avatarLocalFileID,omitempty"` AvatarLocalFileIDNEQ *string `json:"avatarLocalFileIDNEQ,omitempty"` @@ -59562,51 +59713,6 @@ func (i *UserHistoryWhereInput) P() (predicate.UserHistory, error) { if i.AvatarRemoteURLContainsFold != nil { predicates = append(predicates, userhistory.AvatarRemoteURLContainsFold(*i.AvatarRemoteURLContainsFold)) } - if i.AvatarLocalFile != nil { - predicates = append(predicates, userhistory.AvatarLocalFileEQ(*i.AvatarLocalFile)) - } - if i.AvatarLocalFileNEQ != nil { - predicates = append(predicates, userhistory.AvatarLocalFileNEQ(*i.AvatarLocalFileNEQ)) - } - if len(i.AvatarLocalFileIn) > 0 { - predicates = append(predicates, userhistory.AvatarLocalFileIn(i.AvatarLocalFileIn...)) - } - if len(i.AvatarLocalFileNotIn) > 0 { - predicates = append(predicates, userhistory.AvatarLocalFileNotIn(i.AvatarLocalFileNotIn...)) - } - if i.AvatarLocalFileGT != nil { - predicates = append(predicates, userhistory.AvatarLocalFileGT(*i.AvatarLocalFileGT)) - } - if i.AvatarLocalFileGTE != nil { - predicates = append(predicates, userhistory.AvatarLocalFileGTE(*i.AvatarLocalFileGTE)) - } - if i.AvatarLocalFileLT != nil { - predicates = append(predicates, userhistory.AvatarLocalFileLT(*i.AvatarLocalFileLT)) - } - if i.AvatarLocalFileLTE != nil { - predicates = append(predicates, userhistory.AvatarLocalFileLTE(*i.AvatarLocalFileLTE)) - } - if i.AvatarLocalFileContains != nil { - predicates = append(predicates, userhistory.AvatarLocalFileContains(*i.AvatarLocalFileContains)) - } - if i.AvatarLocalFileHasPrefix != nil { - predicates = append(predicates, userhistory.AvatarLocalFileHasPrefix(*i.AvatarLocalFileHasPrefix)) - } - if i.AvatarLocalFileHasSuffix != nil { - predicates = append(predicates, userhistory.AvatarLocalFileHasSuffix(*i.AvatarLocalFileHasSuffix)) - } - if i.AvatarLocalFileIsNil { - predicates = append(predicates, userhistory.AvatarLocalFileIsNil()) - } - if i.AvatarLocalFileNotNil { - predicates = append(predicates, userhistory.AvatarLocalFileNotNil()) - } - if i.AvatarLocalFileEqualFold != nil { - predicates = append(predicates, userhistory.AvatarLocalFileEqualFold(*i.AvatarLocalFileEqualFold)) - } - if i.AvatarLocalFileContainsFold != nil { - predicates = append(predicates, userhistory.AvatarLocalFileContainsFold(*i.AvatarLocalFileContainsFold)) - } if i.AvatarLocalFileID != nil { predicates = append(predicates, userhistory.AvatarLocalFileIDEQ(*i.AvatarLocalFileID)) } diff --git a/internal/ent/generated/history_from_mutation.go b/internal/ent/generated/history_from_mutation.go index a94a205c..4163eb90 100644 --- a/internal/ent/generated/history_from_mutation.go +++ b/internal/ent/generated/history_from_mutation.go @@ -4705,6 +4705,14 @@ func (m *OrganizationMutation) CreateHistoryFromCreate(ctx context.Context) erro create = create.SetNillableAvatarRemoteURL(&avatarRemoteURL) } + if avatarLocalFileID, exists := m.AvatarLocalFileID(); exists { + create = create.SetNillableAvatarLocalFileID(&avatarLocalFileID) + } + + if avatarUpdatedAt, exists := m.AvatarUpdatedAt(); exists { + create = create.SetNillableAvatarUpdatedAt(&avatarUpdatedAt) + } + if dedicatedDb, exists := m.DedicatedDb(); exists { create = create.SetDedicatedDb(dedicatedDb) } @@ -4823,6 +4831,18 @@ func (m *OrganizationMutation) CreateHistoryFromUpdate(ctx context.Context) erro create = create.SetNillableAvatarRemoteURL(organization.AvatarRemoteURL) } + if avatarLocalFileID, exists := m.AvatarLocalFileID(); exists { + create = create.SetNillableAvatarLocalFileID(&avatarLocalFileID) + } else { + create = create.SetNillableAvatarLocalFileID(organization.AvatarLocalFileID) + } + + if avatarUpdatedAt, exists := m.AvatarUpdatedAt(); exists { + create = create.SetNillableAvatarUpdatedAt(&avatarUpdatedAt) + } else { + create = create.SetNillableAvatarUpdatedAt(organization.AvatarUpdatedAt) + } + if dedicatedDb, exists := m.DedicatedDb(); exists { create = create.SetDedicatedDb(dedicatedDb) } else { @@ -4875,6 +4895,8 @@ func (m *OrganizationMutation) CreateHistoryFromDelete(ctx context.Context) erro SetParentOrganizationID(organization.ParentOrganizationID). SetPersonalOrg(organization.PersonalOrg). SetNillableAvatarRemoteURL(organization.AvatarRemoteURL). + SetNillableAvatarLocalFileID(organization.AvatarLocalFileID). + SetNillableAvatarUpdatedAt(organization.AvatarUpdatedAt). SetDedicatedDb(organization.DedicatedDb). Save(ctx) if err != nil { @@ -7398,10 +7420,6 @@ func (m *UserMutation) CreateHistoryFromCreate(ctx context.Context) error { create = create.SetNillableAvatarRemoteURL(&avatarRemoteURL) } - if avatarLocalFile, exists := m.AvatarLocalFile(); exists { - create = create.SetNillableAvatarLocalFile(&avatarLocalFile) - } - if avatarLocalFileID, exists := m.AvatarLocalFileID(); exists { create = create.SetNillableAvatarLocalFileID(&avatarLocalFileID) } @@ -7538,12 +7556,6 @@ func (m *UserMutation) CreateHistoryFromUpdate(ctx context.Context) error { create = create.SetNillableAvatarRemoteURL(user.AvatarRemoteURL) } - if avatarLocalFile, exists := m.AvatarLocalFile(); exists { - create = create.SetNillableAvatarLocalFile(&avatarLocalFile) - } else { - create = create.SetNillableAvatarLocalFile(user.AvatarLocalFile) - } - if avatarLocalFileID, exists := m.AvatarLocalFileID(); exists { create = create.SetNillableAvatarLocalFileID(&avatarLocalFileID) } else { @@ -7631,7 +7643,6 @@ func (m *UserMutation) CreateHistoryFromDelete(ctx context.Context) error { SetLastName(user.LastName). SetDisplayName(user.DisplayName). SetNillableAvatarRemoteURL(user.AvatarRemoteURL). - SetNillableAvatarLocalFile(user.AvatarLocalFile). SetNillableAvatarLocalFileID(user.AvatarLocalFileID). SetNillableAvatarUpdatedAt(user.AvatarUpdatedAt). SetNillableLastSeen(user.LastSeen). diff --git a/internal/ent/generated/migrate/schema.go b/internal/ent/generated/migrate/schema.go index a3f758c1..2754f48b 100644 --- a/internal/ent/generated/migrate/schema.go +++ b/internal/ent/generated/migrate/schema.go @@ -1495,8 +1495,10 @@ var ( {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "personal_org", Type: field.TypeBool, Nullable: true, Default: false}, {Name: "avatar_remote_url", Type: field.TypeString, Nullable: true, Size: 2048}, + {Name: "avatar_updated_at", Type: field.TypeTime, Nullable: true}, {Name: "dedicated_db", Type: field.TypeBool, Default: false}, {Name: "parent_organization_id", Type: field.TypeString, Nullable: true}, + {Name: "avatar_local_file_id", Type: field.TypeString, Nullable: true}, } // OrganizationsTable holds the schema information for the "organizations" table. OrganizationsTable = &schema.Table{ @@ -1506,10 +1508,16 @@ var ( ForeignKeys: []*schema.ForeignKey{ { Symbol: "organizations_organizations_children", - Columns: []*schema.Column{OrganizationsColumns[15]}, + Columns: []*schema.Column{OrganizationsColumns[16]}, RefColumns: []*schema.Column{OrganizationsColumns[0]}, OnDelete: schema.SetNull, }, + { + Symbol: "organizations_files_avatar_file", + Columns: []*schema.Column{OrganizationsColumns[17]}, + RefColumns: []*schema.Column{FilesColumns[0]}, + OnDelete: schema.SetNull, + }, }, Indexes: []*schema.Index{ { @@ -1542,6 +1550,8 @@ var ( {Name: "parent_organization_id", Type: field.TypeString, Nullable: true}, {Name: "personal_org", Type: field.TypeBool, Nullable: true, Default: false}, {Name: "avatar_remote_url", Type: field.TypeString, Nullable: true, Size: 2048}, + {Name: "avatar_local_file_id", Type: field.TypeString, Nullable: true}, + {Name: "avatar_updated_at", Type: field.TypeTime, Nullable: true}, {Name: "dedicated_db", Type: field.TypeBool, Default: false}, } // OrganizationHistoryTable holds the schema information for the "organization_history" table. @@ -2448,7 +2458,6 @@ var ( {Name: "last_name", Type: field.TypeString, Nullable: true, Size: 64}, {Name: "display_name", Type: field.TypeString, Size: 64}, {Name: "avatar_remote_url", Type: field.TypeString, Nullable: true, Size: 2048}, - {Name: "avatar_local_file", Type: field.TypeString, Nullable: true, Size: 2048}, {Name: "avatar_updated_at", Type: field.TypeTime, Nullable: true}, {Name: "last_seen", Type: field.TypeTime, Nullable: true}, {Name: "password", Type: field.TypeString, Nullable: true}, @@ -2464,8 +2473,8 @@ var ( PrimaryKey: []*schema.Column{UsersColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { - Symbol: "users_files_file", - Columns: []*schema.Column{UsersColumns[21]}, + Symbol: "users_files_avatar_file", + Columns: []*schema.Column{UsersColumns[20]}, RefColumns: []*schema.Column{FilesColumns[0]}, OnDelete: schema.SetNull, }, @@ -2479,7 +2488,7 @@ var ( { Name: "user_email_auth_provider", Unique: true, - Columns: []*schema.Column{UsersColumns[9], UsersColumns[19]}, + Columns: []*schema.Column{UsersColumns[9], UsersColumns[18]}, Annotation: &entsql.IndexAnnotation{ Where: "deleted_at is NULL", }, @@ -2505,7 +2514,6 @@ var ( {Name: "last_name", Type: field.TypeString, Nullable: true, Size: 64}, {Name: "display_name", Type: field.TypeString, Size: 64}, {Name: "avatar_remote_url", Type: field.TypeString, Nullable: true, Size: 2048}, - {Name: "avatar_local_file", Type: field.TypeString, Nullable: true, Size: 2048}, {Name: "avatar_local_file_id", Type: field.TypeString, Nullable: true}, {Name: "avatar_updated_at", Type: field.TypeTime, Nullable: true}, {Name: "last_seen", Type: field.TypeTime, Nullable: true}, @@ -5117,6 +5125,7 @@ func init() { Table: "org_subscription_history", } OrganizationsTable.ForeignKeys[0].RefTable = OrganizationsTable + OrganizationsTable.ForeignKeys[1].RefTable = FilesTable OrganizationHistoryTable.Annotation = &entsql.Annotation{ Table: "organization_history", } diff --git a/internal/ent/generated/mutation.go b/internal/ent/generated/mutation.go index 2a060719..6a910b7a 100644 --- a/internal/ent/generated/mutation.go +++ b/internal/ent/generated/mutation.go @@ -67664,6 +67664,7 @@ type OrganizationMutation struct { description *string personal_org *bool avatar_remote_url *string + avatar_updated_at *time.Time dedicated_db *bool clearedFields map[string]struct{} control_creators map[string]struct{} @@ -67739,6 +67740,8 @@ type OrganizationMutation struct { files map[string]struct{} removedfiles map[string]struct{} clearedfiles bool + avatar_file *string + clearedavatar_file bool entities map[string]struct{} removedentities map[string]struct{} clearedentities bool @@ -68553,6 +68556,104 @@ func (m *OrganizationMutation) ResetAvatarRemoteURL() { delete(m.clearedFields, organization.FieldAvatarRemoteURL) } +// SetAvatarLocalFileID sets the "avatar_local_file_id" field. +func (m *OrganizationMutation) SetAvatarLocalFileID(s string) { + m.avatar_file = &s +} + +// AvatarLocalFileID returns the value of the "avatar_local_file_id" field in the mutation. +func (m *OrganizationMutation) AvatarLocalFileID() (r string, exists bool) { + v := m.avatar_file + if v == nil { + return + } + return *v, true +} + +// OldAvatarLocalFileID returns the old "avatar_local_file_id" field's value of the Organization entity. +// If the Organization object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *OrganizationMutation) OldAvatarLocalFileID(ctx context.Context) (v *string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldAvatarLocalFileID is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldAvatarLocalFileID requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldAvatarLocalFileID: %w", err) + } + return oldValue.AvatarLocalFileID, nil +} + +// ClearAvatarLocalFileID clears the value of the "avatar_local_file_id" field. +func (m *OrganizationMutation) ClearAvatarLocalFileID() { + m.avatar_file = nil + m.clearedFields[organization.FieldAvatarLocalFileID] = struct{}{} +} + +// AvatarLocalFileIDCleared returns if the "avatar_local_file_id" field was cleared in this mutation. +func (m *OrganizationMutation) AvatarLocalFileIDCleared() bool { + _, ok := m.clearedFields[organization.FieldAvatarLocalFileID] + return ok +} + +// ResetAvatarLocalFileID resets all changes to the "avatar_local_file_id" field. +func (m *OrganizationMutation) ResetAvatarLocalFileID() { + m.avatar_file = nil + delete(m.clearedFields, organization.FieldAvatarLocalFileID) +} + +// SetAvatarUpdatedAt sets the "avatar_updated_at" field. +func (m *OrganizationMutation) SetAvatarUpdatedAt(t time.Time) { + m.avatar_updated_at = &t +} + +// AvatarUpdatedAt returns the value of the "avatar_updated_at" field in the mutation. +func (m *OrganizationMutation) AvatarUpdatedAt() (r time.Time, exists bool) { + v := m.avatar_updated_at + if v == nil { + return + } + return *v, true +} + +// OldAvatarUpdatedAt returns the old "avatar_updated_at" field's value of the Organization entity. +// If the Organization object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *OrganizationMutation) OldAvatarUpdatedAt(ctx context.Context) (v *time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldAvatarUpdatedAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldAvatarUpdatedAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldAvatarUpdatedAt: %w", err) + } + return oldValue.AvatarUpdatedAt, nil +} + +// ClearAvatarUpdatedAt clears the value of the "avatar_updated_at" field. +func (m *OrganizationMutation) ClearAvatarUpdatedAt() { + m.avatar_updated_at = nil + m.clearedFields[organization.FieldAvatarUpdatedAt] = struct{}{} +} + +// AvatarUpdatedAtCleared returns if the "avatar_updated_at" field was cleared in this mutation. +func (m *OrganizationMutation) AvatarUpdatedAtCleared() bool { + _, ok := m.clearedFields[organization.FieldAvatarUpdatedAt] + return ok +} + +// ResetAvatarUpdatedAt resets all changes to the "avatar_updated_at" field. +func (m *OrganizationMutation) ResetAvatarUpdatedAt() { + m.avatar_updated_at = nil + delete(m.clearedFields, organization.FieldAvatarUpdatedAt) +} + // SetDedicatedDb sets the "dedicated_db" field. func (m *OrganizationMutation) SetDedicatedDb(b bool) { m.dedicated_db = &b @@ -69910,6 +70011,46 @@ func (m *OrganizationMutation) ResetFiles() { m.removedfiles = nil } +// SetAvatarFileID sets the "avatar_file" edge to the File entity by id. +func (m *OrganizationMutation) SetAvatarFileID(id string) { + m.avatar_file = &id +} + +// ClearAvatarFile clears the "avatar_file" edge to the File entity. +func (m *OrganizationMutation) ClearAvatarFile() { + m.clearedavatar_file = true + m.clearedFields[organization.FieldAvatarLocalFileID] = struct{}{} +} + +// AvatarFileCleared reports if the "avatar_file" edge to the File entity was cleared. +func (m *OrganizationMutation) AvatarFileCleared() bool { + return m.AvatarLocalFileIDCleared() || m.clearedavatar_file +} + +// AvatarFileID returns the "avatar_file" edge ID in the mutation. +func (m *OrganizationMutation) AvatarFileID() (id string, exists bool) { + if m.avatar_file != nil { + return *m.avatar_file, true + } + return +} + +// AvatarFileIDs returns the "avatar_file" edge IDs in the mutation. +// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use +// AvatarFileID instead. It exists only for internal usage by the builders. +func (m *OrganizationMutation) AvatarFileIDs() (ids []string) { + if id := m.avatar_file; id != nil { + ids = append(ids, *id) + } + return +} + +// ResetAvatarFile resets all changes to the "avatar_file" edge. +func (m *OrganizationMutation) ResetAvatarFile() { + m.avatar_file = nil + m.clearedavatar_file = false +} + // AddEntityIDs adds the "entities" edge to the Entity entity by ids. func (m *OrganizationMutation) AddEntityIDs(ids ...string) { if m.entities == nil { @@ -70700,7 +70841,7 @@ func (m *OrganizationMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *OrganizationMutation) Fields() []string { - fields := make([]string, 0, 15) + fields := make([]string, 0, 17) if m.created_at != nil { fields = append(fields, organization.FieldCreatedAt) } @@ -70743,6 +70884,12 @@ func (m *OrganizationMutation) Fields() []string { if m.avatar_remote_url != nil { fields = append(fields, organization.FieldAvatarRemoteURL) } + if m.avatar_file != nil { + fields = append(fields, organization.FieldAvatarLocalFileID) + } + if m.avatar_updated_at != nil { + fields = append(fields, organization.FieldAvatarUpdatedAt) + } if m.dedicated_db != nil { fields = append(fields, organization.FieldDedicatedDb) } @@ -70782,6 +70929,10 @@ func (m *OrganizationMutation) Field(name string) (ent.Value, bool) { return m.PersonalOrg() case organization.FieldAvatarRemoteURL: return m.AvatarRemoteURL() + case organization.FieldAvatarLocalFileID: + return m.AvatarLocalFileID() + case organization.FieldAvatarUpdatedAt: + return m.AvatarUpdatedAt() case organization.FieldDedicatedDb: return m.DedicatedDb() } @@ -70821,6 +70972,10 @@ func (m *OrganizationMutation) OldField(ctx context.Context, name string) (ent.V return m.OldPersonalOrg(ctx) case organization.FieldAvatarRemoteURL: return m.OldAvatarRemoteURL(ctx) + case organization.FieldAvatarLocalFileID: + return m.OldAvatarLocalFileID(ctx) + case organization.FieldAvatarUpdatedAt: + return m.OldAvatarUpdatedAt(ctx) case organization.FieldDedicatedDb: return m.OldDedicatedDb(ctx) } @@ -70930,6 +71085,20 @@ func (m *OrganizationMutation) SetField(name string, value ent.Value) error { } m.SetAvatarRemoteURL(v) return nil + case organization.FieldAvatarLocalFileID: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetAvatarLocalFileID(v) + return nil + case organization.FieldAvatarUpdatedAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetAvatarUpdatedAt(v) + return nil case organization.FieldDedicatedDb: v, ok := value.(bool) if !ok { @@ -71000,6 +71169,12 @@ func (m *OrganizationMutation) ClearedFields() []string { if m.FieldCleared(organization.FieldAvatarRemoteURL) { fields = append(fields, organization.FieldAvatarRemoteURL) } + if m.FieldCleared(organization.FieldAvatarLocalFileID) { + fields = append(fields, organization.FieldAvatarLocalFileID) + } + if m.FieldCleared(organization.FieldAvatarUpdatedAt) { + fields = append(fields, organization.FieldAvatarUpdatedAt) + } return fields } @@ -71047,6 +71222,12 @@ func (m *OrganizationMutation) ClearField(name string) error { case organization.FieldAvatarRemoteURL: m.ClearAvatarRemoteURL() return nil + case organization.FieldAvatarLocalFileID: + m.ClearAvatarLocalFileID() + return nil + case organization.FieldAvatarUpdatedAt: + m.ClearAvatarUpdatedAt() + return nil } return fmt.Errorf("unknown Organization nullable field %s", name) } @@ -71097,6 +71278,12 @@ func (m *OrganizationMutation) ResetField(name string) error { case organization.FieldAvatarRemoteURL: m.ResetAvatarRemoteURL() return nil + case organization.FieldAvatarLocalFileID: + m.ResetAvatarLocalFileID() + return nil + case organization.FieldAvatarUpdatedAt: + m.ResetAvatarUpdatedAt() + return nil case organization.FieldDedicatedDb: m.ResetDedicatedDb() return nil @@ -71106,7 +71293,7 @@ func (m *OrganizationMutation) ResetField(name string) error { // AddedEdges returns all edge names that were set/added in this mutation. func (m *OrganizationMutation) AddedEdges() []string { - edges := make([]string, 0, 39) + edges := make([]string, 0, 40) if m.control_creators != nil { edges = append(edges, organization.EdgeControlCreators) } @@ -71182,6 +71369,9 @@ func (m *OrganizationMutation) AddedEdges() []string { if m.files != nil { edges = append(edges, organization.EdgeFiles) } + if m.avatar_file != nil { + edges = append(edges, organization.EdgeAvatarFile) + } if m.entities != nil { edges = append(edges, organization.EdgeEntities) } @@ -71377,6 +71567,10 @@ func (m *OrganizationMutation) AddedIDs(name string) []ent.Value { ids = append(ids, id) } return ids + case organization.EdgeAvatarFile: + if id := m.avatar_file; id != nil { + return []ent.Value{*id} + } case organization.EdgeEntities: ids := make([]ent.Value, 0, len(m.entities)) for id := range m.entities { @@ -71467,7 +71661,7 @@ func (m *OrganizationMutation) AddedIDs(name string) []ent.Value { // RemovedEdges returns all edge names that were removed in this mutation. func (m *OrganizationMutation) RemovedEdges() []string { - edges := make([]string, 0, 39) + edges := make([]string, 0, 40) if m.removedcontrol_creators != nil { edges = append(edges, organization.EdgeControlCreators) } @@ -71814,7 +72008,7 @@ func (m *OrganizationMutation) RemovedIDs(name string) []ent.Value { // ClearedEdges returns all edge names that were cleared in this mutation. func (m *OrganizationMutation) ClearedEdges() []string { - edges := make([]string, 0, 39) + edges := make([]string, 0, 40) if m.clearedcontrol_creators { edges = append(edges, organization.EdgeControlCreators) } @@ -71890,6 +72084,9 @@ func (m *OrganizationMutation) ClearedEdges() []string { if m.clearedfiles { edges = append(edges, organization.EdgeFiles) } + if m.clearedavatar_file { + edges = append(edges, organization.EdgeAvatarFile) + } if m.clearedentities { edges = append(edges, organization.EdgeEntities) } @@ -71989,6 +72186,8 @@ func (m *OrganizationMutation) EdgeCleared(name string) bool { return m.clearedsecrets case organization.EdgeFiles: return m.clearedfiles + case organization.EdgeAvatarFile: + return m.clearedavatar_file case organization.EdgeEntities: return m.clearedentities case organization.EdgeEntityTypes: @@ -72031,6 +72230,9 @@ func (m *OrganizationMutation) ClearEdge(name string) error { case organization.EdgeSetting: m.ClearSetting() return nil + case organization.EdgeAvatarFile: + m.ClearAvatarFile() + return nil } return fmt.Errorf("unknown Organization unique edge %s", name) } @@ -72114,6 +72316,9 @@ func (m *OrganizationMutation) ResetEdge(name string) error { case organization.EdgeFiles: m.ResetFiles() return nil + case organization.EdgeAvatarFile: + m.ResetAvatarFile() + return nil case organization.EdgeEntities: m.ResetEntities() return nil @@ -72184,6 +72389,8 @@ type OrganizationHistoryMutation struct { parent_organization_id *string personal_org *bool avatar_remote_url *string + avatar_local_file_id *string + avatar_updated_at *time.Time dedicated_db *bool clearedFields map[string]struct{} done bool @@ -73079,6 +73286,104 @@ func (m *OrganizationHistoryMutation) ResetAvatarRemoteURL() { delete(m.clearedFields, organizationhistory.FieldAvatarRemoteURL) } +// SetAvatarLocalFileID sets the "avatar_local_file_id" field. +func (m *OrganizationHistoryMutation) SetAvatarLocalFileID(s string) { + m.avatar_local_file_id = &s +} + +// AvatarLocalFileID returns the value of the "avatar_local_file_id" field in the mutation. +func (m *OrganizationHistoryMutation) AvatarLocalFileID() (r string, exists bool) { + v := m.avatar_local_file_id + if v == nil { + return + } + return *v, true +} + +// OldAvatarLocalFileID returns the old "avatar_local_file_id" field's value of the OrganizationHistory entity. +// If the OrganizationHistory object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *OrganizationHistoryMutation) OldAvatarLocalFileID(ctx context.Context) (v *string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldAvatarLocalFileID is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldAvatarLocalFileID requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldAvatarLocalFileID: %w", err) + } + return oldValue.AvatarLocalFileID, nil +} + +// ClearAvatarLocalFileID clears the value of the "avatar_local_file_id" field. +func (m *OrganizationHistoryMutation) ClearAvatarLocalFileID() { + m.avatar_local_file_id = nil + m.clearedFields[organizationhistory.FieldAvatarLocalFileID] = struct{}{} +} + +// AvatarLocalFileIDCleared returns if the "avatar_local_file_id" field was cleared in this mutation. +func (m *OrganizationHistoryMutation) AvatarLocalFileIDCleared() bool { + _, ok := m.clearedFields[organizationhistory.FieldAvatarLocalFileID] + return ok +} + +// ResetAvatarLocalFileID resets all changes to the "avatar_local_file_id" field. +func (m *OrganizationHistoryMutation) ResetAvatarLocalFileID() { + m.avatar_local_file_id = nil + delete(m.clearedFields, organizationhistory.FieldAvatarLocalFileID) +} + +// SetAvatarUpdatedAt sets the "avatar_updated_at" field. +func (m *OrganizationHistoryMutation) SetAvatarUpdatedAt(t time.Time) { + m.avatar_updated_at = &t +} + +// AvatarUpdatedAt returns the value of the "avatar_updated_at" field in the mutation. +func (m *OrganizationHistoryMutation) AvatarUpdatedAt() (r time.Time, exists bool) { + v := m.avatar_updated_at + if v == nil { + return + } + return *v, true +} + +// OldAvatarUpdatedAt returns the old "avatar_updated_at" field's value of the OrganizationHistory entity. +// If the OrganizationHistory object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *OrganizationHistoryMutation) OldAvatarUpdatedAt(ctx context.Context) (v *time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldAvatarUpdatedAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldAvatarUpdatedAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldAvatarUpdatedAt: %w", err) + } + return oldValue.AvatarUpdatedAt, nil +} + +// ClearAvatarUpdatedAt clears the value of the "avatar_updated_at" field. +func (m *OrganizationHistoryMutation) ClearAvatarUpdatedAt() { + m.avatar_updated_at = nil + m.clearedFields[organizationhistory.FieldAvatarUpdatedAt] = struct{}{} +} + +// AvatarUpdatedAtCleared returns if the "avatar_updated_at" field was cleared in this mutation. +func (m *OrganizationHistoryMutation) AvatarUpdatedAtCleared() bool { + _, ok := m.clearedFields[organizationhistory.FieldAvatarUpdatedAt] + return ok +} + +// ResetAvatarUpdatedAt resets all changes to the "avatar_updated_at" field. +func (m *OrganizationHistoryMutation) ResetAvatarUpdatedAt() { + m.avatar_updated_at = nil + delete(m.clearedFields, organizationhistory.FieldAvatarUpdatedAt) +} + // SetDedicatedDb sets the "dedicated_db" field. func (m *OrganizationHistoryMutation) SetDedicatedDb(b bool) { m.dedicated_db = &b @@ -73149,7 +73454,7 @@ func (m *OrganizationHistoryMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *OrganizationHistoryMutation) Fields() []string { - fields := make([]string, 0, 18) + fields := make([]string, 0, 20) if m.history_time != nil { fields = append(fields, organizationhistory.FieldHistoryTime) } @@ -73201,6 +73506,12 @@ func (m *OrganizationHistoryMutation) Fields() []string { if m.avatar_remote_url != nil { fields = append(fields, organizationhistory.FieldAvatarRemoteURL) } + if m.avatar_local_file_id != nil { + fields = append(fields, organizationhistory.FieldAvatarLocalFileID) + } + if m.avatar_updated_at != nil { + fields = append(fields, organizationhistory.FieldAvatarUpdatedAt) + } if m.dedicated_db != nil { fields = append(fields, organizationhistory.FieldDedicatedDb) } @@ -73246,6 +73557,10 @@ func (m *OrganizationHistoryMutation) Field(name string) (ent.Value, bool) { return m.PersonalOrg() case organizationhistory.FieldAvatarRemoteURL: return m.AvatarRemoteURL() + case organizationhistory.FieldAvatarLocalFileID: + return m.AvatarLocalFileID() + case organizationhistory.FieldAvatarUpdatedAt: + return m.AvatarUpdatedAt() case organizationhistory.FieldDedicatedDb: return m.DedicatedDb() } @@ -73291,6 +73606,10 @@ func (m *OrganizationHistoryMutation) OldField(ctx context.Context, name string) return m.OldPersonalOrg(ctx) case organizationhistory.FieldAvatarRemoteURL: return m.OldAvatarRemoteURL(ctx) + case organizationhistory.FieldAvatarLocalFileID: + return m.OldAvatarLocalFileID(ctx) + case organizationhistory.FieldAvatarUpdatedAt: + return m.OldAvatarUpdatedAt(ctx) case organizationhistory.FieldDedicatedDb: return m.OldDedicatedDb(ctx) } @@ -73421,6 +73740,20 @@ func (m *OrganizationHistoryMutation) SetField(name string, value ent.Value) err } m.SetAvatarRemoteURL(v) return nil + case organizationhistory.FieldAvatarLocalFileID: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetAvatarLocalFileID(v) + return nil + case organizationhistory.FieldAvatarUpdatedAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetAvatarUpdatedAt(v) + return nil case organizationhistory.FieldDedicatedDb: v, ok := value.(bool) if !ok { @@ -73494,6 +73827,12 @@ func (m *OrganizationHistoryMutation) ClearedFields() []string { if m.FieldCleared(organizationhistory.FieldAvatarRemoteURL) { fields = append(fields, organizationhistory.FieldAvatarRemoteURL) } + if m.FieldCleared(organizationhistory.FieldAvatarLocalFileID) { + fields = append(fields, organizationhistory.FieldAvatarLocalFileID) + } + if m.FieldCleared(organizationhistory.FieldAvatarUpdatedAt) { + fields = append(fields, organizationhistory.FieldAvatarUpdatedAt) + } return fields } @@ -73544,6 +73883,12 @@ func (m *OrganizationHistoryMutation) ClearField(name string) error { case organizationhistory.FieldAvatarRemoteURL: m.ClearAvatarRemoteURL() return nil + case organizationhistory.FieldAvatarLocalFileID: + m.ClearAvatarLocalFileID() + return nil + case organizationhistory.FieldAvatarUpdatedAt: + m.ClearAvatarUpdatedAt() + return nil } return fmt.Errorf("unknown OrganizationHistory nullable field %s", name) } @@ -73603,6 +73948,12 @@ func (m *OrganizationHistoryMutation) ResetField(name string) error { case organizationhistory.FieldAvatarRemoteURL: m.ResetAvatarRemoteURL() return nil + case organizationhistory.FieldAvatarLocalFileID: + m.ResetAvatarLocalFileID() + return nil + case organizationhistory.FieldAvatarUpdatedAt: + m.ResetAvatarUpdatedAt() + return nil case organizationhistory.FieldDedicatedDb: m.ResetDedicatedDb() return nil @@ -112315,7 +112666,6 @@ type UserMutation struct { last_name *string display_name *string avatar_remote_url *string - avatar_local_file *string avatar_updated_at *time.Time last_seen *time.Time password *string @@ -112349,8 +112699,8 @@ type UserMutation struct { files map[string]struct{} removedfiles map[string]struct{} clearedfiles bool - file *string - clearedfile bool + avatar_file *string + clearedavatar_file bool events map[string]struct{} removedevents map[string]struct{} clearedevents bool @@ -113101,63 +113451,14 @@ func (m *UserMutation) ResetAvatarRemoteURL() { delete(m.clearedFields, user.FieldAvatarRemoteURL) } -// SetAvatarLocalFile sets the "avatar_local_file" field. -func (m *UserMutation) SetAvatarLocalFile(s string) { - m.avatar_local_file = &s -} - -// AvatarLocalFile returns the value of the "avatar_local_file" field in the mutation. -func (m *UserMutation) AvatarLocalFile() (r string, exists bool) { - v := m.avatar_local_file - if v == nil { - return - } - return *v, true -} - -// OldAvatarLocalFile returns the old "avatar_local_file" field's value of the User entity. -// If the User object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *UserMutation) OldAvatarLocalFile(ctx context.Context) (v *string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldAvatarLocalFile is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldAvatarLocalFile requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldAvatarLocalFile: %w", err) - } - return oldValue.AvatarLocalFile, nil -} - -// ClearAvatarLocalFile clears the value of the "avatar_local_file" field. -func (m *UserMutation) ClearAvatarLocalFile() { - m.avatar_local_file = nil - m.clearedFields[user.FieldAvatarLocalFile] = struct{}{} -} - -// AvatarLocalFileCleared returns if the "avatar_local_file" field was cleared in this mutation. -func (m *UserMutation) AvatarLocalFileCleared() bool { - _, ok := m.clearedFields[user.FieldAvatarLocalFile] - return ok -} - -// ResetAvatarLocalFile resets all changes to the "avatar_local_file" field. -func (m *UserMutation) ResetAvatarLocalFile() { - m.avatar_local_file = nil - delete(m.clearedFields, user.FieldAvatarLocalFile) -} - // SetAvatarLocalFileID sets the "avatar_local_file_id" field. func (m *UserMutation) SetAvatarLocalFileID(s string) { - m.file = &s + m.avatar_file = &s } // AvatarLocalFileID returns the value of the "avatar_local_file_id" field in the mutation. func (m *UserMutation) AvatarLocalFileID() (r string, exists bool) { - v := m.file + v := m.avatar_file if v == nil { return } @@ -113183,7 +113484,7 @@ func (m *UserMutation) OldAvatarLocalFileID(ctx context.Context) (v *string, err // ClearAvatarLocalFileID clears the value of the "avatar_local_file_id" field. func (m *UserMutation) ClearAvatarLocalFileID() { - m.file = nil + m.avatar_file = nil m.clearedFields[user.FieldAvatarLocalFileID] = struct{}{} } @@ -113195,7 +113496,7 @@ func (m *UserMutation) AvatarLocalFileIDCleared() bool { // ResetAvatarLocalFileID resets all changes to the "avatar_local_file_id" field. func (m *UserMutation) ResetAvatarLocalFileID() { - m.file = nil + m.avatar_file = nil delete(m.clearedFields, user.FieldAvatarLocalFileID) } @@ -113951,44 +114252,44 @@ func (m *UserMutation) ResetFiles() { m.removedfiles = nil } -// SetFileID sets the "file" edge to the File entity by id. -func (m *UserMutation) SetFileID(id string) { - m.file = &id +// SetAvatarFileID sets the "avatar_file" edge to the File entity by id. +func (m *UserMutation) SetAvatarFileID(id string) { + m.avatar_file = &id } -// ClearFile clears the "file" edge to the File entity. -func (m *UserMutation) ClearFile() { - m.clearedfile = true +// ClearAvatarFile clears the "avatar_file" edge to the File entity. +func (m *UserMutation) ClearAvatarFile() { + m.clearedavatar_file = true m.clearedFields[user.FieldAvatarLocalFileID] = struct{}{} } -// FileCleared reports if the "file" edge to the File entity was cleared. -func (m *UserMutation) FileCleared() bool { - return m.AvatarLocalFileIDCleared() || m.clearedfile +// AvatarFileCleared reports if the "avatar_file" edge to the File entity was cleared. +func (m *UserMutation) AvatarFileCleared() bool { + return m.AvatarLocalFileIDCleared() || m.clearedavatar_file } -// FileID returns the "file" edge ID in the mutation. -func (m *UserMutation) FileID() (id string, exists bool) { - if m.file != nil { - return *m.file, true +// AvatarFileID returns the "avatar_file" edge ID in the mutation. +func (m *UserMutation) AvatarFileID() (id string, exists bool) { + if m.avatar_file != nil { + return *m.avatar_file, true } return } -// FileIDs returns the "file" edge IDs in the mutation. +// AvatarFileIDs returns the "avatar_file" edge IDs in the mutation. // Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use -// FileID instead. It exists only for internal usage by the builders. -func (m *UserMutation) FileIDs() (ids []string) { - if id := m.file; id != nil { +// AvatarFileID instead. It exists only for internal usage by the builders. +func (m *UserMutation) AvatarFileIDs() (ids []string) { + if id := m.avatar_file; id != nil { ids = append(ids, *id) } return } -// ResetFile resets all changes to the "file" edge. -func (m *UserMutation) ResetFile() { - m.file = nil - m.clearedfile = false +// ResetAvatarFile resets all changes to the "avatar_file" edge. +func (m *UserMutation) ResetAvatarFile() { + m.avatar_file = nil + m.clearedavatar_file = false } // AddEventIDs adds the "events" edge to the Event entity by ids. @@ -114511,7 +114812,7 @@ func (m *UserMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *UserMutation) Fields() []string { - fields := make([]string, 0, 21) + fields := make([]string, 0, 20) if m.created_at != nil { fields = append(fields, user.FieldCreatedAt) } @@ -114551,10 +114852,7 @@ func (m *UserMutation) Fields() []string { if m.avatar_remote_url != nil { fields = append(fields, user.FieldAvatarRemoteURL) } - if m.avatar_local_file != nil { - fields = append(fields, user.FieldAvatarLocalFile) - } - if m.file != nil { + if m.avatar_file != nil { fields = append(fields, user.FieldAvatarLocalFileID) } if m.avatar_updated_at != nil { @@ -114609,8 +114907,6 @@ func (m *UserMutation) Field(name string) (ent.Value, bool) { return m.DisplayName() case user.FieldAvatarRemoteURL: return m.AvatarRemoteURL() - case user.FieldAvatarLocalFile: - return m.AvatarLocalFile() case user.FieldAvatarLocalFileID: return m.AvatarLocalFileID() case user.FieldAvatarUpdatedAt: @@ -114660,8 +114956,6 @@ func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, er return m.OldDisplayName(ctx) case user.FieldAvatarRemoteURL: return m.OldAvatarRemoteURL(ctx) - case user.FieldAvatarLocalFile: - return m.OldAvatarLocalFile(ctx) case user.FieldAvatarLocalFileID: return m.OldAvatarLocalFileID(ctx) case user.FieldAvatarUpdatedAt: @@ -114776,13 +115070,6 @@ func (m *UserMutation) SetField(name string, value ent.Value) error { } m.SetAvatarRemoteURL(v) return nil - case user.FieldAvatarLocalFile: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetAvatarLocalFile(v) - return nil case user.FieldAvatarLocalFileID: v, ok := value.(string) if !ok { @@ -114892,9 +115179,6 @@ func (m *UserMutation) ClearedFields() []string { if m.FieldCleared(user.FieldAvatarRemoteURL) { fields = append(fields, user.FieldAvatarRemoteURL) } - if m.FieldCleared(user.FieldAvatarLocalFile) { - fields = append(fields, user.FieldAvatarLocalFile) - } if m.FieldCleared(user.FieldAvatarLocalFileID) { fields = append(fields, user.FieldAvatarLocalFileID) } @@ -114957,9 +115241,6 @@ func (m *UserMutation) ClearField(name string) error { case user.FieldAvatarRemoteURL: m.ClearAvatarRemoteURL() return nil - case user.FieldAvatarLocalFile: - m.ClearAvatarLocalFile() - return nil case user.FieldAvatarLocalFileID: m.ClearAvatarLocalFileID() return nil @@ -115025,9 +115306,6 @@ func (m *UserMutation) ResetField(name string) error { case user.FieldAvatarRemoteURL: m.ResetAvatarRemoteURL() return nil - case user.FieldAvatarLocalFile: - m.ResetAvatarLocalFile() - return nil case user.FieldAvatarLocalFileID: m.ResetAvatarLocalFileID() return nil @@ -115083,8 +115361,8 @@ func (m *UserMutation) AddedEdges() []string { if m.files != nil { edges = append(edges, user.EdgeFiles) } - if m.file != nil { - edges = append(edges, user.EdgeFile) + if m.avatar_file != nil { + edges = append(edges, user.EdgeAvatarFile) } if m.events != nil { edges = append(edges, user.EdgeEvents) @@ -115172,8 +115450,8 @@ func (m *UserMutation) AddedIDs(name string) []ent.Value { ids = append(ids, id) } return ids - case user.EdgeFile: - if id := m.file; id != nil { + case user.EdgeAvatarFile: + if id := m.avatar_file; id != nil { return []ent.Value{*id} } case user.EdgeEvents: @@ -115431,8 +115709,8 @@ func (m *UserMutation) ClearedEdges() []string { if m.clearedfiles { edges = append(edges, user.EdgeFiles) } - if m.clearedfile { - edges = append(edges, user.EdgeFile) + if m.clearedavatar_file { + edges = append(edges, user.EdgeAvatarFile) } if m.clearedevents { edges = append(edges, user.EdgeEvents) @@ -115486,8 +115764,8 @@ func (m *UserMutation) EdgeCleared(name string) bool { return m.clearedwebauthn case user.EdgeFiles: return m.clearedfiles - case user.EdgeFile: - return m.clearedfile + case user.EdgeAvatarFile: + return m.clearedavatar_file case user.EdgeEvents: return m.clearedevents case user.EdgeActionPlans: @@ -115517,8 +115795,8 @@ func (m *UserMutation) ClearEdge(name string) error { case user.EdgeSetting: m.ClearSetting() return nil - case user.EdgeFile: - m.ClearFile() + case user.EdgeAvatarFile: + m.ClearAvatarFile() return nil } return fmt.Errorf("unknown User unique edge %s", name) @@ -115555,8 +115833,8 @@ func (m *UserMutation) ResetEdge(name string) error { case user.EdgeFiles: m.ResetFiles() return nil - case user.EdgeFile: - m.ResetFile() + case user.EdgeAvatarFile: + m.ResetAvatarFile() return nil case user.EdgeEvents: m.ResetEvents() @@ -115612,7 +115890,6 @@ type UserHistoryMutation struct { last_name *string display_name *string avatar_remote_url *string - avatar_local_file *string avatar_local_file_id *string avatar_updated_at *time.Time last_seen *time.Time @@ -116465,55 +116742,6 @@ func (m *UserHistoryMutation) ResetAvatarRemoteURL() { delete(m.clearedFields, userhistory.FieldAvatarRemoteURL) } -// SetAvatarLocalFile sets the "avatar_local_file" field. -func (m *UserHistoryMutation) SetAvatarLocalFile(s string) { - m.avatar_local_file = &s -} - -// AvatarLocalFile returns the value of the "avatar_local_file" field in the mutation. -func (m *UserHistoryMutation) AvatarLocalFile() (r string, exists bool) { - v := m.avatar_local_file - if v == nil { - return - } - return *v, true -} - -// OldAvatarLocalFile returns the old "avatar_local_file" field's value of the UserHistory entity. -// If the UserHistory object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *UserHistoryMutation) OldAvatarLocalFile(ctx context.Context) (v *string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldAvatarLocalFile is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldAvatarLocalFile requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldAvatarLocalFile: %w", err) - } - return oldValue.AvatarLocalFile, nil -} - -// ClearAvatarLocalFile clears the value of the "avatar_local_file" field. -func (m *UserHistoryMutation) ClearAvatarLocalFile() { - m.avatar_local_file = nil - m.clearedFields[userhistory.FieldAvatarLocalFile] = struct{}{} -} - -// AvatarLocalFileCleared returns if the "avatar_local_file" field was cleared in this mutation. -func (m *UserHistoryMutation) AvatarLocalFileCleared() bool { - _, ok := m.clearedFields[userhistory.FieldAvatarLocalFile] - return ok -} - -// ResetAvatarLocalFile resets all changes to the "avatar_local_file" field. -func (m *UserHistoryMutation) ResetAvatarLocalFile() { - m.avatar_local_file = nil - delete(m.clearedFields, userhistory.FieldAvatarLocalFile) -} - // SetAvatarLocalFileID sets the "avatar_local_file_id" field. func (m *UserHistoryMutation) SetAvatarLocalFileID(s string) { m.avatar_local_file_id = &s @@ -116878,7 +117106,7 @@ func (m *UserHistoryMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *UserHistoryMutation) Fields() []string { - fields := make([]string, 0, 24) + fields := make([]string, 0, 23) if m.history_time != nil { fields = append(fields, userhistory.FieldHistoryTime) } @@ -116927,9 +117155,6 @@ func (m *UserHistoryMutation) Fields() []string { if m.avatar_remote_url != nil { fields = append(fields, userhistory.FieldAvatarRemoteURL) } - if m.avatar_local_file != nil { - fields = append(fields, userhistory.FieldAvatarLocalFile) - } if m.avatar_local_file_id != nil { fields = append(fields, userhistory.FieldAvatarLocalFileID) } @@ -116991,8 +117216,6 @@ func (m *UserHistoryMutation) Field(name string) (ent.Value, bool) { return m.DisplayName() case userhistory.FieldAvatarRemoteURL: return m.AvatarRemoteURL() - case userhistory.FieldAvatarLocalFile: - return m.AvatarLocalFile() case userhistory.FieldAvatarLocalFileID: return m.AvatarLocalFileID() case userhistory.FieldAvatarUpdatedAt: @@ -117048,8 +117271,6 @@ func (m *UserHistoryMutation) OldField(ctx context.Context, name string) (ent.Va return m.OldDisplayName(ctx) case userhistory.FieldAvatarRemoteURL: return m.OldAvatarRemoteURL(ctx) - case userhistory.FieldAvatarLocalFile: - return m.OldAvatarLocalFile(ctx) case userhistory.FieldAvatarLocalFileID: return m.OldAvatarLocalFileID(ctx) case userhistory.FieldAvatarUpdatedAt: @@ -117185,13 +117406,6 @@ func (m *UserHistoryMutation) SetField(name string, value ent.Value) error { } m.SetAvatarRemoteURL(v) return nil - case userhistory.FieldAvatarLocalFile: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetAvatarLocalFile(v) - return nil case userhistory.FieldAvatarLocalFileID: v, ok := value.(string) if !ok { @@ -117304,9 +117518,6 @@ func (m *UserHistoryMutation) ClearedFields() []string { if m.FieldCleared(userhistory.FieldAvatarRemoteURL) { fields = append(fields, userhistory.FieldAvatarRemoteURL) } - if m.FieldCleared(userhistory.FieldAvatarLocalFile) { - fields = append(fields, userhistory.FieldAvatarLocalFile) - } if m.FieldCleared(userhistory.FieldAvatarLocalFileID) { fields = append(fields, userhistory.FieldAvatarLocalFileID) } @@ -117372,9 +117583,6 @@ func (m *UserHistoryMutation) ClearField(name string) error { case userhistory.FieldAvatarRemoteURL: m.ClearAvatarRemoteURL() return nil - case userhistory.FieldAvatarLocalFile: - m.ClearAvatarLocalFile() - return nil case userhistory.FieldAvatarLocalFileID: m.ClearAvatarLocalFileID() return nil @@ -117449,9 +117657,6 @@ func (m *UserHistoryMutation) ResetField(name string) error { case userhistory.FieldAvatarRemoteURL: m.ResetAvatarRemoteURL() return nil - case userhistory.FieldAvatarLocalFile: - m.ResetAvatarLocalFile() - return nil case userhistory.FieldAvatarLocalFileID: m.ResetAvatarLocalFileID() return nil diff --git a/internal/ent/generated/organization.go b/internal/ent/generated/organization.go index c2f66a45..9062ff5d 100644 --- a/internal/ent/generated/organization.go +++ b/internal/ent/generated/organization.go @@ -10,6 +10,7 @@ import ( "entgo.io/ent" "entgo.io/ent/dialect/sql" + "github.com/theopenlane/core/internal/ent/generated/file" "github.com/theopenlane/core/internal/ent/generated/organization" "github.com/theopenlane/core/internal/ent/generated/organizationsetting" ) @@ -47,6 +48,10 @@ type Organization struct { PersonalOrg bool `json:"personal_org,omitempty"` // URL of the user's remote avatar AvatarRemoteURL *string `json:"avatar_remote_url,omitempty"` + // The organizations's local avatar file id, takes precedence over the avatar remote URL + AvatarLocalFileID *string `json:"avatar_local_file_id,omitempty"` + // The time the user's (local) avatar was last updated + AvatarUpdatedAt *time.Time `json:"avatar_updated_at,omitempty"` // Whether the organization has a dedicated database DedicatedDb bool `json:"dedicated_db,omitempty"` // Edges holds the relations/edges for other nodes in the graph. @@ -107,6 +112,8 @@ type OrganizationEdges struct { Secrets []*Hush `json:"secrets,omitempty"` // Files holds the value of the files edge. Files []*File `json:"files,omitempty"` + // AvatarFile holds the value of the avatar_file edge. + AvatarFile *File `json:"avatar_file,omitempty"` // Entities holds the value of the entities edge. Entities []*Entity `json:"entities,omitempty"` // EntityTypes holds the value of the entity_types edge. @@ -137,9 +144,9 @@ type OrganizationEdges struct { Members []*OrgMembership `json:"members,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. - loadedTypes [39]bool + loadedTypes [40]bool // totalCount holds the count of the edges above. - totalCount [39]map[string]int + totalCount [40]map[string]int namedControlCreators map[string][]*Group namedControlObjectiveCreators map[string][]*Group @@ -409,10 +416,21 @@ func (e OrganizationEdges) FilesOrErr() ([]*File, error) { return nil, &NotLoadedError{edge: "files"} } +// AvatarFileOrErr returns the AvatarFile value or an error if the edge +// was not loaded in eager-loading, or loaded but was not found. +func (e OrganizationEdges) AvatarFileOrErr() (*File, error) { + if e.AvatarFile != nil { + return e.AvatarFile, nil + } else if e.loadedTypes[25] { + return nil, &NotFoundError{label: file.Label} + } + return nil, &NotLoadedError{edge: "avatar_file"} +} + // EntitiesOrErr returns the Entities value or an error if the edge // was not loaded in eager-loading. func (e OrganizationEdges) EntitiesOrErr() ([]*Entity, error) { - if e.loadedTypes[25] { + if e.loadedTypes[26] { return e.Entities, nil } return nil, &NotLoadedError{edge: "entities"} @@ -421,7 +439,7 @@ func (e OrganizationEdges) EntitiesOrErr() ([]*Entity, error) { // EntityTypesOrErr returns the EntityTypes value or an error if the edge // was not loaded in eager-loading. func (e OrganizationEdges) EntityTypesOrErr() ([]*EntityType, error) { - if e.loadedTypes[26] { + if e.loadedTypes[27] { return e.EntityTypes, nil } return nil, &NotLoadedError{edge: "entity_types"} @@ -430,7 +448,7 @@ func (e OrganizationEdges) EntityTypesOrErr() ([]*EntityType, error) { // ContactsOrErr returns the Contacts value or an error if the edge // was not loaded in eager-loading. func (e OrganizationEdges) ContactsOrErr() ([]*Contact, error) { - if e.loadedTypes[27] { + if e.loadedTypes[28] { return e.Contacts, nil } return nil, &NotLoadedError{edge: "contacts"} @@ -439,7 +457,7 @@ func (e OrganizationEdges) ContactsOrErr() ([]*Contact, error) { // NotesOrErr returns the Notes value or an error if the edge // was not loaded in eager-loading. func (e OrganizationEdges) NotesOrErr() ([]*Note, error) { - if e.loadedTypes[28] { + if e.loadedTypes[29] { return e.Notes, nil } return nil, &NotLoadedError{edge: "notes"} @@ -448,7 +466,7 @@ func (e OrganizationEdges) NotesOrErr() ([]*Note, error) { // TasksOrErr returns the Tasks value or an error if the edge // was not loaded in eager-loading. func (e OrganizationEdges) TasksOrErr() ([]*Task, error) { - if e.loadedTypes[29] { + if e.loadedTypes[30] { return e.Tasks, nil } return nil, &NotLoadedError{edge: "tasks"} @@ -457,7 +475,7 @@ func (e OrganizationEdges) TasksOrErr() ([]*Task, error) { // ProgramsOrErr returns the Programs value or an error if the edge // was not loaded in eager-loading. func (e OrganizationEdges) ProgramsOrErr() ([]*Program, error) { - if e.loadedTypes[30] { + if e.loadedTypes[31] { return e.Programs, nil } return nil, &NotLoadedError{edge: "programs"} @@ -466,7 +484,7 @@ func (e OrganizationEdges) ProgramsOrErr() ([]*Program, error) { // ProceduresOrErr returns the Procedures value or an error if the edge // was not loaded in eager-loading. func (e OrganizationEdges) ProceduresOrErr() ([]*Procedure, error) { - if e.loadedTypes[31] { + if e.loadedTypes[32] { return e.Procedures, nil } return nil, &NotLoadedError{edge: "procedures"} @@ -475,7 +493,7 @@ func (e OrganizationEdges) ProceduresOrErr() ([]*Procedure, error) { // InternalPoliciesOrErr returns the InternalPolicies value or an error if the edge // was not loaded in eager-loading. func (e OrganizationEdges) InternalPoliciesOrErr() ([]*InternalPolicy, error) { - if e.loadedTypes[32] { + if e.loadedTypes[33] { return e.InternalPolicies, nil } return nil, &NotLoadedError{edge: "internal_policies"} @@ -484,7 +502,7 @@ func (e OrganizationEdges) InternalPoliciesOrErr() ([]*InternalPolicy, error) { // RisksOrErr returns the Risks value or an error if the edge // was not loaded in eager-loading. func (e OrganizationEdges) RisksOrErr() ([]*Risk, error) { - if e.loadedTypes[33] { + if e.loadedTypes[34] { return e.Risks, nil } return nil, &NotLoadedError{edge: "risks"} @@ -493,7 +511,7 @@ func (e OrganizationEdges) RisksOrErr() ([]*Risk, error) { // ControlObjectivesOrErr returns the ControlObjectives value or an error if the edge // was not loaded in eager-loading. func (e OrganizationEdges) ControlObjectivesOrErr() ([]*ControlObjective, error) { - if e.loadedTypes[34] { + if e.loadedTypes[35] { return e.ControlObjectives, nil } return nil, &NotLoadedError{edge: "control_objectives"} @@ -502,7 +520,7 @@ func (e OrganizationEdges) ControlObjectivesOrErr() ([]*ControlObjective, error) // NarrativesOrErr returns the Narratives value or an error if the edge // was not loaded in eager-loading. func (e OrganizationEdges) NarrativesOrErr() ([]*Narrative, error) { - if e.loadedTypes[35] { + if e.loadedTypes[36] { return e.Narratives, nil } return nil, &NotLoadedError{edge: "narratives"} @@ -511,7 +529,7 @@ func (e OrganizationEdges) NarrativesOrErr() ([]*Narrative, error) { // ControlsOrErr returns the Controls value or an error if the edge // was not loaded in eager-loading. func (e OrganizationEdges) ControlsOrErr() ([]*Control, error) { - if e.loadedTypes[36] { + if e.loadedTypes[37] { return e.Controls, nil } return nil, &NotLoadedError{edge: "controls"} @@ -520,7 +538,7 @@ func (e OrganizationEdges) ControlsOrErr() ([]*Control, error) { // SubcontrolsOrErr returns the Subcontrols value or an error if the edge // was not loaded in eager-loading. func (e OrganizationEdges) SubcontrolsOrErr() ([]*Subcontrol, error) { - if e.loadedTypes[37] { + if e.loadedTypes[38] { return e.Subcontrols, nil } return nil, &NotLoadedError{edge: "subcontrols"} @@ -529,7 +547,7 @@ func (e OrganizationEdges) SubcontrolsOrErr() ([]*Subcontrol, error) { // MembersOrErr returns the Members value or an error if the edge // was not loaded in eager-loading. func (e OrganizationEdges) MembersOrErr() ([]*OrgMembership, error) { - if e.loadedTypes[38] { + if e.loadedTypes[39] { return e.Members, nil } return nil, &NotLoadedError{edge: "members"} @@ -544,9 +562,9 @@ func (*Organization) scanValues(columns []string) ([]any, error) { values[i] = new([]byte) case organization.FieldPersonalOrg, organization.FieldDedicatedDb: values[i] = new(sql.NullBool) - case organization.FieldID, organization.FieldCreatedBy, organization.FieldUpdatedBy, organization.FieldMappingID, organization.FieldDeletedBy, organization.FieldName, organization.FieldDisplayName, organization.FieldDescription, organization.FieldParentOrganizationID, organization.FieldAvatarRemoteURL: + case organization.FieldID, organization.FieldCreatedBy, organization.FieldUpdatedBy, organization.FieldMappingID, organization.FieldDeletedBy, organization.FieldName, organization.FieldDisplayName, organization.FieldDescription, organization.FieldParentOrganizationID, organization.FieldAvatarRemoteURL, organization.FieldAvatarLocalFileID: values[i] = new(sql.NullString) - case organization.FieldCreatedAt, organization.FieldUpdatedAt, organization.FieldDeletedAt: + case organization.FieldCreatedAt, organization.FieldUpdatedAt, organization.FieldDeletedAt, organization.FieldAvatarUpdatedAt: values[i] = new(sql.NullTime) default: values[i] = new(sql.UnknownType) @@ -656,6 +674,20 @@ func (o *Organization) assignValues(columns []string, values []any) error { o.AvatarRemoteURL = new(string) *o.AvatarRemoteURL = value.String } + case organization.FieldAvatarLocalFileID: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field avatar_local_file_id", values[i]) + } else if value.Valid { + o.AvatarLocalFileID = new(string) + *o.AvatarLocalFileID = value.String + } + case organization.FieldAvatarUpdatedAt: + if value, ok := values[i].(*sql.NullTime); !ok { + return fmt.Errorf("unexpected type %T for field avatar_updated_at", values[i]) + } else if value.Valid { + o.AvatarUpdatedAt = new(time.Time) + *o.AvatarUpdatedAt = value.Time + } case organization.FieldDedicatedDb: if value, ok := values[i].(*sql.NullBool); !ok { return fmt.Errorf("unexpected type %T for field dedicated_db", values[i]) @@ -800,6 +832,11 @@ func (o *Organization) QueryFiles() *FileQuery { return NewOrganizationClient(o.config).QueryFiles(o) } +// QueryAvatarFile queries the "avatar_file" edge of the Organization entity. +func (o *Organization) QueryAvatarFile() *FileQuery { + return NewOrganizationClient(o.config).QueryAvatarFile(o) +} + // QueryEntities queries the "entities" edge of the Organization entity. func (o *Organization) QueryEntities() *EntityQuery { return NewOrganizationClient(o.config).QueryEntities(o) @@ -937,6 +974,16 @@ func (o *Organization) String() string { builder.WriteString(*v) } builder.WriteString(", ") + if v := o.AvatarLocalFileID; v != nil { + builder.WriteString("avatar_local_file_id=") + builder.WriteString(*v) + } + builder.WriteString(", ") + if v := o.AvatarUpdatedAt; v != nil { + builder.WriteString("avatar_updated_at=") + builder.WriteString(v.Format(time.ANSIC)) + } + builder.WriteString(", ") builder.WriteString("dedicated_db=") builder.WriteString(fmt.Sprintf("%v", o.DedicatedDb)) builder.WriteByte(')') diff --git a/internal/ent/generated/organization/organization.go b/internal/ent/generated/organization/organization.go index 1a037482..f3e195bc 100644 --- a/internal/ent/generated/organization/organization.go +++ b/internal/ent/generated/organization/organization.go @@ -43,6 +43,10 @@ const ( FieldPersonalOrg = "personal_org" // FieldAvatarRemoteURL holds the string denoting the avatar_remote_url field in the database. FieldAvatarRemoteURL = "avatar_remote_url" + // FieldAvatarLocalFileID holds the string denoting the avatar_local_file_id field in the database. + FieldAvatarLocalFileID = "avatar_local_file_id" + // FieldAvatarUpdatedAt holds the string denoting the avatar_updated_at field in the database. + FieldAvatarUpdatedAt = "avatar_updated_at" // FieldDedicatedDb holds the string denoting the dedicated_db field in the database. FieldDedicatedDb = "dedicated_db" // EdgeControlCreators holds the string denoting the control_creators edge name in mutations. @@ -95,6 +99,8 @@ const ( EdgeSecrets = "secrets" // EdgeFiles holds the string denoting the files edge name in mutations. EdgeFiles = "files" + // EdgeAvatarFile holds the string denoting the avatar_file edge name in mutations. + EdgeAvatarFile = "avatar_file" // EdgeEntities holds the string denoting the entities edge name in mutations. EdgeEntities = "entities" // EdgeEntityTypes holds the string denoting the entity_types edge name in mutations. @@ -266,6 +272,13 @@ const ( // FilesInverseTable is the table name for the File entity. // It exists in this package in order to avoid circular dependency with the "file" package. FilesInverseTable = "files" + // AvatarFileTable is the table that holds the avatar_file relation/edge. + AvatarFileTable = "organizations" + // AvatarFileInverseTable is the table name for the File entity. + // It exists in this package in order to avoid circular dependency with the "file" package. + AvatarFileInverseTable = "files" + // AvatarFileColumn is the table column denoting the avatar_file relation/edge. + AvatarFileColumn = "avatar_local_file_id" // EntitiesTable is the table that holds the entities relation/edge. EntitiesTable = "entities" // EntitiesInverseTable is the table name for the Entity entity. @@ -381,6 +394,8 @@ var Columns = []string{ FieldParentOrganizationID, FieldPersonalOrg, FieldAvatarRemoteURL, + FieldAvatarLocalFileID, + FieldAvatarUpdatedAt, FieldDedicatedDb, } @@ -471,6 +486,10 @@ var ( DefaultPersonalOrg bool // AvatarRemoteURLValidator is a validator for the "avatar_remote_url" field. It is called by the builders before save. AvatarRemoteURLValidator func(string) error + // DefaultAvatarUpdatedAt holds the default value on creation for the "avatar_updated_at" field. + DefaultAvatarUpdatedAt func() time.Time + // UpdateDefaultAvatarUpdatedAt holds the default value on update for the "avatar_updated_at" field. + UpdateDefaultAvatarUpdatedAt func() time.Time // DefaultDedicatedDb holds the default value on creation for the "dedicated_db" field. DefaultDedicatedDb bool // DefaultID holds the default value on creation for the "id" field. @@ -550,6 +569,16 @@ func ByAvatarRemoteURL(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldAvatarRemoteURL, opts...).ToFunc() } +// ByAvatarLocalFileID orders the results by the avatar_local_file_id field. +func ByAvatarLocalFileID(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldAvatarLocalFileID, opts...).ToFunc() +} + +// ByAvatarUpdatedAt orders the results by the avatar_updated_at field. +func ByAvatarUpdatedAt(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldAvatarUpdatedAt, opts...).ToFunc() +} + // ByDedicatedDb orders the results by the dedicated_db field. func ByDedicatedDb(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDedicatedDb, opts...).ToFunc() @@ -891,6 +920,13 @@ func ByFiles(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { } } +// ByAvatarFileField orders the results by avatar_file field. +func ByAvatarFileField(field string, opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newAvatarFileStep(), sql.OrderByField(field, opts...)) + } +} + // ByEntitiesCount orders the results by entities count. func ByEntitiesCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { @@ -1261,6 +1297,13 @@ func newFilesStep() *sqlgraph.Step { sqlgraph.Edge(sqlgraph.M2M, false, FilesTable, FilesPrimaryKey...), ) } +func newAvatarFileStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(AvatarFileInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, AvatarFileTable, AvatarFileColumn), + ) +} func newEntitiesStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), diff --git a/internal/ent/generated/organization/where.go b/internal/ent/generated/organization/where.go index 88c2cec2..0211e1e1 100644 --- a/internal/ent/generated/organization/where.go +++ b/internal/ent/generated/organization/where.go @@ -132,6 +132,16 @@ func AvatarRemoteURL(v string) predicate.Organization { return predicate.Organization(sql.FieldEQ(FieldAvatarRemoteURL, v)) } +// AvatarLocalFileID applies equality check predicate on the "avatar_local_file_id" field. It's identical to AvatarLocalFileIDEQ. +func AvatarLocalFileID(v string) predicate.Organization { + return predicate.Organization(sql.FieldEQ(FieldAvatarLocalFileID, v)) +} + +// AvatarUpdatedAt applies equality check predicate on the "avatar_updated_at" field. It's identical to AvatarUpdatedAtEQ. +func AvatarUpdatedAt(v time.Time) predicate.Organization { + return predicate.Organization(sql.FieldEQ(FieldAvatarUpdatedAt, v)) +} + // DedicatedDb applies equality check predicate on the "dedicated_db" field. It's identical to DedicatedDbEQ. func DedicatedDb(v bool) predicate.Organization { return predicate.Organization(sql.FieldEQ(FieldDedicatedDb, v)) @@ -962,6 +972,131 @@ func AvatarRemoteURLContainsFold(v string) predicate.Organization { return predicate.Organization(sql.FieldContainsFold(FieldAvatarRemoteURL, v)) } +// AvatarLocalFileIDEQ applies the EQ predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDEQ(v string) predicate.Organization { + return predicate.Organization(sql.FieldEQ(FieldAvatarLocalFileID, v)) +} + +// AvatarLocalFileIDNEQ applies the NEQ predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDNEQ(v string) predicate.Organization { + return predicate.Organization(sql.FieldNEQ(FieldAvatarLocalFileID, v)) +} + +// AvatarLocalFileIDIn applies the In predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDIn(vs ...string) predicate.Organization { + return predicate.Organization(sql.FieldIn(FieldAvatarLocalFileID, vs...)) +} + +// AvatarLocalFileIDNotIn applies the NotIn predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDNotIn(vs ...string) predicate.Organization { + return predicate.Organization(sql.FieldNotIn(FieldAvatarLocalFileID, vs...)) +} + +// AvatarLocalFileIDGT applies the GT predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDGT(v string) predicate.Organization { + return predicate.Organization(sql.FieldGT(FieldAvatarLocalFileID, v)) +} + +// AvatarLocalFileIDGTE applies the GTE predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDGTE(v string) predicate.Organization { + return predicate.Organization(sql.FieldGTE(FieldAvatarLocalFileID, v)) +} + +// AvatarLocalFileIDLT applies the LT predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDLT(v string) predicate.Organization { + return predicate.Organization(sql.FieldLT(FieldAvatarLocalFileID, v)) +} + +// AvatarLocalFileIDLTE applies the LTE predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDLTE(v string) predicate.Organization { + return predicate.Organization(sql.FieldLTE(FieldAvatarLocalFileID, v)) +} + +// AvatarLocalFileIDContains applies the Contains predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDContains(v string) predicate.Organization { + return predicate.Organization(sql.FieldContains(FieldAvatarLocalFileID, v)) +} + +// AvatarLocalFileIDHasPrefix applies the HasPrefix predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDHasPrefix(v string) predicate.Organization { + return predicate.Organization(sql.FieldHasPrefix(FieldAvatarLocalFileID, v)) +} + +// AvatarLocalFileIDHasSuffix applies the HasSuffix predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDHasSuffix(v string) predicate.Organization { + return predicate.Organization(sql.FieldHasSuffix(FieldAvatarLocalFileID, v)) +} + +// AvatarLocalFileIDIsNil applies the IsNil predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDIsNil() predicate.Organization { + return predicate.Organization(sql.FieldIsNull(FieldAvatarLocalFileID)) +} + +// AvatarLocalFileIDNotNil applies the NotNil predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDNotNil() predicate.Organization { + return predicate.Organization(sql.FieldNotNull(FieldAvatarLocalFileID)) +} + +// AvatarLocalFileIDEqualFold applies the EqualFold predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDEqualFold(v string) predicate.Organization { + return predicate.Organization(sql.FieldEqualFold(FieldAvatarLocalFileID, v)) +} + +// AvatarLocalFileIDContainsFold applies the ContainsFold predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDContainsFold(v string) predicate.Organization { + return predicate.Organization(sql.FieldContainsFold(FieldAvatarLocalFileID, v)) +} + +// AvatarUpdatedAtEQ applies the EQ predicate on the "avatar_updated_at" field. +func AvatarUpdatedAtEQ(v time.Time) predicate.Organization { + return predicate.Organization(sql.FieldEQ(FieldAvatarUpdatedAt, v)) +} + +// AvatarUpdatedAtNEQ applies the NEQ predicate on the "avatar_updated_at" field. +func AvatarUpdatedAtNEQ(v time.Time) predicate.Organization { + return predicate.Organization(sql.FieldNEQ(FieldAvatarUpdatedAt, v)) +} + +// AvatarUpdatedAtIn applies the In predicate on the "avatar_updated_at" field. +func AvatarUpdatedAtIn(vs ...time.Time) predicate.Organization { + return predicate.Organization(sql.FieldIn(FieldAvatarUpdatedAt, vs...)) +} + +// AvatarUpdatedAtNotIn applies the NotIn predicate on the "avatar_updated_at" field. +func AvatarUpdatedAtNotIn(vs ...time.Time) predicate.Organization { + return predicate.Organization(sql.FieldNotIn(FieldAvatarUpdatedAt, vs...)) +} + +// AvatarUpdatedAtGT applies the GT predicate on the "avatar_updated_at" field. +func AvatarUpdatedAtGT(v time.Time) predicate.Organization { + return predicate.Organization(sql.FieldGT(FieldAvatarUpdatedAt, v)) +} + +// AvatarUpdatedAtGTE applies the GTE predicate on the "avatar_updated_at" field. +func AvatarUpdatedAtGTE(v time.Time) predicate.Organization { + return predicate.Organization(sql.FieldGTE(FieldAvatarUpdatedAt, v)) +} + +// AvatarUpdatedAtLT applies the LT predicate on the "avatar_updated_at" field. +func AvatarUpdatedAtLT(v time.Time) predicate.Organization { + return predicate.Organization(sql.FieldLT(FieldAvatarUpdatedAt, v)) +} + +// AvatarUpdatedAtLTE applies the LTE predicate on the "avatar_updated_at" field. +func AvatarUpdatedAtLTE(v time.Time) predicate.Organization { + return predicate.Organization(sql.FieldLTE(FieldAvatarUpdatedAt, v)) +} + +// AvatarUpdatedAtIsNil applies the IsNil predicate on the "avatar_updated_at" field. +func AvatarUpdatedAtIsNil() predicate.Organization { + return predicate.Organization(sql.FieldIsNull(FieldAvatarUpdatedAt)) +} + +// AvatarUpdatedAtNotNil applies the NotNil predicate on the "avatar_updated_at" field. +func AvatarUpdatedAtNotNil() predicate.Organization { + return predicate.Organization(sql.FieldNotNull(FieldAvatarUpdatedAt)) +} + // DedicatedDbEQ applies the EQ predicate on the "dedicated_db" field. func DedicatedDbEQ(v bool) predicate.Organization { return predicate.Organization(sql.FieldEQ(FieldDedicatedDb, v)) @@ -1697,6 +1832,35 @@ func HasFilesWith(preds ...predicate.File) predicate.Organization { }) } +// HasAvatarFile applies the HasEdge predicate on the "avatar_file" edge. +func HasAvatarFile() predicate.Organization { + return predicate.Organization(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, AvatarFileTable, AvatarFileColumn), + ) + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.File + step.Edge.Schema = schemaConfig.Organization + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasAvatarFileWith applies the HasEdge predicate on the "avatar_file" edge with a given conditions (other predicates). +func HasAvatarFileWith(preds ...predicate.File) predicate.Organization { + return predicate.Organization(func(s *sql.Selector) { + step := newAvatarFileStep() + schemaConfig := internal.SchemaConfigFromContext(s.Context()) + step.To.Schema = schemaConfig.File + step.Edge.Schema = schemaConfig.Organization + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + // HasEntities applies the HasEdge predicate on the "entities" edge. func HasEntities() predicate.Organization { return predicate.Organization(func(s *sql.Selector) { diff --git a/internal/ent/generated/organization_create.go b/internal/ent/generated/organization_create.go index b1e6cec3..22534603 100644 --- a/internal/ent/generated/organization_create.go +++ b/internal/ent/generated/organization_create.go @@ -228,6 +228,34 @@ func (oc *OrganizationCreate) SetNillableAvatarRemoteURL(s *string) *Organizatio return oc } +// SetAvatarLocalFileID sets the "avatar_local_file_id" field. +func (oc *OrganizationCreate) SetAvatarLocalFileID(s string) *OrganizationCreate { + oc.mutation.SetAvatarLocalFileID(s) + return oc +} + +// SetNillableAvatarLocalFileID sets the "avatar_local_file_id" field if the given value is not nil. +func (oc *OrganizationCreate) SetNillableAvatarLocalFileID(s *string) *OrganizationCreate { + if s != nil { + oc.SetAvatarLocalFileID(*s) + } + return oc +} + +// SetAvatarUpdatedAt sets the "avatar_updated_at" field. +func (oc *OrganizationCreate) SetAvatarUpdatedAt(t time.Time) *OrganizationCreate { + oc.mutation.SetAvatarUpdatedAt(t) + return oc +} + +// SetNillableAvatarUpdatedAt sets the "avatar_updated_at" field if the given value is not nil. +func (oc *OrganizationCreate) SetNillableAvatarUpdatedAt(t *time.Time) *OrganizationCreate { + if t != nil { + oc.SetAvatarUpdatedAt(*t) + } + return oc +} + // SetDedicatedDb sets the "dedicated_db" field. func (oc *OrganizationCreate) SetDedicatedDb(b bool) *OrganizationCreate { oc.mutation.SetDedicatedDb(b) @@ -639,6 +667,25 @@ func (oc *OrganizationCreate) AddFiles(f ...*File) *OrganizationCreate { return oc.AddFileIDs(ids...) } +// SetAvatarFileID sets the "avatar_file" edge to the File entity by ID. +func (oc *OrganizationCreate) SetAvatarFileID(id string) *OrganizationCreate { + oc.mutation.SetAvatarFileID(id) + return oc +} + +// SetNillableAvatarFileID sets the "avatar_file" edge to the File entity by ID if the given value is not nil. +func (oc *OrganizationCreate) SetNillableAvatarFileID(id *string) *OrganizationCreate { + if id != nil { + oc = oc.SetAvatarFileID(*id) + } + return oc +} + +// SetAvatarFile sets the "avatar_file" edge to the File entity. +func (oc *OrganizationCreate) SetAvatarFile(f *File) *OrganizationCreate { + return oc.SetAvatarFileID(f.ID) +} + // AddEntityIDs adds the "entities" edge to the Entity entity by IDs. func (oc *OrganizationCreate) AddEntityIDs(ids ...string) *OrganizationCreate { oc.mutation.AddEntityIDs(ids...) @@ -919,6 +966,13 @@ func (oc *OrganizationCreate) defaults() error { v := organization.DefaultPersonalOrg oc.mutation.SetPersonalOrg(v) } + if _, ok := oc.mutation.AvatarUpdatedAt(); !ok { + if organization.DefaultAvatarUpdatedAt == nil { + return fmt.Errorf("generated: uninitialized organization.DefaultAvatarUpdatedAt (forgotten import generated/runtime?)") + } + v := organization.DefaultAvatarUpdatedAt() + oc.mutation.SetAvatarUpdatedAt(v) + } if _, ok := oc.mutation.DedicatedDb(); !ok { v := organization.DefaultDedicatedDb oc.mutation.SetDedicatedDb(v) @@ -1050,6 +1104,10 @@ func (oc *OrganizationCreate) createSpec() (*Organization, *sqlgraph.CreateSpec) _spec.SetField(organization.FieldAvatarRemoteURL, field.TypeString, value) _node.AvatarRemoteURL = &value } + if value, ok := oc.mutation.AvatarUpdatedAt(); ok { + _spec.SetField(organization.FieldAvatarUpdatedAt, field.TypeTime, value) + _node.AvatarUpdatedAt = &value + } if value, ok := oc.mutation.DedicatedDb(); ok { _spec.SetField(organization.FieldDedicatedDb, field.TypeBool, value) _node.DedicatedDb = value @@ -1487,6 +1545,24 @@ func (oc *OrganizationCreate) createSpec() (*Organization, *sqlgraph.CreateSpec) } _spec.Edges = append(_spec.Edges, edge) } + if nodes := oc.mutation.AvatarFileIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: organization.AvatarFileTable, + Columns: []string{organization.AvatarFileColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(file.FieldID, field.TypeString), + }, + } + edge.Schema = oc.schemaConfig.Organization + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _node.AvatarLocalFileID = &nodes[0] + _spec.Edges = append(_spec.Edges, edge) + } if nodes := oc.mutation.EntitiesIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, diff --git a/internal/ent/generated/organization_query.go b/internal/ent/generated/organization_query.go index fd5f3216..2fcf1840 100644 --- a/internal/ent/generated/organization_query.go +++ b/internal/ent/generated/organization_query.go @@ -79,6 +79,7 @@ type OrganizationQuery struct { withEvents *EventQuery withSecrets *HushQuery withFiles *FileQuery + withAvatarFile *FileQuery withEntities *EntityQuery withEntityTypes *EntityTypeQuery withContacts *ContactQuery @@ -793,6 +794,31 @@ func (oq *OrganizationQuery) QueryFiles() *FileQuery { return query } +// QueryAvatarFile chains the current query on the "avatar_file" edge. +func (oq *OrganizationQuery) QueryAvatarFile() *FileQuery { + query := (&FileClient{config: oq.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := oq.prepareQuery(ctx); err != nil { + return nil, err + } + selector := oq.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(organization.Table, organization.FieldID, selector), + sqlgraph.To(file.Table, file.FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, organization.AvatarFileTable, organization.AvatarFileColumn), + ) + schemaConfig := oq.schemaConfig + step.To.Schema = schemaConfig.File + step.Edge.Schema = schemaConfig.Organization + fromU = sqlgraph.SetNeighbors(oq.driver.Dialect(), step) + return fromU, nil + } + return query +} + // QueryEntities chains the current query on the "entities" edge. func (oq *OrganizationQuery) QueryEntities() *EntityQuery { query := (&EntityClient{config: oq.config}).Query() @@ -1360,6 +1386,7 @@ func (oq *OrganizationQuery) Clone() *OrganizationQuery { withEvents: oq.withEvents.Clone(), withSecrets: oq.withSecrets.Clone(), withFiles: oq.withFiles.Clone(), + withAvatarFile: oq.withAvatarFile.Clone(), withEntities: oq.withEntities.Clone(), withEntityTypes: oq.withEntityTypes.Clone(), withContacts: oq.withContacts.Clone(), @@ -1656,6 +1683,17 @@ func (oq *OrganizationQuery) WithFiles(opts ...func(*FileQuery)) *OrganizationQu return oq } +// WithAvatarFile tells the query-builder to eager-load the nodes that are connected to +// the "avatar_file" edge. The optional arguments are used to configure the query builder of the edge. +func (oq *OrganizationQuery) WithAvatarFile(opts ...func(*FileQuery)) *OrganizationQuery { + query := (&FileClient{config: oq.config}).Query() + for _, opt := range opts { + opt(query) + } + oq.withAvatarFile = query + return oq +} + // WithEntities tells the query-builder to eager-load the nodes that are connected to // the "entities" edge. The optional arguments are used to configure the query builder of the edge. func (oq *OrganizationQuery) WithEntities(opts ...func(*EntityQuery)) *OrganizationQuery { @@ -1894,7 +1932,7 @@ func (oq *OrganizationQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([] var ( nodes = []*Organization{} _spec = oq.querySpec() - loadedTypes = [39]bool{ + loadedTypes = [40]bool{ oq.withControlCreators != nil, oq.withControlObjectiveCreators != nil, oq.withGroupCreators != nil, @@ -1920,6 +1958,7 @@ func (oq *OrganizationQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([] oq.withEvents != nil, oq.withSecrets != nil, oq.withFiles != nil, + oq.withAvatarFile != nil, oq.withEntities != nil, oq.withEntityTypes != nil, oq.withContacts != nil, @@ -2140,6 +2179,12 @@ func (oq *OrganizationQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([] return nil, err } } + if query := oq.withAvatarFile; query != nil { + if err := oq.loadAvatarFile(ctx, query, nodes, nil, + func(n *Organization, e *File) { n.Edges.AvatarFile = e }); err != nil { + return nil, err + } + } if query := oq.withEntities; query != nil { if err := oq.loadEntities(ctx, query, nodes, func(n *Organization) { n.Edges.Entities = []*Entity{} }, @@ -3704,6 +3749,38 @@ func (oq *OrganizationQuery) loadFiles(ctx context.Context, query *FileQuery, no } return nil } +func (oq *OrganizationQuery) loadAvatarFile(ctx context.Context, query *FileQuery, nodes []*Organization, init func(*Organization), assign func(*Organization, *File)) error { + ids := make([]string, 0, len(nodes)) + nodeids := make(map[string][]*Organization) + for i := range nodes { + if nodes[i].AvatarLocalFileID == nil { + continue + } + fk := *nodes[i].AvatarLocalFileID + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + if len(ids) == 0 { + return nil + } + query.Where(file.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "avatar_local_file_id" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) + } + } + return nil +} func (oq *OrganizationQuery) loadEntities(ctx context.Context, query *EntityQuery, nodes []*Organization, init func(*Organization), assign func(*Organization, *Entity)) error { fks := make([]driver.Value, 0, len(nodes)) nodeids := make(map[string]*Organization) @@ -4197,6 +4274,9 @@ func (oq *OrganizationQuery) querySpec() *sqlgraph.QuerySpec { if oq.withParent != nil { _spec.Node.AddColumnOnce(organization.FieldParentOrganizationID) } + if oq.withAvatarFile != nil { + _spec.Node.AddColumnOnce(organization.FieldAvatarLocalFileID) + } } if ps := oq.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { diff --git a/internal/ent/generated/organization_update.go b/internal/ent/generated/organization_update.go index 2b3676b9..708b9d5d 100644 --- a/internal/ent/generated/organization_update.go +++ b/internal/ent/generated/organization_update.go @@ -218,6 +218,38 @@ func (ou *OrganizationUpdate) ClearAvatarRemoteURL() *OrganizationUpdate { return ou } +// SetAvatarLocalFileID sets the "avatar_local_file_id" field. +func (ou *OrganizationUpdate) SetAvatarLocalFileID(s string) *OrganizationUpdate { + ou.mutation.SetAvatarLocalFileID(s) + return ou +} + +// SetNillableAvatarLocalFileID sets the "avatar_local_file_id" field if the given value is not nil. +func (ou *OrganizationUpdate) SetNillableAvatarLocalFileID(s *string) *OrganizationUpdate { + if s != nil { + ou.SetAvatarLocalFileID(*s) + } + return ou +} + +// ClearAvatarLocalFileID clears the value of the "avatar_local_file_id" field. +func (ou *OrganizationUpdate) ClearAvatarLocalFileID() *OrganizationUpdate { + ou.mutation.ClearAvatarLocalFileID() + return ou +} + +// SetAvatarUpdatedAt sets the "avatar_updated_at" field. +func (ou *OrganizationUpdate) SetAvatarUpdatedAt(t time.Time) *OrganizationUpdate { + ou.mutation.SetAvatarUpdatedAt(t) + return ou +} + +// ClearAvatarUpdatedAt clears the value of the "avatar_updated_at" field. +func (ou *OrganizationUpdate) ClearAvatarUpdatedAt() *OrganizationUpdate { + ou.mutation.ClearAvatarUpdatedAt() + return ou +} + // SetDedicatedDb sets the "dedicated_db" field. func (ou *OrganizationUpdate) SetDedicatedDb(b bool) *OrganizationUpdate { ou.mutation.SetDedicatedDb(b) @@ -596,6 +628,25 @@ func (ou *OrganizationUpdate) AddFiles(f ...*File) *OrganizationUpdate { return ou.AddFileIDs(ids...) } +// SetAvatarFileID sets the "avatar_file" edge to the File entity by ID. +func (ou *OrganizationUpdate) SetAvatarFileID(id string) *OrganizationUpdate { + ou.mutation.SetAvatarFileID(id) + return ou +} + +// SetNillableAvatarFileID sets the "avatar_file" edge to the File entity by ID if the given value is not nil. +func (ou *OrganizationUpdate) SetNillableAvatarFileID(id *string) *OrganizationUpdate { + if id != nil { + ou = ou.SetAvatarFileID(*id) + } + return ou +} + +// SetAvatarFile sets the "avatar_file" edge to the File entity. +func (ou *OrganizationUpdate) SetAvatarFile(f *File) *OrganizationUpdate { + return ou.SetAvatarFileID(f.ID) +} + // AddEntityIDs adds the "entities" edge to the Entity entity by IDs. func (ou *OrganizationUpdate) AddEntityIDs(ids ...string) *OrganizationUpdate { ou.mutation.AddEntityIDs(ids...) @@ -1300,6 +1351,12 @@ func (ou *OrganizationUpdate) RemoveFiles(f ...*File) *OrganizationUpdate { return ou.RemoveFileIDs(ids...) } +// ClearAvatarFile clears the "avatar_file" edge to the File entity. +func (ou *OrganizationUpdate) ClearAvatarFile() *OrganizationUpdate { + ou.mutation.ClearAvatarFile() + return ou +} + // ClearEntities clears all "entities" edges to the Entity entity. func (ou *OrganizationUpdate) ClearEntities() *OrganizationUpdate { ou.mutation.ClearEntities() @@ -1633,6 +1690,13 @@ func (ou *OrganizationUpdate) defaults() error { v := organization.UpdateDefaultUpdatedAt() ou.mutation.SetUpdatedAt(v) } + if _, ok := ou.mutation.AvatarUpdatedAt(); !ok && !ou.mutation.AvatarUpdatedAtCleared() { + if organization.UpdateDefaultAvatarUpdatedAt == nil { + return fmt.Errorf("generated: uninitialized organization.UpdateDefaultAvatarUpdatedAt (forgotten import generated/runtime?)") + } + v := organization.UpdateDefaultAvatarUpdatedAt() + ou.mutation.SetAvatarUpdatedAt(v) + } return nil } @@ -1736,6 +1800,12 @@ func (ou *OrganizationUpdate) sqlSave(ctx context.Context) (n int, err error) { if ou.mutation.AvatarRemoteURLCleared() { _spec.ClearField(organization.FieldAvatarRemoteURL, field.TypeString) } + if value, ok := ou.mutation.AvatarUpdatedAt(); ok { + _spec.SetField(organization.FieldAvatarUpdatedAt, field.TypeTime, value) + } + if ou.mutation.AvatarUpdatedAtCleared() { + _spec.ClearField(organization.FieldAvatarUpdatedAt, field.TypeTime) + } if value, ok := ou.mutation.DedicatedDb(); ok { _spec.SetField(organization.FieldDedicatedDb, field.TypeBool, value) } @@ -2895,6 +2965,37 @@ func (ou *OrganizationUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if ou.mutation.AvatarFileCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: organization.AvatarFileTable, + Columns: []string{organization.AvatarFileColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(file.FieldID, field.TypeString), + }, + } + edge.Schema = ou.schemaConfig.Organization + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := ou.mutation.AvatarFileIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: organization.AvatarFileTable, + Columns: []string{organization.AvatarFileColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(file.FieldID, field.TypeString), + }, + } + edge.Schema = ou.schemaConfig.Organization + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } if ou.mutation.EntitiesCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, @@ -3749,6 +3850,38 @@ func (ouo *OrganizationUpdateOne) ClearAvatarRemoteURL() *OrganizationUpdateOne return ouo } +// SetAvatarLocalFileID sets the "avatar_local_file_id" field. +func (ouo *OrganizationUpdateOne) SetAvatarLocalFileID(s string) *OrganizationUpdateOne { + ouo.mutation.SetAvatarLocalFileID(s) + return ouo +} + +// SetNillableAvatarLocalFileID sets the "avatar_local_file_id" field if the given value is not nil. +func (ouo *OrganizationUpdateOne) SetNillableAvatarLocalFileID(s *string) *OrganizationUpdateOne { + if s != nil { + ouo.SetAvatarLocalFileID(*s) + } + return ouo +} + +// ClearAvatarLocalFileID clears the value of the "avatar_local_file_id" field. +func (ouo *OrganizationUpdateOne) ClearAvatarLocalFileID() *OrganizationUpdateOne { + ouo.mutation.ClearAvatarLocalFileID() + return ouo +} + +// SetAvatarUpdatedAt sets the "avatar_updated_at" field. +func (ouo *OrganizationUpdateOne) SetAvatarUpdatedAt(t time.Time) *OrganizationUpdateOne { + ouo.mutation.SetAvatarUpdatedAt(t) + return ouo +} + +// ClearAvatarUpdatedAt clears the value of the "avatar_updated_at" field. +func (ouo *OrganizationUpdateOne) ClearAvatarUpdatedAt() *OrganizationUpdateOne { + ouo.mutation.ClearAvatarUpdatedAt() + return ouo +} + // SetDedicatedDb sets the "dedicated_db" field. func (ouo *OrganizationUpdateOne) SetDedicatedDb(b bool) *OrganizationUpdateOne { ouo.mutation.SetDedicatedDb(b) @@ -4127,6 +4260,25 @@ func (ouo *OrganizationUpdateOne) AddFiles(f ...*File) *OrganizationUpdateOne { return ouo.AddFileIDs(ids...) } +// SetAvatarFileID sets the "avatar_file" edge to the File entity by ID. +func (ouo *OrganizationUpdateOne) SetAvatarFileID(id string) *OrganizationUpdateOne { + ouo.mutation.SetAvatarFileID(id) + return ouo +} + +// SetNillableAvatarFileID sets the "avatar_file" edge to the File entity by ID if the given value is not nil. +func (ouo *OrganizationUpdateOne) SetNillableAvatarFileID(id *string) *OrganizationUpdateOne { + if id != nil { + ouo = ouo.SetAvatarFileID(*id) + } + return ouo +} + +// SetAvatarFile sets the "avatar_file" edge to the File entity. +func (ouo *OrganizationUpdateOne) SetAvatarFile(f *File) *OrganizationUpdateOne { + return ouo.SetAvatarFileID(f.ID) +} + // AddEntityIDs adds the "entities" edge to the Entity entity by IDs. func (ouo *OrganizationUpdateOne) AddEntityIDs(ids ...string) *OrganizationUpdateOne { ouo.mutation.AddEntityIDs(ids...) @@ -4831,6 +4983,12 @@ func (ouo *OrganizationUpdateOne) RemoveFiles(f ...*File) *OrganizationUpdateOne return ouo.RemoveFileIDs(ids...) } +// ClearAvatarFile clears the "avatar_file" edge to the File entity. +func (ouo *OrganizationUpdateOne) ClearAvatarFile() *OrganizationUpdateOne { + ouo.mutation.ClearAvatarFile() + return ouo +} + // ClearEntities clears all "entities" edges to the Entity entity. func (ouo *OrganizationUpdateOne) ClearEntities() *OrganizationUpdateOne { ouo.mutation.ClearEntities() @@ -5177,6 +5335,13 @@ func (ouo *OrganizationUpdateOne) defaults() error { v := organization.UpdateDefaultUpdatedAt() ouo.mutation.SetUpdatedAt(v) } + if _, ok := ouo.mutation.AvatarUpdatedAt(); !ok && !ouo.mutation.AvatarUpdatedAtCleared() { + if organization.UpdateDefaultAvatarUpdatedAt == nil { + return fmt.Errorf("generated: uninitialized organization.UpdateDefaultAvatarUpdatedAt (forgotten import generated/runtime?)") + } + v := organization.UpdateDefaultAvatarUpdatedAt() + ouo.mutation.SetAvatarUpdatedAt(v) + } return nil } @@ -5297,6 +5462,12 @@ func (ouo *OrganizationUpdateOne) sqlSave(ctx context.Context) (_node *Organizat if ouo.mutation.AvatarRemoteURLCleared() { _spec.ClearField(organization.FieldAvatarRemoteURL, field.TypeString) } + if value, ok := ouo.mutation.AvatarUpdatedAt(); ok { + _spec.SetField(organization.FieldAvatarUpdatedAt, field.TypeTime, value) + } + if ouo.mutation.AvatarUpdatedAtCleared() { + _spec.ClearField(organization.FieldAvatarUpdatedAt, field.TypeTime) + } if value, ok := ouo.mutation.DedicatedDb(); ok { _spec.SetField(organization.FieldDedicatedDb, field.TypeBool, value) } @@ -6456,6 +6627,37 @@ func (ouo *OrganizationUpdateOne) sqlSave(ctx context.Context) (_node *Organizat } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if ouo.mutation.AvatarFileCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: organization.AvatarFileTable, + Columns: []string{organization.AvatarFileColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(file.FieldID, field.TypeString), + }, + } + edge.Schema = ouo.schemaConfig.Organization + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := ouo.mutation.AvatarFileIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: organization.AvatarFileTable, + Columns: []string{organization.AvatarFileColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(file.FieldID, field.TypeString), + }, + } + edge.Schema = ouo.schemaConfig.Organization + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } if ouo.mutation.EntitiesCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, diff --git a/internal/ent/generated/organizationhistory.go b/internal/ent/generated/organizationhistory.go index 79ab1b2a..d8ecfc78 100644 --- a/internal/ent/generated/organizationhistory.go +++ b/internal/ent/generated/organizationhistory.go @@ -53,6 +53,10 @@ type OrganizationHistory struct { PersonalOrg bool `json:"personal_org,omitempty"` // URL of the user's remote avatar AvatarRemoteURL *string `json:"avatar_remote_url,omitempty"` + // The organizations's local avatar file id, takes precedence over the avatar remote URL + AvatarLocalFileID *string `json:"avatar_local_file_id,omitempty"` + // The time the user's (local) avatar was last updated + AvatarUpdatedAt *time.Time `json:"avatar_updated_at,omitempty"` // Whether the organization has a dedicated database DedicatedDb bool `json:"dedicated_db,omitempty"` selectValues sql.SelectValues @@ -69,9 +73,9 @@ func (*OrganizationHistory) scanValues(columns []string) ([]any, error) { values[i] = new(history.OpType) case organizationhistory.FieldPersonalOrg, organizationhistory.FieldDedicatedDb: values[i] = new(sql.NullBool) - case organizationhistory.FieldID, organizationhistory.FieldRef, organizationhistory.FieldCreatedBy, organizationhistory.FieldUpdatedBy, organizationhistory.FieldMappingID, organizationhistory.FieldDeletedBy, organizationhistory.FieldName, organizationhistory.FieldDisplayName, organizationhistory.FieldDescription, organizationhistory.FieldParentOrganizationID, organizationhistory.FieldAvatarRemoteURL: + case organizationhistory.FieldID, organizationhistory.FieldRef, organizationhistory.FieldCreatedBy, organizationhistory.FieldUpdatedBy, organizationhistory.FieldMappingID, organizationhistory.FieldDeletedBy, organizationhistory.FieldName, organizationhistory.FieldDisplayName, organizationhistory.FieldDescription, organizationhistory.FieldParentOrganizationID, organizationhistory.FieldAvatarRemoteURL, organizationhistory.FieldAvatarLocalFileID: values[i] = new(sql.NullString) - case organizationhistory.FieldHistoryTime, organizationhistory.FieldCreatedAt, organizationhistory.FieldUpdatedAt, organizationhistory.FieldDeletedAt: + case organizationhistory.FieldHistoryTime, organizationhistory.FieldCreatedAt, organizationhistory.FieldUpdatedAt, organizationhistory.FieldDeletedAt, organizationhistory.FieldAvatarUpdatedAt: values[i] = new(sql.NullTime) default: values[i] = new(sql.UnknownType) @@ -199,6 +203,20 @@ func (oh *OrganizationHistory) assignValues(columns []string, values []any) erro oh.AvatarRemoteURL = new(string) *oh.AvatarRemoteURL = value.String } + case organizationhistory.FieldAvatarLocalFileID: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field avatar_local_file_id", values[i]) + } else if value.Valid { + oh.AvatarLocalFileID = new(string) + *oh.AvatarLocalFileID = value.String + } + case organizationhistory.FieldAvatarUpdatedAt: + if value, ok := values[i].(*sql.NullTime); !ok { + return fmt.Errorf("unexpected type %T for field avatar_updated_at", values[i]) + } else if value.Valid { + oh.AvatarUpdatedAt = new(time.Time) + *oh.AvatarUpdatedAt = value.Time + } case organizationhistory.FieldDedicatedDb: if value, ok := values[i].(*sql.NullBool); !ok { return fmt.Errorf("unexpected type %T for field dedicated_db", values[i]) @@ -294,6 +312,16 @@ func (oh *OrganizationHistory) String() string { builder.WriteString(*v) } builder.WriteString(", ") + if v := oh.AvatarLocalFileID; v != nil { + builder.WriteString("avatar_local_file_id=") + builder.WriteString(*v) + } + builder.WriteString(", ") + if v := oh.AvatarUpdatedAt; v != nil { + builder.WriteString("avatar_updated_at=") + builder.WriteString(v.Format(time.ANSIC)) + } + builder.WriteString(", ") builder.WriteString("dedicated_db=") builder.WriteString(fmt.Sprintf("%v", oh.DedicatedDb)) builder.WriteByte(')') diff --git a/internal/ent/generated/organizationhistory/organizationhistory.go b/internal/ent/generated/organizationhistory/organizationhistory.go index 2f82098c..a48fbe68 100644 --- a/internal/ent/generated/organizationhistory/organizationhistory.go +++ b/internal/ent/generated/organizationhistory/organizationhistory.go @@ -51,6 +51,10 @@ const ( FieldPersonalOrg = "personal_org" // FieldAvatarRemoteURL holds the string denoting the avatar_remote_url field in the database. FieldAvatarRemoteURL = "avatar_remote_url" + // FieldAvatarLocalFileID holds the string denoting the avatar_local_file_id field in the database. + FieldAvatarLocalFileID = "avatar_local_file_id" + // FieldAvatarUpdatedAt holds the string denoting the avatar_updated_at field in the database. + FieldAvatarUpdatedAt = "avatar_updated_at" // FieldDedicatedDb holds the string denoting the dedicated_db field in the database. FieldDedicatedDb = "dedicated_db" // Table holds the table name of the organizationhistory in the database. @@ -77,6 +81,8 @@ var Columns = []string{ FieldParentOrganizationID, FieldPersonalOrg, FieldAvatarRemoteURL, + FieldAvatarLocalFileID, + FieldAvatarUpdatedAt, FieldDedicatedDb, } @@ -113,6 +119,10 @@ var ( DefaultDisplayName string // DefaultPersonalOrg holds the default value on creation for the "personal_org" field. DefaultPersonalOrg bool + // DefaultAvatarUpdatedAt holds the default value on creation for the "avatar_updated_at" field. + DefaultAvatarUpdatedAt func() time.Time + // UpdateDefaultAvatarUpdatedAt holds the default value on update for the "avatar_updated_at" field. + UpdateDefaultAvatarUpdatedAt func() time.Time // DefaultDedicatedDb holds the default value on creation for the "dedicated_db" field. DefaultDedicatedDb bool // DefaultID holds the default value on creation for the "id" field. @@ -217,6 +227,16 @@ func ByAvatarRemoteURL(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldAvatarRemoteURL, opts...).ToFunc() } +// ByAvatarLocalFileID orders the results by the avatar_local_file_id field. +func ByAvatarLocalFileID(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldAvatarLocalFileID, opts...).ToFunc() +} + +// ByAvatarUpdatedAt orders the results by the avatar_updated_at field. +func ByAvatarUpdatedAt(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldAvatarUpdatedAt, opts...).ToFunc() +} + // ByDedicatedDb orders the results by the dedicated_db field. func ByDedicatedDb(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDedicatedDb, opts...).ToFunc() diff --git a/internal/ent/generated/organizationhistory/where.go b/internal/ent/generated/organizationhistory/where.go index 414e2c0d..dac5f049 100644 --- a/internal/ent/generated/organizationhistory/where.go +++ b/internal/ent/generated/organizationhistory/where.go @@ -140,6 +140,16 @@ func AvatarRemoteURL(v string) predicate.OrganizationHistory { return predicate.OrganizationHistory(sql.FieldEQ(FieldAvatarRemoteURL, v)) } +// AvatarLocalFileID applies equality check predicate on the "avatar_local_file_id" field. It's identical to AvatarLocalFileIDEQ. +func AvatarLocalFileID(v string) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldEQ(FieldAvatarLocalFileID, v)) +} + +// AvatarUpdatedAt applies equality check predicate on the "avatar_updated_at" field. It's identical to AvatarUpdatedAtEQ. +func AvatarUpdatedAt(v time.Time) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldEQ(FieldAvatarUpdatedAt, v)) +} + // DedicatedDb applies equality check predicate on the "dedicated_db" field. It's identical to DedicatedDbEQ. func DedicatedDb(v bool) predicate.OrganizationHistory { return predicate.OrganizationHistory(sql.FieldEQ(FieldDedicatedDb, v)) @@ -1105,6 +1115,131 @@ func AvatarRemoteURLContainsFold(v string) predicate.OrganizationHistory { return predicate.OrganizationHistory(sql.FieldContainsFold(FieldAvatarRemoteURL, v)) } +// AvatarLocalFileIDEQ applies the EQ predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDEQ(v string) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldEQ(FieldAvatarLocalFileID, v)) +} + +// AvatarLocalFileIDNEQ applies the NEQ predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDNEQ(v string) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldNEQ(FieldAvatarLocalFileID, v)) +} + +// AvatarLocalFileIDIn applies the In predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDIn(vs ...string) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldIn(FieldAvatarLocalFileID, vs...)) +} + +// AvatarLocalFileIDNotIn applies the NotIn predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDNotIn(vs ...string) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldNotIn(FieldAvatarLocalFileID, vs...)) +} + +// AvatarLocalFileIDGT applies the GT predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDGT(v string) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldGT(FieldAvatarLocalFileID, v)) +} + +// AvatarLocalFileIDGTE applies the GTE predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDGTE(v string) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldGTE(FieldAvatarLocalFileID, v)) +} + +// AvatarLocalFileIDLT applies the LT predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDLT(v string) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldLT(FieldAvatarLocalFileID, v)) +} + +// AvatarLocalFileIDLTE applies the LTE predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDLTE(v string) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldLTE(FieldAvatarLocalFileID, v)) +} + +// AvatarLocalFileIDContains applies the Contains predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDContains(v string) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldContains(FieldAvatarLocalFileID, v)) +} + +// AvatarLocalFileIDHasPrefix applies the HasPrefix predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDHasPrefix(v string) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldHasPrefix(FieldAvatarLocalFileID, v)) +} + +// AvatarLocalFileIDHasSuffix applies the HasSuffix predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDHasSuffix(v string) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldHasSuffix(FieldAvatarLocalFileID, v)) +} + +// AvatarLocalFileIDIsNil applies the IsNil predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDIsNil() predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldIsNull(FieldAvatarLocalFileID)) +} + +// AvatarLocalFileIDNotNil applies the NotNil predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDNotNil() predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldNotNull(FieldAvatarLocalFileID)) +} + +// AvatarLocalFileIDEqualFold applies the EqualFold predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDEqualFold(v string) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldEqualFold(FieldAvatarLocalFileID, v)) +} + +// AvatarLocalFileIDContainsFold applies the ContainsFold predicate on the "avatar_local_file_id" field. +func AvatarLocalFileIDContainsFold(v string) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldContainsFold(FieldAvatarLocalFileID, v)) +} + +// AvatarUpdatedAtEQ applies the EQ predicate on the "avatar_updated_at" field. +func AvatarUpdatedAtEQ(v time.Time) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldEQ(FieldAvatarUpdatedAt, v)) +} + +// AvatarUpdatedAtNEQ applies the NEQ predicate on the "avatar_updated_at" field. +func AvatarUpdatedAtNEQ(v time.Time) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldNEQ(FieldAvatarUpdatedAt, v)) +} + +// AvatarUpdatedAtIn applies the In predicate on the "avatar_updated_at" field. +func AvatarUpdatedAtIn(vs ...time.Time) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldIn(FieldAvatarUpdatedAt, vs...)) +} + +// AvatarUpdatedAtNotIn applies the NotIn predicate on the "avatar_updated_at" field. +func AvatarUpdatedAtNotIn(vs ...time.Time) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldNotIn(FieldAvatarUpdatedAt, vs...)) +} + +// AvatarUpdatedAtGT applies the GT predicate on the "avatar_updated_at" field. +func AvatarUpdatedAtGT(v time.Time) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldGT(FieldAvatarUpdatedAt, v)) +} + +// AvatarUpdatedAtGTE applies the GTE predicate on the "avatar_updated_at" field. +func AvatarUpdatedAtGTE(v time.Time) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldGTE(FieldAvatarUpdatedAt, v)) +} + +// AvatarUpdatedAtLT applies the LT predicate on the "avatar_updated_at" field. +func AvatarUpdatedAtLT(v time.Time) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldLT(FieldAvatarUpdatedAt, v)) +} + +// AvatarUpdatedAtLTE applies the LTE predicate on the "avatar_updated_at" field. +func AvatarUpdatedAtLTE(v time.Time) predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldLTE(FieldAvatarUpdatedAt, v)) +} + +// AvatarUpdatedAtIsNil applies the IsNil predicate on the "avatar_updated_at" field. +func AvatarUpdatedAtIsNil() predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldIsNull(FieldAvatarUpdatedAt)) +} + +// AvatarUpdatedAtNotNil applies the NotNil predicate on the "avatar_updated_at" field. +func AvatarUpdatedAtNotNil() predicate.OrganizationHistory { + return predicate.OrganizationHistory(sql.FieldNotNull(FieldAvatarUpdatedAt)) +} + // DedicatedDbEQ applies the EQ predicate on the "dedicated_db" field. func DedicatedDbEQ(v bool) predicate.OrganizationHistory { return predicate.OrganizationHistory(sql.FieldEQ(FieldDedicatedDb, v)) diff --git a/internal/ent/generated/organizationhistory_create.go b/internal/ent/generated/organizationhistory_create.go index a3f9e480..ee6d234d 100644 --- a/internal/ent/generated/organizationhistory_create.go +++ b/internal/ent/generated/organizationhistory_create.go @@ -235,6 +235,34 @@ func (ohc *OrganizationHistoryCreate) SetNillableAvatarRemoteURL(s *string) *Org return ohc } +// SetAvatarLocalFileID sets the "avatar_local_file_id" field. +func (ohc *OrganizationHistoryCreate) SetAvatarLocalFileID(s string) *OrganizationHistoryCreate { + ohc.mutation.SetAvatarLocalFileID(s) + return ohc +} + +// SetNillableAvatarLocalFileID sets the "avatar_local_file_id" field if the given value is not nil. +func (ohc *OrganizationHistoryCreate) SetNillableAvatarLocalFileID(s *string) *OrganizationHistoryCreate { + if s != nil { + ohc.SetAvatarLocalFileID(*s) + } + return ohc +} + +// SetAvatarUpdatedAt sets the "avatar_updated_at" field. +func (ohc *OrganizationHistoryCreate) SetAvatarUpdatedAt(t time.Time) *OrganizationHistoryCreate { + ohc.mutation.SetAvatarUpdatedAt(t) + return ohc +} + +// SetNillableAvatarUpdatedAt sets the "avatar_updated_at" field if the given value is not nil. +func (ohc *OrganizationHistoryCreate) SetNillableAvatarUpdatedAt(t *time.Time) *OrganizationHistoryCreate { + if t != nil { + ohc.SetAvatarUpdatedAt(*t) + } + return ohc +} + // SetDedicatedDb sets the "dedicated_db" field. func (ohc *OrganizationHistoryCreate) SetDedicatedDb(b bool) *OrganizationHistoryCreate { ohc.mutation.SetDedicatedDb(b) @@ -326,6 +354,10 @@ func (ohc *OrganizationHistoryCreate) defaults() { v := organizationhistory.DefaultPersonalOrg ohc.mutation.SetPersonalOrg(v) } + if _, ok := ohc.mutation.AvatarUpdatedAt(); !ok { + v := organizationhistory.DefaultAvatarUpdatedAt() + ohc.mutation.SetAvatarUpdatedAt(v) + } if _, ok := ohc.mutation.DedicatedDb(); !ok { v := organizationhistory.DefaultDedicatedDb ohc.mutation.SetDedicatedDb(v) @@ -465,6 +497,14 @@ func (ohc *OrganizationHistoryCreate) createSpec() (*OrganizationHistory, *sqlgr _spec.SetField(organizationhistory.FieldAvatarRemoteURL, field.TypeString, value) _node.AvatarRemoteURL = &value } + if value, ok := ohc.mutation.AvatarLocalFileID(); ok { + _spec.SetField(organizationhistory.FieldAvatarLocalFileID, field.TypeString, value) + _node.AvatarLocalFileID = &value + } + if value, ok := ohc.mutation.AvatarUpdatedAt(); ok { + _spec.SetField(organizationhistory.FieldAvatarUpdatedAt, field.TypeTime, value) + _node.AvatarUpdatedAt = &value + } if value, ok := ohc.mutation.DedicatedDb(); ok { _spec.SetField(organizationhistory.FieldDedicatedDb, field.TypeBool, value) _node.DedicatedDb = value diff --git a/internal/ent/generated/organizationhistory_update.go b/internal/ent/generated/organizationhistory_update.go index c50b9ca3..40ed0d2b 100644 --- a/internal/ent/generated/organizationhistory_update.go +++ b/internal/ent/generated/organizationhistory_update.go @@ -190,6 +190,38 @@ func (ohu *OrganizationHistoryUpdate) ClearAvatarRemoteURL() *OrganizationHistor return ohu } +// SetAvatarLocalFileID sets the "avatar_local_file_id" field. +func (ohu *OrganizationHistoryUpdate) SetAvatarLocalFileID(s string) *OrganizationHistoryUpdate { + ohu.mutation.SetAvatarLocalFileID(s) + return ohu +} + +// SetNillableAvatarLocalFileID sets the "avatar_local_file_id" field if the given value is not nil. +func (ohu *OrganizationHistoryUpdate) SetNillableAvatarLocalFileID(s *string) *OrganizationHistoryUpdate { + if s != nil { + ohu.SetAvatarLocalFileID(*s) + } + return ohu +} + +// ClearAvatarLocalFileID clears the value of the "avatar_local_file_id" field. +func (ohu *OrganizationHistoryUpdate) ClearAvatarLocalFileID() *OrganizationHistoryUpdate { + ohu.mutation.ClearAvatarLocalFileID() + return ohu +} + +// SetAvatarUpdatedAt sets the "avatar_updated_at" field. +func (ohu *OrganizationHistoryUpdate) SetAvatarUpdatedAt(t time.Time) *OrganizationHistoryUpdate { + ohu.mutation.SetAvatarUpdatedAt(t) + return ohu +} + +// ClearAvatarUpdatedAt clears the value of the "avatar_updated_at" field. +func (ohu *OrganizationHistoryUpdate) ClearAvatarUpdatedAt() *OrganizationHistoryUpdate { + ohu.mutation.ClearAvatarUpdatedAt() + return ohu +} + // SetDedicatedDb sets the "dedicated_db" field. func (ohu *OrganizationHistoryUpdate) SetDedicatedDb(b bool) *OrganizationHistoryUpdate { ohu.mutation.SetDedicatedDb(b) @@ -243,6 +275,10 @@ func (ohu *OrganizationHistoryUpdate) defaults() { v := organizationhistory.UpdateDefaultUpdatedAt() ohu.mutation.SetUpdatedAt(v) } + if _, ok := ohu.mutation.AvatarUpdatedAt(); !ok && !ohu.mutation.AvatarUpdatedAtCleared() { + v := organizationhistory.UpdateDefaultAvatarUpdatedAt() + ohu.mutation.SetAvatarUpdatedAt(v) + } } // Modify adds a statement modifier for attaching custom logic to the UPDATE statement. @@ -328,6 +364,18 @@ func (ohu *OrganizationHistoryUpdate) sqlSave(ctx context.Context) (n int, err e if ohu.mutation.AvatarRemoteURLCleared() { _spec.ClearField(organizationhistory.FieldAvatarRemoteURL, field.TypeString) } + if value, ok := ohu.mutation.AvatarLocalFileID(); ok { + _spec.SetField(organizationhistory.FieldAvatarLocalFileID, field.TypeString, value) + } + if ohu.mutation.AvatarLocalFileIDCleared() { + _spec.ClearField(organizationhistory.FieldAvatarLocalFileID, field.TypeString) + } + if value, ok := ohu.mutation.AvatarUpdatedAt(); ok { + _spec.SetField(organizationhistory.FieldAvatarUpdatedAt, field.TypeTime, value) + } + if ohu.mutation.AvatarUpdatedAtCleared() { + _spec.ClearField(organizationhistory.FieldAvatarUpdatedAt, field.TypeTime) + } if value, ok := ohu.mutation.DedicatedDb(); ok { _spec.SetField(organizationhistory.FieldDedicatedDb, field.TypeBool, value) } @@ -513,6 +561,38 @@ func (ohuo *OrganizationHistoryUpdateOne) ClearAvatarRemoteURL() *OrganizationHi return ohuo } +// SetAvatarLocalFileID sets the "avatar_local_file_id" field. +func (ohuo *OrganizationHistoryUpdateOne) SetAvatarLocalFileID(s string) *OrganizationHistoryUpdateOne { + ohuo.mutation.SetAvatarLocalFileID(s) + return ohuo +} + +// SetNillableAvatarLocalFileID sets the "avatar_local_file_id" field if the given value is not nil. +func (ohuo *OrganizationHistoryUpdateOne) SetNillableAvatarLocalFileID(s *string) *OrganizationHistoryUpdateOne { + if s != nil { + ohuo.SetAvatarLocalFileID(*s) + } + return ohuo +} + +// ClearAvatarLocalFileID clears the value of the "avatar_local_file_id" field. +func (ohuo *OrganizationHistoryUpdateOne) ClearAvatarLocalFileID() *OrganizationHistoryUpdateOne { + ohuo.mutation.ClearAvatarLocalFileID() + return ohuo +} + +// SetAvatarUpdatedAt sets the "avatar_updated_at" field. +func (ohuo *OrganizationHistoryUpdateOne) SetAvatarUpdatedAt(t time.Time) *OrganizationHistoryUpdateOne { + ohuo.mutation.SetAvatarUpdatedAt(t) + return ohuo +} + +// ClearAvatarUpdatedAt clears the value of the "avatar_updated_at" field. +func (ohuo *OrganizationHistoryUpdateOne) ClearAvatarUpdatedAt() *OrganizationHistoryUpdateOne { + ohuo.mutation.ClearAvatarUpdatedAt() + return ohuo +} + // SetDedicatedDb sets the "dedicated_db" field. func (ohuo *OrganizationHistoryUpdateOne) SetDedicatedDb(b bool) *OrganizationHistoryUpdateOne { ohuo.mutation.SetDedicatedDb(b) @@ -579,6 +659,10 @@ func (ohuo *OrganizationHistoryUpdateOne) defaults() { v := organizationhistory.UpdateDefaultUpdatedAt() ohuo.mutation.SetUpdatedAt(v) } + if _, ok := ohuo.mutation.AvatarUpdatedAt(); !ok && !ohuo.mutation.AvatarUpdatedAtCleared() { + v := organizationhistory.UpdateDefaultAvatarUpdatedAt() + ohuo.mutation.SetAvatarUpdatedAt(v) + } } // Modify adds a statement modifier for attaching custom logic to the UPDATE statement. @@ -681,6 +765,18 @@ func (ohuo *OrganizationHistoryUpdateOne) sqlSave(ctx context.Context) (_node *O if ohuo.mutation.AvatarRemoteURLCleared() { _spec.ClearField(organizationhistory.FieldAvatarRemoteURL, field.TypeString) } + if value, ok := ohuo.mutation.AvatarLocalFileID(); ok { + _spec.SetField(organizationhistory.FieldAvatarLocalFileID, field.TypeString, value) + } + if ohuo.mutation.AvatarLocalFileIDCleared() { + _spec.ClearField(organizationhistory.FieldAvatarLocalFileID, field.TypeString) + } + if value, ok := ohuo.mutation.AvatarUpdatedAt(); ok { + _spec.SetField(organizationhistory.FieldAvatarUpdatedAt, field.TypeTime, value) + } + if ohuo.mutation.AvatarUpdatedAtCleared() { + _spec.ClearField(organizationhistory.FieldAvatarUpdatedAt, field.TypeTime) + } if value, ok := ohuo.mutation.DedicatedDb(); ok { _spec.SetField(organizationhistory.FieldDedicatedDb, field.TypeBool, value) } diff --git a/internal/ent/generated/runtime/runtime.go b/internal/ent/generated/runtime/runtime.go index d7cd021d..e83b0531 100644 --- a/internal/ent/generated/runtime/runtime.go +++ b/internal/ent/generated/runtime/runtime.go @@ -1039,8 +1039,10 @@ func init() { file.Hooks[2] = fileMixinHooks1[0] fileMixinInters1 := fileMixin[1].Interceptors() fileMixinInters4 := fileMixin[4].Interceptors() + fileInters := schema.File{}.Interceptors() file.Interceptors[0] = fileMixinInters1[0] file.Interceptors[1] = fileMixinInters4[0] + file.Interceptors[2] = fileInters[0] fileMixinFields0 := fileMixin[0].Fields() _ = fileMixinFields0 fileMixinFields2 := fileMixin[2].Fields() @@ -2211,8 +2213,14 @@ func init() { return nil } }() + // organizationDescAvatarUpdatedAt is the schema descriptor for avatar_updated_at field. + organizationDescAvatarUpdatedAt := organizationFields[7].Descriptor() + // organization.DefaultAvatarUpdatedAt holds the default value on creation for the avatar_updated_at field. + organization.DefaultAvatarUpdatedAt = organizationDescAvatarUpdatedAt.Default.(func() time.Time) + // organization.UpdateDefaultAvatarUpdatedAt holds the default value on update for the avatar_updated_at field. + organization.UpdateDefaultAvatarUpdatedAt = organizationDescAvatarUpdatedAt.UpdateDefault.(func() time.Time) // organizationDescDedicatedDb is the schema descriptor for dedicated_db field. - organizationDescDedicatedDb := organizationFields[6].Descriptor() + organizationDescDedicatedDb := organizationFields[8].Descriptor() // organization.DefaultDedicatedDb holds the default value on creation for the dedicated_db field. organization.DefaultDedicatedDb = organizationDescDedicatedDb.Default.(bool) // organizationDescID is the schema descriptor for id field. @@ -2253,8 +2261,14 @@ func init() { organizationhistoryDescPersonalOrg := organizationhistoryFields[16].Descriptor() // organizationhistory.DefaultPersonalOrg holds the default value on creation for the personal_org field. organizationhistory.DefaultPersonalOrg = organizationhistoryDescPersonalOrg.Default.(bool) + // organizationhistoryDescAvatarUpdatedAt is the schema descriptor for avatar_updated_at field. + organizationhistoryDescAvatarUpdatedAt := organizationhistoryFields[19].Descriptor() + // organizationhistory.DefaultAvatarUpdatedAt holds the default value on creation for the avatar_updated_at field. + organizationhistory.DefaultAvatarUpdatedAt = organizationhistoryDescAvatarUpdatedAt.Default.(func() time.Time) + // organizationhistory.UpdateDefaultAvatarUpdatedAt holds the default value on update for the avatar_updated_at field. + organizationhistory.UpdateDefaultAvatarUpdatedAt = organizationhistoryDescAvatarUpdatedAt.UpdateDefault.(func() time.Time) // organizationhistoryDescDedicatedDb is the schema descriptor for dedicated_db field. - organizationhistoryDescDedicatedDb := organizationhistoryFields[18].Descriptor() + organizationhistoryDescDedicatedDb := organizationhistoryFields[20].Descriptor() // organizationhistory.DefaultDedicatedDb holds the default value on creation for the dedicated_db field. organizationhistory.DefaultDedicatedDb = organizationhistoryDescDedicatedDb.Default.(bool) // organizationhistoryDescID is the schema descriptor for id field. @@ -3515,16 +3529,14 @@ func init() { return nil } }() - // userDescAvatarLocalFile is the schema descriptor for avatar_local_file field. - userDescAvatarLocalFile := userFields[5].Descriptor() - // user.AvatarLocalFileValidator is a validator for the "avatar_local_file" field. It is called by the builders before save. - user.AvatarLocalFileValidator = userDescAvatarLocalFile.Validators[0].(func(string) error) // userDescAvatarUpdatedAt is the schema descriptor for avatar_updated_at field. - userDescAvatarUpdatedAt := userFields[7].Descriptor() + userDescAvatarUpdatedAt := userFields[6].Descriptor() + // user.DefaultAvatarUpdatedAt holds the default value on creation for the avatar_updated_at field. + user.DefaultAvatarUpdatedAt = userDescAvatarUpdatedAt.Default.(func() time.Time) // user.UpdateDefaultAvatarUpdatedAt holds the default value on update for the avatar_updated_at field. user.UpdateDefaultAvatarUpdatedAt = userDescAvatarUpdatedAt.UpdateDefault.(func() time.Time) // userDescLastSeen is the schema descriptor for last_seen field. - userDescLastSeen := userFields[8].Descriptor() + userDescLastSeen := userFields[7].Descriptor() // user.UpdateDefaultLastSeen holds the default value on update for the last_seen field. user.UpdateDefaultLastSeen = userDescLastSeen.UpdateDefault.(func() time.Time) // userDescID is the schema descriptor for id field. @@ -3558,11 +3570,13 @@ func init() { // userhistory.DefaultTags holds the default value on creation for the tags field. userhistory.DefaultTags = userhistoryDescTags.Default.([]string) // userhistoryDescAvatarUpdatedAt is the schema descriptor for avatar_updated_at field. - userhistoryDescAvatarUpdatedAt := userhistoryFields[19].Descriptor() + userhistoryDescAvatarUpdatedAt := userhistoryFields[18].Descriptor() + // userhistory.DefaultAvatarUpdatedAt holds the default value on creation for the avatar_updated_at field. + userhistory.DefaultAvatarUpdatedAt = userhistoryDescAvatarUpdatedAt.Default.(func() time.Time) // userhistory.UpdateDefaultAvatarUpdatedAt holds the default value on update for the avatar_updated_at field. userhistory.UpdateDefaultAvatarUpdatedAt = userhistoryDescAvatarUpdatedAt.UpdateDefault.(func() time.Time) // userhistoryDescLastSeen is the schema descriptor for last_seen field. - userhistoryDescLastSeen := userhistoryFields[20].Descriptor() + userhistoryDescLastSeen := userhistoryFields[19].Descriptor() // userhistory.UpdateDefaultLastSeen holds the default value on update for the last_seen field. userhistory.UpdateDefaultLastSeen = userhistoryDescLastSeen.UpdateDefault.(func() time.Time) // userhistoryDescID is the schema descriptor for id field. diff --git a/internal/ent/generated/user.go b/internal/ent/generated/user.go index 70814507..e048fe3a 100644 --- a/internal/ent/generated/user.go +++ b/internal/ent/generated/user.go @@ -47,9 +47,7 @@ type User struct { DisplayName string `json:"display_name,omitempty"` // URL of the user's remote avatar AvatarRemoteURL *string `json:"avatar_remote_url,omitempty"` - // The user's local avatar file - AvatarLocalFile *string `json:"avatar_local_file,omitempty"` - // The user's local avatar file id + // The user's local avatar file id, takes precedence over the avatar remote URL AvatarLocalFileID *string `json:"avatar_local_file_id,omitempty"` // The time the user's (local) avatar was last updated AvatarUpdatedAt *time.Time `json:"avatar_updated_at,omitempty"` @@ -89,8 +87,8 @@ type UserEdges struct { Webauthn []*Webauthn `json:"webauthn,omitempty"` // Files holds the value of the files edge. Files []*File `json:"files,omitempty"` - // File holds the value of the file edge. - File *File `json:"file,omitempty"` + // AvatarFile holds the value of the avatar_file edge. + AvatarFile *File `json:"avatar_file,omitempty"` // Events holds the value of the events edge. Events []*Event `json:"events,omitempty"` // ActionPlans holds the value of the action_plans edge. @@ -217,15 +215,15 @@ func (e UserEdges) FilesOrErr() ([]*File, error) { return nil, &NotLoadedError{edge: "files"} } -// FileOrErr returns the File value or an error if the edge +// AvatarFileOrErr returns the AvatarFile value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. -func (e UserEdges) FileOrErr() (*File, error) { - if e.File != nil { - return e.File, nil +func (e UserEdges) AvatarFileOrErr() (*File, error) { + if e.AvatarFile != nil { + return e.AvatarFile, nil } else if e.loadedTypes[9] { return nil, &NotFoundError{label: file.Label} } - return nil, &NotLoadedError{edge: "file"} + return nil, &NotLoadedError{edge: "avatar_file"} } // EventsOrErr returns the Events value or an error if the edge @@ -316,7 +314,7 @@ func (*User) scanValues(columns []string) ([]any, error) { switch columns[i] { case user.FieldTags: values[i] = new([]byte) - case user.FieldID, user.FieldCreatedBy, user.FieldUpdatedBy, user.FieldDeletedBy, user.FieldMappingID, user.FieldEmail, user.FieldFirstName, user.FieldLastName, user.FieldDisplayName, user.FieldAvatarRemoteURL, user.FieldAvatarLocalFile, user.FieldAvatarLocalFileID, user.FieldPassword, user.FieldSub, user.FieldAuthProvider, user.FieldRole: + case user.FieldID, user.FieldCreatedBy, user.FieldUpdatedBy, user.FieldDeletedBy, user.FieldMappingID, user.FieldEmail, user.FieldFirstName, user.FieldLastName, user.FieldDisplayName, user.FieldAvatarRemoteURL, user.FieldAvatarLocalFileID, user.FieldPassword, user.FieldSub, user.FieldAuthProvider, user.FieldRole: values[i] = new(sql.NullString) case user.FieldCreatedAt, user.FieldUpdatedAt, user.FieldDeletedAt, user.FieldAvatarUpdatedAt, user.FieldLastSeen: values[i] = new(sql.NullTime) @@ -422,13 +420,6 @@ func (u *User) assignValues(columns []string, values []any) error { u.AvatarRemoteURL = new(string) *u.AvatarRemoteURL = value.String } - case user.FieldAvatarLocalFile: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field avatar_local_file", values[i]) - } else if value.Valid { - u.AvatarLocalFile = new(string) - *u.AvatarLocalFile = value.String - } case user.FieldAvatarLocalFileID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field avatar_local_file_id", values[i]) @@ -533,9 +524,9 @@ func (u *User) QueryFiles() *FileQuery { return NewUserClient(u.config).QueryFiles(u) } -// QueryFile queries the "file" edge of the User entity. -func (u *User) QueryFile() *FileQuery { - return NewUserClient(u.config).QueryFile(u) +// QueryAvatarFile queries the "avatar_file" edge of the User entity. +func (u *User) QueryAvatarFile() *FileQuery { + return NewUserClient(u.config).QueryAvatarFile(u) } // QueryEvents queries the "events" edge of the User entity. @@ -647,11 +638,6 @@ func (u *User) String() string { builder.WriteString(*v) } builder.WriteString(", ") - if v := u.AvatarLocalFile; v != nil { - builder.WriteString("avatar_local_file=") - builder.WriteString(*v) - } - builder.WriteString(", ") if v := u.AvatarLocalFileID; v != nil { builder.WriteString("avatar_local_file_id=") builder.WriteString(*v) diff --git a/internal/ent/generated/user/user.go b/internal/ent/generated/user/user.go index 809c1276..12d369bd 100644 --- a/internal/ent/generated/user/user.go +++ b/internal/ent/generated/user/user.go @@ -44,8 +44,6 @@ const ( FieldDisplayName = "display_name" // FieldAvatarRemoteURL holds the string denoting the avatar_remote_url field in the database. FieldAvatarRemoteURL = "avatar_remote_url" - // FieldAvatarLocalFile holds the string denoting the avatar_local_file field in the database. - FieldAvatarLocalFile = "avatar_local_file" // FieldAvatarLocalFileID holds the string denoting the avatar_local_file_id field in the database. FieldAvatarLocalFileID = "avatar_local_file_id" // FieldAvatarUpdatedAt holds the string denoting the avatar_updated_at field in the database. @@ -78,8 +76,8 @@ const ( EdgeWebauthn = "webauthn" // EdgeFiles holds the string denoting the files edge name in mutations. EdgeFiles = "files" - // EdgeFile holds the string denoting the file edge name in mutations. - EdgeFile = "file" + // EdgeAvatarFile holds the string denoting the avatar_file edge name in mutations. + EdgeAvatarFile = "avatar_file" // EdgeEvents holds the string denoting the events edge name in mutations. EdgeEvents = "events" // EdgeActionPlans holds the string denoting the action_plans edge name in mutations. @@ -157,13 +155,13 @@ const ( // FilesInverseTable is the table name for the File entity. // It exists in this package in order to avoid circular dependency with the "file" package. FilesInverseTable = "files" - // FileTable is the table that holds the file relation/edge. - FileTable = "users" - // FileInverseTable is the table name for the File entity. + // AvatarFileTable is the table that holds the avatar_file relation/edge. + AvatarFileTable = "users" + // AvatarFileInverseTable is the table name for the File entity. // It exists in this package in order to avoid circular dependency with the "file" package. - FileInverseTable = "files" - // FileColumn is the table column denoting the file relation/edge. - FileColumn = "avatar_local_file_id" + AvatarFileInverseTable = "files" + // AvatarFileColumn is the table column denoting the avatar_file relation/edge. + AvatarFileColumn = "avatar_local_file_id" // EventsTable is the table that holds the events relation/edge. The primary key declared below. EventsTable = "user_events" // EventsInverseTable is the table name for the Event entity. @@ -237,7 +235,6 @@ var Columns = []string{ FieldLastName, FieldDisplayName, FieldAvatarRemoteURL, - FieldAvatarLocalFile, FieldAvatarLocalFileID, FieldAvatarUpdatedAt, FieldLastSeen, @@ -310,8 +307,8 @@ var ( DisplayNameValidator func(string) error // AvatarRemoteURLValidator is a validator for the "avatar_remote_url" field. It is called by the builders before save. AvatarRemoteURLValidator func(string) error - // AvatarLocalFileValidator is a validator for the "avatar_local_file" field. It is called by the builders before save. - AvatarLocalFileValidator func(string) error + // DefaultAvatarUpdatedAt holds the default value on creation for the "avatar_updated_at" field. + DefaultAvatarUpdatedAt func() time.Time // UpdateDefaultAvatarUpdatedAt holds the default value on update for the "avatar_updated_at" field. UpdateDefaultAvatarUpdatedAt func() time.Time // UpdateDefaultLastSeen holds the default value on update for the "last_seen" field. @@ -412,11 +409,6 @@ func ByAvatarRemoteURL(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldAvatarRemoteURL, opts...).ToFunc() } -// ByAvatarLocalFile orders the results by the avatar_local_file field. -func ByAvatarLocalFile(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldAvatarLocalFile, opts...).ToFunc() -} - // ByAvatarLocalFileID orders the results by the avatar_local_file_id field. func ByAvatarLocalFileID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldAvatarLocalFileID, opts...).ToFunc() @@ -571,10 +563,10 @@ func ByFiles(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { } } -// ByFileField orders the results by file field. -func ByFileField(field string, opts ...sql.OrderTermOption) OrderOption { +// ByAvatarFileField orders the results by avatar_file field. +func ByAvatarFileField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { - sqlgraph.OrderByNeighborTerms(s, newFileStep(), sql.OrderByField(field, opts...)) + sqlgraph.OrderByNeighborTerms(s, newAvatarFileStep(), sql.OrderByField(field, opts...)) } } @@ -766,11 +758,11 @@ func newFilesStep() *sqlgraph.Step { sqlgraph.Edge(sqlgraph.M2M, false, FilesTable, FilesPrimaryKey...), ) } -func newFileStep() *sqlgraph.Step { +func newAvatarFileStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), - sqlgraph.To(FileInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, FileTable, FileColumn), + sqlgraph.To(AvatarFileInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, AvatarFileTable, AvatarFileColumn), ) } func newEventsStep() *sqlgraph.Step { diff --git a/internal/ent/generated/user/where.go b/internal/ent/generated/user/where.go index 83670b3b..65003ea2 100644 --- a/internal/ent/generated/user/where.go +++ b/internal/ent/generated/user/where.go @@ -128,11 +128,6 @@ func AvatarRemoteURL(v string) predicate.User { return predicate.User(sql.FieldEQ(FieldAvatarRemoteURL, v)) } -// AvatarLocalFile applies equality check predicate on the "avatar_local_file" field. It's identical to AvatarLocalFileEQ. -func AvatarLocalFile(v string) predicate.User { - return predicate.User(sql.FieldEQ(FieldAvatarLocalFile, v)) -} - // AvatarLocalFileID applies equality check predicate on the "avatar_local_file_id" field. It's identical to AvatarLocalFileIDEQ. func AvatarLocalFileID(v string) predicate.User { return predicate.User(sql.FieldEQ(FieldAvatarLocalFileID, v)) @@ -963,81 +958,6 @@ func AvatarRemoteURLContainsFold(v string) predicate.User { return predicate.User(sql.FieldContainsFold(FieldAvatarRemoteURL, v)) } -// AvatarLocalFileEQ applies the EQ predicate on the "avatar_local_file" field. -func AvatarLocalFileEQ(v string) predicate.User { - return predicate.User(sql.FieldEQ(FieldAvatarLocalFile, v)) -} - -// AvatarLocalFileNEQ applies the NEQ predicate on the "avatar_local_file" field. -func AvatarLocalFileNEQ(v string) predicate.User { - return predicate.User(sql.FieldNEQ(FieldAvatarLocalFile, v)) -} - -// AvatarLocalFileIn applies the In predicate on the "avatar_local_file" field. -func AvatarLocalFileIn(vs ...string) predicate.User { - return predicate.User(sql.FieldIn(FieldAvatarLocalFile, vs...)) -} - -// AvatarLocalFileNotIn applies the NotIn predicate on the "avatar_local_file" field. -func AvatarLocalFileNotIn(vs ...string) predicate.User { - return predicate.User(sql.FieldNotIn(FieldAvatarLocalFile, vs...)) -} - -// AvatarLocalFileGT applies the GT predicate on the "avatar_local_file" field. -func AvatarLocalFileGT(v string) predicate.User { - return predicate.User(sql.FieldGT(FieldAvatarLocalFile, v)) -} - -// AvatarLocalFileGTE applies the GTE predicate on the "avatar_local_file" field. -func AvatarLocalFileGTE(v string) predicate.User { - return predicate.User(sql.FieldGTE(FieldAvatarLocalFile, v)) -} - -// AvatarLocalFileLT applies the LT predicate on the "avatar_local_file" field. -func AvatarLocalFileLT(v string) predicate.User { - return predicate.User(sql.FieldLT(FieldAvatarLocalFile, v)) -} - -// AvatarLocalFileLTE applies the LTE predicate on the "avatar_local_file" field. -func AvatarLocalFileLTE(v string) predicate.User { - return predicate.User(sql.FieldLTE(FieldAvatarLocalFile, v)) -} - -// AvatarLocalFileContains applies the Contains predicate on the "avatar_local_file" field. -func AvatarLocalFileContains(v string) predicate.User { - return predicate.User(sql.FieldContains(FieldAvatarLocalFile, v)) -} - -// AvatarLocalFileHasPrefix applies the HasPrefix predicate on the "avatar_local_file" field. -func AvatarLocalFileHasPrefix(v string) predicate.User { - return predicate.User(sql.FieldHasPrefix(FieldAvatarLocalFile, v)) -} - -// AvatarLocalFileHasSuffix applies the HasSuffix predicate on the "avatar_local_file" field. -func AvatarLocalFileHasSuffix(v string) predicate.User { - return predicate.User(sql.FieldHasSuffix(FieldAvatarLocalFile, v)) -} - -// AvatarLocalFileIsNil applies the IsNil predicate on the "avatar_local_file" field. -func AvatarLocalFileIsNil() predicate.User { - return predicate.User(sql.FieldIsNull(FieldAvatarLocalFile)) -} - -// AvatarLocalFileNotNil applies the NotNil predicate on the "avatar_local_file" field. -func AvatarLocalFileNotNil() predicate.User { - return predicate.User(sql.FieldNotNull(FieldAvatarLocalFile)) -} - -// AvatarLocalFileEqualFold applies the EqualFold predicate on the "avatar_local_file" field. -func AvatarLocalFileEqualFold(v string) predicate.User { - return predicate.User(sql.FieldEqualFold(FieldAvatarLocalFile, v)) -} - -// AvatarLocalFileContainsFold applies the ContainsFold predicate on the "avatar_local_file" field. -func AvatarLocalFileContainsFold(v string) predicate.User { - return predicate.User(sql.FieldContainsFold(FieldAvatarLocalFile, v)) -} - // AvatarLocalFileIDEQ applies the EQ predicate on the "avatar_local_file_id" field. func AvatarLocalFileIDEQ(v string) predicate.User { return predicate.User(sql.FieldEQ(FieldAvatarLocalFileID, v)) @@ -1694,12 +1614,12 @@ func HasFilesWith(preds ...predicate.File) predicate.User { }) } -// HasFile applies the HasEdge predicate on the "file" edge. -func HasFile() predicate.User { +// HasAvatarFile applies the HasEdge predicate on the "avatar_file" edge. +func HasAvatarFile() predicate.User { return predicate.User(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, FileTable, FileColumn), + sqlgraph.Edge(sqlgraph.M2O, false, AvatarFileTable, AvatarFileColumn), ) schemaConfig := internal.SchemaConfigFromContext(s.Context()) step.To.Schema = schemaConfig.File @@ -1708,10 +1628,10 @@ func HasFile() predicate.User { }) } -// HasFileWith applies the HasEdge predicate on the "file" edge with a given conditions (other predicates). -func HasFileWith(preds ...predicate.File) predicate.User { +// HasAvatarFileWith applies the HasEdge predicate on the "avatar_file" edge with a given conditions (other predicates). +func HasAvatarFileWith(preds ...predicate.File) predicate.User { return predicate.User(func(s *sql.Selector) { - step := newFileStep() + step := newAvatarFileStep() schemaConfig := internal.SchemaConfigFromContext(s.Context()) step.To.Schema = schemaConfig.File step.Edge.Schema = schemaConfig.User diff --git a/internal/ent/generated/user_create.go b/internal/ent/generated/user_create.go index a5cc9cdc..868e96d6 100644 --- a/internal/ent/generated/user_create.go +++ b/internal/ent/generated/user_create.go @@ -196,20 +196,6 @@ func (uc *UserCreate) SetNillableAvatarRemoteURL(s *string) *UserCreate { return uc } -// SetAvatarLocalFile sets the "avatar_local_file" field. -func (uc *UserCreate) SetAvatarLocalFile(s string) *UserCreate { - uc.mutation.SetAvatarLocalFile(s) - return uc -} - -// SetNillableAvatarLocalFile sets the "avatar_local_file" field if the given value is not nil. -func (uc *UserCreate) SetNillableAvatarLocalFile(s *string) *UserCreate { - if s != nil { - uc.SetAvatarLocalFile(*s) - } - return uc -} - // SetAvatarLocalFileID sets the "avatar_local_file_id" field. func (uc *UserCreate) SetAvatarLocalFileID(s string) *UserCreate { uc.mutation.SetAvatarLocalFileID(s) @@ -453,23 +439,23 @@ func (uc *UserCreate) AddFiles(f ...*File) *UserCreate { return uc.AddFileIDs(ids...) } -// SetFileID sets the "file" edge to the File entity by ID. -func (uc *UserCreate) SetFileID(id string) *UserCreate { - uc.mutation.SetFileID(id) +// SetAvatarFileID sets the "avatar_file" edge to the File entity by ID. +func (uc *UserCreate) SetAvatarFileID(id string) *UserCreate { + uc.mutation.SetAvatarFileID(id) return uc } -// SetNillableFileID sets the "file" edge to the File entity by ID if the given value is not nil. -func (uc *UserCreate) SetNillableFileID(id *string) *UserCreate { +// SetNillableAvatarFileID sets the "avatar_file" edge to the File entity by ID if the given value is not nil. +func (uc *UserCreate) SetNillableAvatarFileID(id *string) *UserCreate { if id != nil { - uc = uc.SetFileID(*id) + uc = uc.SetAvatarFileID(*id) } return uc } -// SetFile sets the "file" edge to the File entity. -func (uc *UserCreate) SetFile(f *File) *UserCreate { - return uc.SetFileID(f.ID) +// SetAvatarFile sets the "avatar_file" edge to the File entity. +func (uc *UserCreate) SetAvatarFile(f *File) *UserCreate { + return uc.SetAvatarFileID(f.ID) } // AddEventIDs adds the "events" edge to the Event entity by IDs. @@ -669,6 +655,13 @@ func (uc *UserCreate) defaults() error { v := user.DefaultTags uc.mutation.SetTags(v) } + if _, ok := uc.mutation.AvatarUpdatedAt(); !ok { + if user.DefaultAvatarUpdatedAt == nil { + return fmt.Errorf("generated: uninitialized user.DefaultAvatarUpdatedAt (forgotten import generated/runtime?)") + } + v := user.DefaultAvatarUpdatedAt() + uc.mutation.SetAvatarUpdatedAt(v) + } if _, ok := uc.mutation.AuthProvider(); !ok { v := user.DefaultAuthProvider uc.mutation.SetAuthProvider(v) @@ -723,11 +716,6 @@ func (uc *UserCreate) check() error { return &ValidationError{Name: "avatar_remote_url", err: fmt.Errorf(`generated: validator failed for field "User.avatar_remote_url": %w`, err)} } } - if v, ok := uc.mutation.AvatarLocalFile(); ok { - if err := user.AvatarLocalFileValidator(v); err != nil { - return &ValidationError{Name: "avatar_local_file", err: fmt.Errorf(`generated: validator failed for field "User.avatar_local_file": %w`, err)} - } - } if _, ok := uc.mutation.AuthProvider(); !ok { return &ValidationError{Name: "auth_provider", err: errors.New(`generated: missing required field "User.auth_provider"`)} } @@ -832,10 +820,6 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { _spec.SetField(user.FieldAvatarRemoteURL, field.TypeString, value) _node.AvatarRemoteURL = &value } - if value, ok := uc.mutation.AvatarLocalFile(); ok { - _spec.SetField(user.FieldAvatarLocalFile, field.TypeString, value) - _node.AvatarLocalFile = &value - } if value, ok := uc.mutation.AvatarUpdatedAt(); ok { _spec.SetField(user.FieldAvatarUpdatedAt, field.TypeTime, value) _node.AvatarUpdatedAt = &value @@ -1027,12 +1011,12 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - if nodes := uc.mutation.FileIDs(); len(nodes) > 0 { + if nodes := uc.mutation.AvatarFileIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: false, - Table: user.FileTable, - Columns: []string{user.FileColumn}, + Table: user.AvatarFileTable, + Columns: []string{user.AvatarFileColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(file.FieldID, field.TypeString), diff --git a/internal/ent/generated/user_query.go b/internal/ent/generated/user_query.go index a73d7bfd..50218b29 100644 --- a/internal/ent/generated/user_query.go +++ b/internal/ent/generated/user_query.go @@ -52,7 +52,7 @@ type UserQuery struct { withOrganizations *OrganizationQuery withWebauthn *WebauthnQuery withFiles *FileQuery - withFile *FileQuery + withAvatarFile *FileQuery withEvents *EventQuery withActionPlans *ActionPlanQuery withSubcontrols *SubcontrolQuery @@ -342,8 +342,8 @@ func (uq *UserQuery) QueryFiles() *FileQuery { return query } -// QueryFile chains the current query on the "file" edge. -func (uq *UserQuery) QueryFile() *FileQuery { +// QueryAvatarFile chains the current query on the "avatar_file" edge. +func (uq *UserQuery) QueryAvatarFile() *FileQuery { query := (&FileClient{config: uq.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := uq.prepareQuery(ctx); err != nil { @@ -356,7 +356,7 @@ func (uq *UserQuery) QueryFile() *FileQuery { step := sqlgraph.NewStep( sqlgraph.From(user.Table, user.FieldID, selector), sqlgraph.To(file.Table, file.FieldID), - sqlgraph.Edge(sqlgraph.M2O, false, user.FileTable, user.FileColumn), + sqlgraph.Edge(sqlgraph.M2O, false, user.AvatarFileTable, user.AvatarFileColumn), ) schemaConfig := uq.schemaConfig step.To.Schema = schemaConfig.File @@ -793,7 +793,7 @@ func (uq *UserQuery) Clone() *UserQuery { withOrganizations: uq.withOrganizations.Clone(), withWebauthn: uq.withWebauthn.Clone(), withFiles: uq.withFiles.Clone(), - withFile: uq.withFile.Clone(), + withAvatarFile: uq.withAvatarFile.Clone(), withEvents: uq.withEvents.Clone(), withActionPlans: uq.withActionPlans.Clone(), withSubcontrols: uq.withSubcontrols.Clone(), @@ -909,14 +909,14 @@ func (uq *UserQuery) WithFiles(opts ...func(*FileQuery)) *UserQuery { return uq } -// WithFile tells the query-builder to eager-load the nodes that are connected to -// the "file" edge. The optional arguments are used to configure the query builder of the edge. -func (uq *UserQuery) WithFile(opts ...func(*FileQuery)) *UserQuery { +// WithAvatarFile tells the query-builder to eager-load the nodes that are connected to +// the "avatar_file" edge. The optional arguments are used to configure the query builder of the edge. +func (uq *UserQuery) WithAvatarFile(opts ...func(*FileQuery)) *UserQuery { query := (&FileClient{config: uq.config}).Query() for _, opt := range opts { opt(query) } - uq.withFile = query + uq.withAvatarFile = query return uq } @@ -1113,7 +1113,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*User, e uq.withOrganizations != nil, uq.withWebauthn != nil, uq.withFiles != nil, - uq.withFile != nil, + uq.withAvatarFile != nil, uq.withEvents != nil, uq.withActionPlans != nil, uq.withSubcontrols != nil, @@ -1216,9 +1216,9 @@ func (uq *UserQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*User, e return nil, err } } - if query := uq.withFile; query != nil { - if err := uq.loadFile(ctx, query, nodes, nil, - func(n *User, e *File) { n.Edges.File = e }); err != nil { + if query := uq.withAvatarFile; query != nil { + if err := uq.loadAvatarFile(ctx, query, nodes, nil, + func(n *User, e *File) { n.Edges.AvatarFile = e }); err != nil { return nil, err } } @@ -1778,7 +1778,7 @@ func (uq *UserQuery) loadFiles(ctx context.Context, query *FileQuery, nodes []*U } return nil } -func (uq *UserQuery) loadFile(ctx context.Context, query *FileQuery, nodes []*User, init func(*User), assign func(*User, *File)) error { +func (uq *UserQuery) loadAvatarFile(ctx context.Context, query *FileQuery, nodes []*User, init func(*User), assign func(*User, *File)) error { ids := make([]string, 0, len(nodes)) nodeids := make(map[string][]*User) for i := range nodes { @@ -2241,7 +2241,7 @@ func (uq *UserQuery) querySpec() *sqlgraph.QuerySpec { _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) } } - if uq.withFile != nil { + if uq.withAvatarFile != nil { _spec.Node.AddColumnOnce(user.FieldAvatarLocalFileID) } } diff --git a/internal/ent/generated/user_update.go b/internal/ent/generated/user_update.go index c49cc6e3..41f59680 100644 --- a/internal/ent/generated/user_update.go +++ b/internal/ent/generated/user_update.go @@ -228,26 +228,6 @@ func (uu *UserUpdate) ClearAvatarRemoteURL() *UserUpdate { return uu } -// SetAvatarLocalFile sets the "avatar_local_file" field. -func (uu *UserUpdate) SetAvatarLocalFile(s string) *UserUpdate { - uu.mutation.SetAvatarLocalFile(s) - return uu -} - -// SetNillableAvatarLocalFile sets the "avatar_local_file" field if the given value is not nil. -func (uu *UserUpdate) SetNillableAvatarLocalFile(s *string) *UserUpdate { - if s != nil { - uu.SetAvatarLocalFile(*s) - } - return uu -} - -// ClearAvatarLocalFile clears the value of the "avatar_local_file" field. -func (uu *UserUpdate) ClearAvatarLocalFile() *UserUpdate { - uu.mutation.ClearAvatarLocalFile() - return uu -} - // SetAvatarLocalFileID sets the "avatar_local_file_id" field. func (uu *UserUpdate) SetAvatarLocalFileID(s string) *UserUpdate { uu.mutation.SetAvatarLocalFileID(s) @@ -497,23 +477,23 @@ func (uu *UserUpdate) AddFiles(f ...*File) *UserUpdate { return uu.AddFileIDs(ids...) } -// SetFileID sets the "file" edge to the File entity by ID. -func (uu *UserUpdate) SetFileID(id string) *UserUpdate { - uu.mutation.SetFileID(id) +// SetAvatarFileID sets the "avatar_file" edge to the File entity by ID. +func (uu *UserUpdate) SetAvatarFileID(id string) *UserUpdate { + uu.mutation.SetAvatarFileID(id) return uu } -// SetNillableFileID sets the "file" edge to the File entity by ID if the given value is not nil. -func (uu *UserUpdate) SetNillableFileID(id *string) *UserUpdate { +// SetNillableAvatarFileID sets the "avatar_file" edge to the File entity by ID if the given value is not nil. +func (uu *UserUpdate) SetNillableAvatarFileID(id *string) *UserUpdate { if id != nil { - uu = uu.SetFileID(*id) + uu = uu.SetAvatarFileID(*id) } return uu } -// SetFile sets the "file" edge to the File entity. -func (uu *UserUpdate) SetFile(f *File) *UserUpdate { - return uu.SetFileID(f.ID) +// SetAvatarFile sets the "avatar_file" edge to the File entity. +func (uu *UserUpdate) SetAvatarFile(f *File) *UserUpdate { + return uu.SetAvatarFileID(f.ID) } // AddEventIDs adds the "events" edge to the Event entity by IDs. @@ -830,9 +810,9 @@ func (uu *UserUpdate) RemoveFiles(f ...*File) *UserUpdate { return uu.RemoveFileIDs(ids...) } -// ClearFile clears the "file" edge to the File entity. -func (uu *UserUpdate) ClearFile() *UserUpdate { - uu.mutation.ClearFile() +// ClearAvatarFile clears the "avatar_file" edge to the File entity. +func (uu *UserUpdate) ClearAvatarFile() *UserUpdate { + uu.mutation.ClearAvatarFile() return uu } @@ -1108,11 +1088,6 @@ func (uu *UserUpdate) check() error { return &ValidationError{Name: "avatar_remote_url", err: fmt.Errorf(`generated: validator failed for field "User.avatar_remote_url": %w`, err)} } } - if v, ok := uu.mutation.AvatarLocalFile(); ok { - if err := user.AvatarLocalFileValidator(v); err != nil { - return &ValidationError{Name: "avatar_local_file", err: fmt.Errorf(`generated: validator failed for field "User.avatar_local_file": %w`, err)} - } - } if v, ok := uu.mutation.AuthProvider(); ok { if err := user.AuthProviderValidator(v); err != nil { return &ValidationError{Name: "auth_provider", err: fmt.Errorf(`generated: validator failed for field "User.auth_provider": %w`, err)} @@ -1212,12 +1187,6 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { if uu.mutation.AvatarRemoteURLCleared() { _spec.ClearField(user.FieldAvatarRemoteURL, field.TypeString) } - if value, ok := uu.mutation.AvatarLocalFile(); ok { - _spec.SetField(user.FieldAvatarLocalFile, field.TypeString, value) - } - if uu.mutation.AvatarLocalFileCleared() { - _spec.ClearField(user.FieldAvatarLocalFile, field.TypeString) - } if value, ok := uu.mutation.AvatarUpdatedAt(); ok { _spec.SetField(user.FieldAvatarUpdatedAt, field.TypeTime, value) } @@ -1708,12 +1677,12 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - if uu.mutation.FileCleared() { + if uu.mutation.AvatarFileCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: false, - Table: user.FileTable, - Columns: []string{user.FileColumn}, + Table: user.AvatarFileTable, + Columns: []string{user.AvatarFileColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(file.FieldID, field.TypeString), @@ -1722,12 +1691,12 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { edge.Schema = uu.schemaConfig.User _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := uu.mutation.FileIDs(); len(nodes) > 0 { + if nodes := uu.mutation.AvatarFileIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: false, - Table: user.FileTable, - Columns: []string{user.FileColumn}, + Table: user.AvatarFileTable, + Columns: []string{user.AvatarFileColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(file.FieldID, field.TypeString), @@ -2394,26 +2363,6 @@ func (uuo *UserUpdateOne) ClearAvatarRemoteURL() *UserUpdateOne { return uuo } -// SetAvatarLocalFile sets the "avatar_local_file" field. -func (uuo *UserUpdateOne) SetAvatarLocalFile(s string) *UserUpdateOne { - uuo.mutation.SetAvatarLocalFile(s) - return uuo -} - -// SetNillableAvatarLocalFile sets the "avatar_local_file" field if the given value is not nil. -func (uuo *UserUpdateOne) SetNillableAvatarLocalFile(s *string) *UserUpdateOne { - if s != nil { - uuo.SetAvatarLocalFile(*s) - } - return uuo -} - -// ClearAvatarLocalFile clears the value of the "avatar_local_file" field. -func (uuo *UserUpdateOne) ClearAvatarLocalFile() *UserUpdateOne { - uuo.mutation.ClearAvatarLocalFile() - return uuo -} - // SetAvatarLocalFileID sets the "avatar_local_file_id" field. func (uuo *UserUpdateOne) SetAvatarLocalFileID(s string) *UserUpdateOne { uuo.mutation.SetAvatarLocalFileID(s) @@ -2663,23 +2612,23 @@ func (uuo *UserUpdateOne) AddFiles(f ...*File) *UserUpdateOne { return uuo.AddFileIDs(ids...) } -// SetFileID sets the "file" edge to the File entity by ID. -func (uuo *UserUpdateOne) SetFileID(id string) *UserUpdateOne { - uuo.mutation.SetFileID(id) +// SetAvatarFileID sets the "avatar_file" edge to the File entity by ID. +func (uuo *UserUpdateOne) SetAvatarFileID(id string) *UserUpdateOne { + uuo.mutation.SetAvatarFileID(id) return uuo } -// SetNillableFileID sets the "file" edge to the File entity by ID if the given value is not nil. -func (uuo *UserUpdateOne) SetNillableFileID(id *string) *UserUpdateOne { +// SetNillableAvatarFileID sets the "avatar_file" edge to the File entity by ID if the given value is not nil. +func (uuo *UserUpdateOne) SetNillableAvatarFileID(id *string) *UserUpdateOne { if id != nil { - uuo = uuo.SetFileID(*id) + uuo = uuo.SetAvatarFileID(*id) } return uuo } -// SetFile sets the "file" edge to the File entity. -func (uuo *UserUpdateOne) SetFile(f *File) *UserUpdateOne { - return uuo.SetFileID(f.ID) +// SetAvatarFile sets the "avatar_file" edge to the File entity. +func (uuo *UserUpdateOne) SetAvatarFile(f *File) *UserUpdateOne { + return uuo.SetAvatarFileID(f.ID) } // AddEventIDs adds the "events" edge to the Event entity by IDs. @@ -2996,9 +2945,9 @@ func (uuo *UserUpdateOne) RemoveFiles(f ...*File) *UserUpdateOne { return uuo.RemoveFileIDs(ids...) } -// ClearFile clears the "file" edge to the File entity. -func (uuo *UserUpdateOne) ClearFile() *UserUpdateOne { - uuo.mutation.ClearFile() +// ClearAvatarFile clears the "avatar_file" edge to the File entity. +func (uuo *UserUpdateOne) ClearAvatarFile() *UserUpdateOne { + uuo.mutation.ClearAvatarFile() return uuo } @@ -3287,11 +3236,6 @@ func (uuo *UserUpdateOne) check() error { return &ValidationError{Name: "avatar_remote_url", err: fmt.Errorf(`generated: validator failed for field "User.avatar_remote_url": %w`, err)} } } - if v, ok := uuo.mutation.AvatarLocalFile(); ok { - if err := user.AvatarLocalFileValidator(v); err != nil { - return &ValidationError{Name: "avatar_local_file", err: fmt.Errorf(`generated: validator failed for field "User.avatar_local_file": %w`, err)} - } - } if v, ok := uuo.mutation.AuthProvider(); ok { if err := user.AuthProviderValidator(v); err != nil { return &ValidationError{Name: "auth_provider", err: fmt.Errorf(`generated: validator failed for field "User.auth_provider": %w`, err)} @@ -3408,12 +3352,6 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) if uuo.mutation.AvatarRemoteURLCleared() { _spec.ClearField(user.FieldAvatarRemoteURL, field.TypeString) } - if value, ok := uuo.mutation.AvatarLocalFile(); ok { - _spec.SetField(user.FieldAvatarLocalFile, field.TypeString, value) - } - if uuo.mutation.AvatarLocalFileCleared() { - _spec.ClearField(user.FieldAvatarLocalFile, field.TypeString) - } if value, ok := uuo.mutation.AvatarUpdatedAt(); ok { _spec.SetField(user.FieldAvatarUpdatedAt, field.TypeTime, value) } @@ -3904,12 +3842,12 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - if uuo.mutation.FileCleared() { + if uuo.mutation.AvatarFileCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: false, - Table: user.FileTable, - Columns: []string{user.FileColumn}, + Table: user.AvatarFileTable, + Columns: []string{user.AvatarFileColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(file.FieldID, field.TypeString), @@ -3918,12 +3856,12 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) edge.Schema = uuo.schemaConfig.User _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := uuo.mutation.FileIDs(); len(nodes) > 0 { + if nodes := uuo.mutation.AvatarFileIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: false, - Table: user.FileTable, - Columns: []string{user.FileColumn}, + Table: user.AvatarFileTable, + Columns: []string{user.AvatarFileColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(file.FieldID, field.TypeString), diff --git a/internal/ent/generated/userhistory.go b/internal/ent/generated/userhistory.go index 13c10ffd..178215ec 100644 --- a/internal/ent/generated/userhistory.go +++ b/internal/ent/generated/userhistory.go @@ -52,9 +52,7 @@ type UserHistory struct { DisplayName string `json:"display_name,omitempty"` // URL of the user's remote avatar AvatarRemoteURL *string `json:"avatar_remote_url,omitempty"` - // The user's local avatar file - AvatarLocalFile *string `json:"avatar_local_file,omitempty"` - // The user's local avatar file id + // The user's local avatar file id, takes precedence over the avatar remote URL AvatarLocalFileID *string `json:"avatar_local_file_id,omitempty"` // The time the user's (local) avatar was last updated AvatarUpdatedAt *time.Time `json:"avatar_updated_at,omitempty"` @@ -80,7 +78,7 @@ func (*UserHistory) scanValues(columns []string) ([]any, error) { values[i] = new([]byte) case userhistory.FieldOperation: values[i] = new(history.OpType) - case userhistory.FieldID, userhistory.FieldRef, userhistory.FieldCreatedBy, userhistory.FieldUpdatedBy, userhistory.FieldDeletedBy, userhistory.FieldMappingID, userhistory.FieldEmail, userhistory.FieldFirstName, userhistory.FieldLastName, userhistory.FieldDisplayName, userhistory.FieldAvatarRemoteURL, userhistory.FieldAvatarLocalFile, userhistory.FieldAvatarLocalFileID, userhistory.FieldPassword, userhistory.FieldSub, userhistory.FieldAuthProvider, userhistory.FieldRole: + case userhistory.FieldID, userhistory.FieldRef, userhistory.FieldCreatedBy, userhistory.FieldUpdatedBy, userhistory.FieldDeletedBy, userhistory.FieldMappingID, userhistory.FieldEmail, userhistory.FieldFirstName, userhistory.FieldLastName, userhistory.FieldDisplayName, userhistory.FieldAvatarRemoteURL, userhistory.FieldAvatarLocalFileID, userhistory.FieldPassword, userhistory.FieldSub, userhistory.FieldAuthProvider, userhistory.FieldRole: values[i] = new(sql.NullString) case userhistory.FieldHistoryTime, userhistory.FieldCreatedAt, userhistory.FieldUpdatedAt, userhistory.FieldDeletedAt, userhistory.FieldAvatarUpdatedAt, userhistory.FieldLastSeen: values[i] = new(sql.NullTime) @@ -204,13 +202,6 @@ func (uh *UserHistory) assignValues(columns []string, values []any) error { uh.AvatarRemoteURL = new(string) *uh.AvatarRemoteURL = value.String } - case userhistory.FieldAvatarLocalFile: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field avatar_local_file", values[i]) - } else if value.Valid { - uh.AvatarLocalFile = new(string) - *uh.AvatarLocalFile = value.String - } case userhistory.FieldAvatarLocalFileID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field avatar_local_file_id", values[i]) @@ -343,11 +334,6 @@ func (uh *UserHistory) String() string { builder.WriteString(*v) } builder.WriteString(", ") - if v := uh.AvatarLocalFile; v != nil { - builder.WriteString("avatar_local_file=") - builder.WriteString(*v) - } - builder.WriteString(", ") if v := uh.AvatarLocalFileID; v != nil { builder.WriteString("avatar_local_file_id=") builder.WriteString(*v) diff --git a/internal/ent/generated/userhistory/userhistory.go b/internal/ent/generated/userhistory/userhistory.go index 4145e429..c9033dd8 100644 --- a/internal/ent/generated/userhistory/userhistory.go +++ b/internal/ent/generated/userhistory/userhistory.go @@ -50,8 +50,6 @@ const ( FieldDisplayName = "display_name" // FieldAvatarRemoteURL holds the string denoting the avatar_remote_url field in the database. FieldAvatarRemoteURL = "avatar_remote_url" - // FieldAvatarLocalFile holds the string denoting the avatar_local_file field in the database. - FieldAvatarLocalFile = "avatar_local_file" // FieldAvatarLocalFileID holds the string denoting the avatar_local_file_id field in the database. FieldAvatarLocalFileID = "avatar_local_file_id" // FieldAvatarUpdatedAt holds the string denoting the avatar_updated_at field in the database. @@ -89,7 +87,6 @@ var Columns = []string{ FieldLastName, FieldDisplayName, FieldAvatarRemoteURL, - FieldAvatarLocalFile, FieldAvatarLocalFileID, FieldAvatarUpdatedAt, FieldLastSeen, @@ -128,6 +125,8 @@ var ( DefaultMappingID func() string // DefaultTags holds the default value on creation for the "tags" field. DefaultTags []string + // DefaultAvatarUpdatedAt holds the default value on creation for the "avatar_updated_at" field. + DefaultAvatarUpdatedAt func() time.Time // UpdateDefaultAvatarUpdatedAt holds the default value on update for the "avatar_updated_at" field. UpdateDefaultAvatarUpdatedAt func() time.Time // UpdateDefaultLastSeen holds the default value on update for the "last_seen" field. @@ -253,11 +252,6 @@ func ByAvatarRemoteURL(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldAvatarRemoteURL, opts...).ToFunc() } -// ByAvatarLocalFile orders the results by the avatar_local_file field. -func ByAvatarLocalFile(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldAvatarLocalFile, opts...).ToFunc() -} - // ByAvatarLocalFileID orders the results by the avatar_local_file_id field. func ByAvatarLocalFileID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldAvatarLocalFileID, opts...).ToFunc() diff --git a/internal/ent/generated/userhistory/where.go b/internal/ent/generated/userhistory/where.go index 78a830d8..acc5c6d2 100644 --- a/internal/ent/generated/userhistory/where.go +++ b/internal/ent/generated/userhistory/where.go @@ -136,11 +136,6 @@ func AvatarRemoteURL(v string) predicate.UserHistory { return predicate.UserHistory(sql.FieldEQ(FieldAvatarRemoteURL, v)) } -// AvatarLocalFile applies equality check predicate on the "avatar_local_file" field. It's identical to AvatarLocalFileEQ. -func AvatarLocalFile(v string) predicate.UserHistory { - return predicate.UserHistory(sql.FieldEQ(FieldAvatarLocalFile, v)) -} - // AvatarLocalFileID applies equality check predicate on the "avatar_local_file_id" field. It's identical to AvatarLocalFileIDEQ. func AvatarLocalFileID(v string) predicate.UserHistory { return predicate.UserHistory(sql.FieldEQ(FieldAvatarLocalFileID, v)) @@ -1106,81 +1101,6 @@ func AvatarRemoteURLContainsFold(v string) predicate.UserHistory { return predicate.UserHistory(sql.FieldContainsFold(FieldAvatarRemoteURL, v)) } -// AvatarLocalFileEQ applies the EQ predicate on the "avatar_local_file" field. -func AvatarLocalFileEQ(v string) predicate.UserHistory { - return predicate.UserHistory(sql.FieldEQ(FieldAvatarLocalFile, v)) -} - -// AvatarLocalFileNEQ applies the NEQ predicate on the "avatar_local_file" field. -func AvatarLocalFileNEQ(v string) predicate.UserHistory { - return predicate.UserHistory(sql.FieldNEQ(FieldAvatarLocalFile, v)) -} - -// AvatarLocalFileIn applies the In predicate on the "avatar_local_file" field. -func AvatarLocalFileIn(vs ...string) predicate.UserHistory { - return predicate.UserHistory(sql.FieldIn(FieldAvatarLocalFile, vs...)) -} - -// AvatarLocalFileNotIn applies the NotIn predicate on the "avatar_local_file" field. -func AvatarLocalFileNotIn(vs ...string) predicate.UserHistory { - return predicate.UserHistory(sql.FieldNotIn(FieldAvatarLocalFile, vs...)) -} - -// AvatarLocalFileGT applies the GT predicate on the "avatar_local_file" field. -func AvatarLocalFileGT(v string) predicate.UserHistory { - return predicate.UserHistory(sql.FieldGT(FieldAvatarLocalFile, v)) -} - -// AvatarLocalFileGTE applies the GTE predicate on the "avatar_local_file" field. -func AvatarLocalFileGTE(v string) predicate.UserHistory { - return predicate.UserHistory(sql.FieldGTE(FieldAvatarLocalFile, v)) -} - -// AvatarLocalFileLT applies the LT predicate on the "avatar_local_file" field. -func AvatarLocalFileLT(v string) predicate.UserHistory { - return predicate.UserHistory(sql.FieldLT(FieldAvatarLocalFile, v)) -} - -// AvatarLocalFileLTE applies the LTE predicate on the "avatar_local_file" field. -func AvatarLocalFileLTE(v string) predicate.UserHistory { - return predicate.UserHistory(sql.FieldLTE(FieldAvatarLocalFile, v)) -} - -// AvatarLocalFileContains applies the Contains predicate on the "avatar_local_file" field. -func AvatarLocalFileContains(v string) predicate.UserHistory { - return predicate.UserHistory(sql.FieldContains(FieldAvatarLocalFile, v)) -} - -// AvatarLocalFileHasPrefix applies the HasPrefix predicate on the "avatar_local_file" field. -func AvatarLocalFileHasPrefix(v string) predicate.UserHistory { - return predicate.UserHistory(sql.FieldHasPrefix(FieldAvatarLocalFile, v)) -} - -// AvatarLocalFileHasSuffix applies the HasSuffix predicate on the "avatar_local_file" field. -func AvatarLocalFileHasSuffix(v string) predicate.UserHistory { - return predicate.UserHistory(sql.FieldHasSuffix(FieldAvatarLocalFile, v)) -} - -// AvatarLocalFileIsNil applies the IsNil predicate on the "avatar_local_file" field. -func AvatarLocalFileIsNil() predicate.UserHistory { - return predicate.UserHistory(sql.FieldIsNull(FieldAvatarLocalFile)) -} - -// AvatarLocalFileNotNil applies the NotNil predicate on the "avatar_local_file" field. -func AvatarLocalFileNotNil() predicate.UserHistory { - return predicate.UserHistory(sql.FieldNotNull(FieldAvatarLocalFile)) -} - -// AvatarLocalFileEqualFold applies the EqualFold predicate on the "avatar_local_file" field. -func AvatarLocalFileEqualFold(v string) predicate.UserHistory { - return predicate.UserHistory(sql.FieldEqualFold(FieldAvatarLocalFile, v)) -} - -// AvatarLocalFileContainsFold applies the ContainsFold predicate on the "avatar_local_file" field. -func AvatarLocalFileContainsFold(v string) predicate.UserHistory { - return predicate.UserHistory(sql.FieldContainsFold(FieldAvatarLocalFile, v)) -} - // AvatarLocalFileIDEQ applies the EQ predicate on the "avatar_local_file_id" field. func AvatarLocalFileIDEQ(v string) predicate.UserHistory { return predicate.UserHistory(sql.FieldEQ(FieldAvatarLocalFileID, v)) diff --git a/internal/ent/generated/userhistory_create.go b/internal/ent/generated/userhistory_create.go index b12461a3..a322cc6b 100644 --- a/internal/ent/generated/userhistory_create.go +++ b/internal/ent/generated/userhistory_create.go @@ -214,20 +214,6 @@ func (uhc *UserHistoryCreate) SetNillableAvatarRemoteURL(s *string) *UserHistory return uhc } -// SetAvatarLocalFile sets the "avatar_local_file" field. -func (uhc *UserHistoryCreate) SetAvatarLocalFile(s string) *UserHistoryCreate { - uhc.mutation.SetAvatarLocalFile(s) - return uhc -} - -// SetNillableAvatarLocalFile sets the "avatar_local_file" field if the given value is not nil. -func (uhc *UserHistoryCreate) SetNillableAvatarLocalFile(s *string) *UserHistoryCreate { - if s != nil { - uhc.SetAvatarLocalFile(*s) - } - return uhc -} - // SetAvatarLocalFileID sets the "avatar_local_file_id" field. func (uhc *UserHistoryCreate) SetAvatarLocalFileID(s string) *UserHistoryCreate { uhc.mutation.SetAvatarLocalFileID(s) @@ -395,6 +381,10 @@ func (uhc *UserHistoryCreate) defaults() { v := userhistory.DefaultTags uhc.mutation.SetTags(v) } + if _, ok := uhc.mutation.AvatarUpdatedAt(); !ok { + v := userhistory.DefaultAvatarUpdatedAt() + uhc.mutation.SetAvatarUpdatedAt(v) + } if _, ok := uhc.mutation.AuthProvider(); !ok { v := userhistory.DefaultAuthProvider uhc.mutation.SetAuthProvider(v) @@ -544,10 +534,6 @@ func (uhc *UserHistoryCreate) createSpec() (*UserHistory, *sqlgraph.CreateSpec) _spec.SetField(userhistory.FieldAvatarRemoteURL, field.TypeString, value) _node.AvatarRemoteURL = &value } - if value, ok := uhc.mutation.AvatarLocalFile(); ok { - _spec.SetField(userhistory.FieldAvatarLocalFile, field.TypeString, value) - _node.AvatarLocalFile = &value - } if value, ok := uhc.mutation.AvatarLocalFileID(); ok { _spec.SetField(userhistory.FieldAvatarLocalFileID, field.TypeString, value) _node.AvatarLocalFileID = &value diff --git a/internal/ent/generated/userhistory_update.go b/internal/ent/generated/userhistory_update.go index 5afb7a81..ec928f49 100644 --- a/internal/ent/generated/userhistory_update.go +++ b/internal/ent/generated/userhistory_update.go @@ -211,26 +211,6 @@ func (uhu *UserHistoryUpdate) ClearAvatarRemoteURL() *UserHistoryUpdate { return uhu } -// SetAvatarLocalFile sets the "avatar_local_file" field. -func (uhu *UserHistoryUpdate) SetAvatarLocalFile(s string) *UserHistoryUpdate { - uhu.mutation.SetAvatarLocalFile(s) - return uhu -} - -// SetNillableAvatarLocalFile sets the "avatar_local_file" field if the given value is not nil. -func (uhu *UserHistoryUpdate) SetNillableAvatarLocalFile(s *string) *UserHistoryUpdate { - if s != nil { - uhu.SetAvatarLocalFile(*s) - } - return uhu -} - -// ClearAvatarLocalFile clears the value of the "avatar_local_file" field. -func (uhu *UserHistoryUpdate) ClearAvatarLocalFile() *UserHistoryUpdate { - uhu.mutation.ClearAvatarLocalFile() - return uhu -} - // SetAvatarLocalFileID sets the "avatar_local_file_id" field. func (uhu *UserHistoryUpdate) SetAvatarLocalFileID(s string) *UserHistoryUpdate { uhu.mutation.SetAvatarLocalFileID(s) @@ -499,12 +479,6 @@ func (uhu *UserHistoryUpdate) sqlSave(ctx context.Context) (n int, err error) { if uhu.mutation.AvatarRemoteURLCleared() { _spec.ClearField(userhistory.FieldAvatarRemoteURL, field.TypeString) } - if value, ok := uhu.mutation.AvatarLocalFile(); ok { - _spec.SetField(userhistory.FieldAvatarLocalFile, field.TypeString, value) - } - if uhu.mutation.AvatarLocalFileCleared() { - _spec.ClearField(userhistory.FieldAvatarLocalFile, field.TypeString) - } if value, ok := uhu.mutation.AvatarLocalFileID(); ok { _spec.SetField(userhistory.FieldAvatarLocalFileID, field.TypeString, value) } @@ -746,26 +720,6 @@ func (uhuo *UserHistoryUpdateOne) ClearAvatarRemoteURL() *UserHistoryUpdateOne { return uhuo } -// SetAvatarLocalFile sets the "avatar_local_file" field. -func (uhuo *UserHistoryUpdateOne) SetAvatarLocalFile(s string) *UserHistoryUpdateOne { - uhuo.mutation.SetAvatarLocalFile(s) - return uhuo -} - -// SetNillableAvatarLocalFile sets the "avatar_local_file" field if the given value is not nil. -func (uhuo *UserHistoryUpdateOne) SetNillableAvatarLocalFile(s *string) *UserHistoryUpdateOne { - if s != nil { - uhuo.SetAvatarLocalFile(*s) - } - return uhuo -} - -// ClearAvatarLocalFile clears the value of the "avatar_local_file" field. -func (uhuo *UserHistoryUpdateOne) ClearAvatarLocalFile() *UserHistoryUpdateOne { - uhuo.mutation.ClearAvatarLocalFile() - return uhuo -} - // SetAvatarLocalFileID sets the "avatar_local_file_id" field. func (uhuo *UserHistoryUpdateOne) SetAvatarLocalFileID(s string) *UserHistoryUpdateOne { uhuo.mutation.SetAvatarLocalFileID(s) @@ -1064,12 +1018,6 @@ func (uhuo *UserHistoryUpdateOne) sqlSave(ctx context.Context) (_node *UserHisto if uhuo.mutation.AvatarRemoteURLCleared() { _spec.ClearField(userhistory.FieldAvatarRemoteURL, field.TypeString) } - if value, ok := uhuo.mutation.AvatarLocalFile(); ok { - _spec.SetField(userhistory.FieldAvatarLocalFile, field.TypeString, value) - } - if uhuo.mutation.AvatarLocalFileCleared() { - _spec.ClearField(userhistory.FieldAvatarLocalFile, field.TypeString) - } if value, ok := uhuo.mutation.AvatarLocalFileID(); ok { _spec.SetField(userhistory.FieldAvatarLocalFileID, field.TypeString, value) } diff --git a/internal/ent/hooks/avatar.go b/internal/ent/hooks/avatar.go new file mode 100644 index 00000000..069ebe81 --- /dev/null +++ b/internal/ent/hooks/avatar.go @@ -0,0 +1,45 @@ +package hooks + +import ( + "context" + + "github.com/theopenlane/core/pkg/objects" +) + +// AvatarMutation is an interface for setting the local file ID for an avatar +type AvatarMutation interface { + SetAvatarLocalFileID(s string) + ID() (id string, exists bool) + Type() string +} + +// checkAvatarFile checks if an avatar file is provided and sets the local file ID +// this can be used for any schema that has an avatar field +func checkAvatarFile[T AvatarMutation](ctx context.Context, m T) (context.Context, error) { + key := "avatarFile" + + // get the file from the context, if it exists + file, _ := objects.FilesFromContextWithKey(ctx, key) + + // return early if no file is provided + if file == nil { + return ctx, nil + } + + // we should only have one file + if len(file) > 1 { + return ctx, ErrTooManyAvatarFiles + } + + // this should always be true, but check just in case + if file[0].FieldName == key { + m.SetAvatarLocalFileID(file[0].ID) + + file[0].Parent.ID, _ = m.ID() + file[0].Parent.Type = m.Type() + + ctx = objects.UpdateFileInContextByKey(ctx, key, file[0]) + } + + return ctx, nil +} diff --git a/internal/ent/hooks/organization.go b/internal/ent/hooks/organization.go index 2e88cd9d..2aed1fb1 100644 --- a/internal/ent/hooks/organization.go +++ b/internal/ent/hooks/organization.go @@ -7,6 +7,7 @@ import ( "entgo.io/ent" "github.com/rs/zerolog/log" + "github.com/theopenlane/echox/middleware/echocontext" "github.com/theopenlane/entx" "github.com/theopenlane/iam/auth" "github.com/theopenlane/iam/fgax" @@ -20,6 +21,7 @@ import ( "github.com/theopenlane/core/internal/ent/generated/privacy" "github.com/theopenlane/core/internal/ent/generated/usersetting" "github.com/theopenlane/core/pkg/enums" + "github.com/theopenlane/core/pkg/objects" ) // OrganizationCreationContextKey is the context key name for the organization creation context @@ -54,6 +56,22 @@ func HookOrganization() ent.Hook { // set default display name and avatar if not provided setDefaultsOnMutations(m) + // check for uploaded files (e.g. avatar image) + fileIDs := objects.GetFileIDsFromContext(ctx) + if len(fileIDs) > 0 { + ctx, err := checkAvatarFile(ctx, m) + if err != nil { + return nil, err + } + + ec, err := echocontext.EchoContextFromContext(ctx) + if err == nil { + ec.SetRequest(ec.Request().WithContext(ctx)) + } + + m.AddFileIDs(fileIDs...) + } + v, err := next.Mutate(ctx, m) if err != nil { return v, err @@ -106,7 +124,7 @@ func HookOrganization() ent.Hook { return v, err }) - }, ent.OpCreate|ent.OpUpdateOne) + }, ent.OpCreate|ent.OpUpdateOne|ent.OpUpdate) } // HookOrganizationDelete runs on org delete mutations to ensure the org can be deleted diff --git a/internal/ent/hooks/user.go b/internal/ent/hooks/user.go index afa22750..4b1271a6 100644 --- a/internal/ent/hooks/user.go +++ b/internal/ent/hooks/user.go @@ -310,33 +310,3 @@ func defaultUserSettings(ctx context.Context, user *generated.UserMutation) (str return userSetting.ID, nil } - -// checkAvatarFile checks if an avatar file is provided and sets the local file ID -func checkAvatarFile(ctx context.Context, m *generated.UserMutation) (context.Context, error) { - key := "avatarFile" - - // get the file from the context, if it exists - file, _ := objects.FilesFromContextWithKey(ctx, key) - - // return early if no file is provided - if file == nil { - return ctx, nil - } - - // we should only have one file - if len(file) > 1 { - return ctx, ErrTooManyAvatarFiles - } - - // this should always be true, but check just in case - if file[0].FieldName == key { - m.SetAvatarLocalFileID(file[0].ID) - - file[0].Parent.ID, _ = m.ID() - file[0].Parent.Type = "User" - - ctx = objects.UpdateFileInContextByKey(ctx, key, file[0]) - } - - return ctx, nil -} diff --git a/internal/ent/interceptors/file.go b/internal/ent/interceptors/file.go new file mode 100644 index 00000000..41b74fb6 --- /dev/null +++ b/internal/ent/interceptors/file.go @@ -0,0 +1,86 @@ +package interceptors + +import ( + "context" + "time" + + "entgo.io/ent" + "github.com/rs/zerolog/log" + + "github.com/theopenlane/core/internal/ent/generated" + "github.com/theopenlane/core/internal/ent/generated/intercept" + "github.com/theopenlane/core/internal/ent/utils" +) + +// InterceptorPresignedURL is an ent interceptor that sets the presignedURL field on the file query +// if the field is requested +func InterceptorPresignedURL() ent.Interceptor { + return ent.InterceptFunc(func(next ent.Querier) ent.Querier { + return intercept.FileFunc(func(ctx context.Context, q *generated.FileQuery) (generated.Value, error) { + v, err := next.Query(ctx, q) + if err != nil { + return nil, err + } + + if q.ObjectManager == nil { + log.Warn().Msg("object manager is nil, skipping presignedURL") + + return v, nil + } + + // get the fields that were queried and check for the presignedURL field + fields := utils.CheckForRequestedField(ctx, "presignedURL") + + // if the SubscriptionURL field wasn't queried, return the result as is + if !fields { + return v, nil + } + + // cast to the expected output format + res, ok := v.([]*generated.File) + if ok { + for _, f := range res { + if err := setPresignedURL(ctx, f, q); err != nil { + log.Warn().Err(err).Msg("failed to set presignedURL") + } + } + + return v, nil + } + + // if its not a list, check the single entry + f, ok := v.(*generated.File) + if ok { + if err := setPresignedURL(ctx, f, q); err != nil { + log.Warn().Err(err).Msg("failed to set presignedURLs") + } + + return v, nil + } + + return v, nil + }) + }) +} + +// presignedURLDuration is the duration for the presigned URL to be valid +const presignedURLDuration = 60 * time.Minute * 24 // 24 hours + +// setPresignedURL sets the presigned URL for the file response that is valid for 24 hours +func setPresignedURL(ctx context.Context, file *generated.File, q *generated.FileQuery) error { + // if the storage path or file is empty, skip + if file == nil || file.StoragePath == "" { + return nil + } + + url, err := q.ObjectManager.Storage.GetPresignedURL(ctx, file.StoragePath, presignedURLDuration) + if err != nil { + log.Err(err).Msg("failed to get presigned URL") + + return err + } + + file.PresignedURL = url + + return nil +} diff --git a/internal/ent/interceptors/orgsubscription.go b/internal/ent/interceptors/orgsubscription.go index ce06188b..33ed51cf 100644 --- a/internal/ent/interceptors/orgsubscription.go +++ b/internal/ent/interceptors/orgsubscription.go @@ -31,14 +31,22 @@ func InterceptorSubscriptionURL() ent.Interceptor { orgSubResult, ok := v.([]*generated.OrgSubscription) if ok { for _, orgSub := range orgSubResult { - setSubscriptionURL(orgSub, q) // nolint:errcheck + if err := setSubscriptionURL(orgSub, q); err != nil { + log.Warn().Err(err).Msg("failed to set subscription URL") + } } + + return v, nil } // if its not a list, check the single entry orgSub, ok := v.(*generated.OrgSubscription) if ok { - setSubscriptionURL(orgSub, q) // nolint:errcheck + if err := setSubscriptionURL(orgSub, q); err != nil { + log.Warn().Err(err).Msg("failed to set subscription URL") + } + + return v, nil } return v, nil diff --git a/internal/ent/schema/file.go b/internal/ent/schema/file.go index 20fcded2..57b433b8 100644 --- a/internal/ent/schema/file.go +++ b/internal/ent/schema/file.go @@ -11,6 +11,7 @@ import ( "github.com/theopenlane/core/internal/ent/generated" "github.com/theopenlane/core/internal/ent/generated/privacy" + "github.com/theopenlane/core/internal/ent/interceptors" "github.com/theopenlane/core/internal/ent/mixin" "github.com/theopenlane/core/internal/ent/privacy/policy" ) @@ -119,6 +120,13 @@ func (File) Annotations() []schema.Annotation { } } +// Interceptors of the File +func (File) Interceptors() []ent.Interceptor { + return []ent.Interceptor{ + interceptors.InterceptorPresignedURL(), + } +} + // Policy of the File func (File) Policy() ent.Policy { return policy.NewPolicy( diff --git a/internal/ent/schema/organization.go b/internal/ent/schema/organization.go index 23678085..765e600a 100644 --- a/internal/ent/schema/organization.go +++ b/internal/ent/schema/organization.go @@ -2,6 +2,7 @@ package schema import ( "net/url" + "time" "entgo.io/contrib/entgql" "entgo.io/ent" @@ -80,6 +81,20 @@ func (Organization) Fields() []ent.Field { }). Optional(). Nillable(), + field.String("avatar_local_file_id"). + Comment("The organizations's local avatar file id, takes precedence over the avatar remote URL"). + Optional(). + Annotations( + // this field is not exposed to the graphql schema, it is set by the file upload handler + entgql.Skip(entgql.SkipMutationCreateInput, entgql.SkipMutationUpdateInput), + ). + Nillable(), + field.Time("avatar_updated_at"). + Comment("The time the user's (local) avatar was last updated"). + Default(time.Now). + UpdateDefault(time.Now). + Optional(). + Nillable(), field.Bool("dedicated_db"). Comment("Whether the organization has a dedicated database"). Default(false). // default to shared db @@ -146,6 +161,8 @@ func (Organization) Edges() []ent.Edge { edge.To("events", Event.Type), edge.To("secrets", Hush.Type), edge.To("files", File.Type), + edge.To("avatar_file", File.Type). + Field("avatar_local_file_id").Unique(), // Organization owns the following entities edge.To("entities", Entity.Type). diff --git a/internal/ent/schema/user.go b/internal/ent/schema/user.go index 6d4f96d1..18a4b5b5 100644 --- a/internal/ent/schema/user.go +++ b/internal/ent/schema/user.go @@ -92,13 +92,8 @@ func (User) Fields() []ent.Field { }). Optional(). Nillable(), - field.String("avatar_local_file"). - Comment("The user's local avatar file"). - MaxLen(urlMaxLen). - Optional(). - Nillable(), field.String("avatar_local_file_id"). - Comment("The user's local avatar file id"). + Comment("The user's local avatar file id, takes precedence over the avatar remote URL"). Optional(). Annotations( // this field is not exposed to the graphql schema, it is set by the file upload handler @@ -107,6 +102,7 @@ func (User) Fields() []ent.Field { Nillable(), field.Time("avatar_updated_at"). Comment("The time the user's (local) avatar was last updated"). + Default(time.Now). UpdateDefault(time.Now). Optional(). Nillable(), @@ -175,7 +171,7 @@ func (User) Edges() []ent.Edge { edge.To("webauthn", Webauthn.Type). Annotations(entx.CascadeAnnotationField("Owner")), edge.To("files", File.Type), - edge.To("file", File.Type). + edge.To("avatar_file", File.Type). Field("avatar_local_file_id").Unique(), edge.To("events", Event.Type), edge.To("action_plans", ActionPlan.Type), diff --git a/internal/ent/templates/subscriptions.tmpl b/internal/ent/templates/additional_fields.tmpl similarity index 61% rename from internal/ent/templates/subscriptions.tmpl rename to internal/ent/templates/additional_fields.tmpl index e1bfe834..7d27a907 100644 --- a/internal/ent/templates/subscriptions.tmpl +++ b/internal/ent/templates/additional_fields.tmpl @@ -2,4 +2,7 @@ {{- if eq $.Name "OrgSubscription" }} SubscriptionURL string `json:"subscriptionURL,omitempty"` {{- end }} + {{- if eq $.Name "File" }} + PresignedURL string `json:"presignedURL,omitempty"` + {{- end }} {{ end }} \ No newline at end of file diff --git a/internal/graphapi/clientschema/schema.graphql b/internal/graphapi/clientschema/schema.graphql index c25bf317..1259bff3 100644 --- a/internal/graphapi/clientschema/schema.graphql +++ b/internal/graphapi/clientschema/schema.graphql @@ -4530,6 +4530,10 @@ input CreateOrganizationInput { """ avatarRemoteURL: String """ + The time the user's (local) avatar was last updated + """ + avatarUpdatedAt: Time + """ Whether the organization has a dedicated database """ dedicatedDb: Boolean @@ -4557,6 +4561,7 @@ input CreateOrganizationInput { eventIDs: [ID!] secretIDs: [ID!] fileIDs: [ID!] + avatarFileID: ID entityIDs: [ID!] entityTypeIDs: [ID!] contactIDs: [ID!] @@ -5096,10 +5101,6 @@ input CreateUserInput { """ avatarRemoteURL: String """ - The user's local avatar file - """ - avatarLocalFile: String - """ The time the user's (local) avatar was last updated """ avatarUpdatedAt: Time @@ -5132,7 +5133,7 @@ input CreateUserInput { organizationIDs: [ID!] webauthnIDs: [ID!] fileIDs: [ID!] - fileID: ID + avatarFileID: ID eventIDs: [ID!] actionPlanIDs: [ID!] subcontrolIDs: [ID!] @@ -7540,6 +7541,7 @@ type File implements Node { documentData: [DocumentData!] events: [Event!] program: [Program!] + presignedURL: String } """ A connection to a list of items. @@ -13491,7 +13493,7 @@ type Mutation { values of the organization """ input: CreateOrganizationInput! - ): OrganizationCreatePayload! + avatarFile: Upload): OrganizationCreatePayload! """ Create multiple new organizations """ @@ -13523,7 +13525,7 @@ type Mutation { New values for the organization """ input: UpdateOrganizationInput! - ): OrganizationUpdatePayload! + avatarFile: Upload): OrganizationUpdatePayload! """ Delete an existing organization """ @@ -16602,6 +16604,14 @@ type Organization implements Node { """ avatarRemoteURL: String """ + The organizations's local avatar file id, takes precedence over the avatar remote URL + """ + avatarLocalFileID: ID + """ + The time the user's (local) avatar was last updated + """ + avatarUpdatedAt: Time + """ Whether the organization has a dedicated database """ dedicatedDb: Boolean! @@ -16687,6 +16697,7 @@ type Organization implements Node { events: [Event!] secrets: [Hush!] files: [File!] + avatarFile: File entities: [Entity!] entityTypes: [EntityType!] contacts: [Contact!] @@ -16795,6 +16806,14 @@ type OrganizationHistory implements Node { """ avatarRemoteURL: String """ + The organizations's local avatar file id, takes precedence over the avatar remote URL + """ + avatarLocalFileID: String + """ + The time the user's (local) avatar was last updated + """ + avatarUpdatedAt: Time + """ Whether the organization has a dedicated database """ dedicatedDb: Boolean! @@ -17066,6 +17085,37 @@ input OrganizationHistoryWhereInput { avatarRemoteURLNotNil: Boolean avatarRemoteURLEqualFold: String avatarRemoteURLContainsFold: String + """ + avatar_local_file_id field predicates + """ + avatarLocalFileID: String + avatarLocalFileIDNEQ: String + avatarLocalFileIDIn: [String!] + avatarLocalFileIDNotIn: [String!] + avatarLocalFileIDGT: String + avatarLocalFileIDGTE: String + avatarLocalFileIDLT: String + avatarLocalFileIDLTE: String + avatarLocalFileIDContains: String + avatarLocalFileIDHasPrefix: String + avatarLocalFileIDHasSuffix: String + avatarLocalFileIDIsNil: Boolean + avatarLocalFileIDNotNil: Boolean + avatarLocalFileIDEqualFold: String + avatarLocalFileIDContainsFold: String + """ + avatar_updated_at field predicates + """ + avatarUpdatedAt: Time + avatarUpdatedAtNEQ: Time + avatarUpdatedAtIn: [Time!] + avatarUpdatedAtNotIn: [Time!] + avatarUpdatedAtGT: Time + avatarUpdatedAtGTE: Time + avatarUpdatedAtLT: Time + avatarUpdatedAtLTE: Time + avatarUpdatedAtIsNil: Boolean + avatarUpdatedAtNotNil: Boolean } """ Ordering options for Organization connections @@ -17983,6 +18033,37 @@ input OrganizationWhereInput { avatarRemoteURLEqualFold: String avatarRemoteURLContainsFold: String """ + avatar_local_file_id field predicates + """ + avatarLocalFileID: ID + avatarLocalFileIDNEQ: ID + avatarLocalFileIDIn: [ID!] + avatarLocalFileIDNotIn: [ID!] + avatarLocalFileIDGT: ID + avatarLocalFileIDGTE: ID + avatarLocalFileIDLT: ID + avatarLocalFileIDLTE: ID + avatarLocalFileIDContains: ID + avatarLocalFileIDHasPrefix: ID + avatarLocalFileIDHasSuffix: ID + avatarLocalFileIDIsNil: Boolean + avatarLocalFileIDNotNil: Boolean + avatarLocalFileIDEqualFold: ID + avatarLocalFileIDContainsFold: ID + """ + avatar_updated_at field predicates + """ + avatarUpdatedAt: Time + avatarUpdatedAtNEQ: Time + avatarUpdatedAtIn: [Time!] + avatarUpdatedAtNotIn: [Time!] + avatarUpdatedAtGT: Time + avatarUpdatedAtGTE: Time + avatarUpdatedAtLT: Time + avatarUpdatedAtLTE: Time + avatarUpdatedAtIsNil: Boolean + avatarUpdatedAtNotNil: Boolean + """ control_creators edge predicates """ hasControlCreators: Boolean @@ -18108,6 +18189,11 @@ input OrganizationWhereInput { hasFiles: Boolean hasFilesWith: [FileWhereInput!] """ + avatar_file edge predicates + """ + hasAvatarFile: Boolean + hasAvatarFileWith: [FileWhereInput!] + """ entities edge predicates """ hasEntities: Boolean @@ -29123,6 +29209,11 @@ input UpdateOrganizationInput { """ avatarRemoteURL: String clearAvatarRemoteURL: Boolean + """ + The time the user's (local) avatar was last updated + """ + avatarUpdatedAt: Time + clearAvatarUpdatedAt: Boolean addControlCreatorIDs: [ID!] removeControlCreatorIDs: [ID!] clearControlCreators: Boolean @@ -29191,6 +29282,8 @@ input UpdateOrganizationInput { addFileIDs: [ID!] removeFileIDs: [ID!] clearFiles: Boolean + avatarFileID: ID + clearAvatarFile: Boolean addEntityIDs: [ID!] removeEntityIDs: [ID!] clearEntities: Boolean @@ -29959,11 +30052,6 @@ input UpdateUserInput { avatarRemoteURL: String clearAvatarRemoteURL: Boolean """ - The user's local avatar file - """ - avatarLocalFile: String - clearAvatarLocalFile: Boolean - """ The time the user's (local) avatar was last updated """ avatarUpdatedAt: Time @@ -30017,8 +30105,8 @@ input UpdateUserInput { addFileIDs: [ID!] removeFileIDs: [ID!] clearFiles: Boolean - fileID: ID - clearFile: Boolean + avatarFileID: ID + clearAvatarFile: Boolean addEventIDs: [ID!] removeEventIDs: [ID!] clearEvents: Boolean @@ -30114,11 +30202,7 @@ type User implements Node { """ avatarRemoteURL: String """ - The user's local avatar file - """ - avatarLocalFile: String - """ - The user's local avatar file id + The user's local avatar file id, takes precedence over the avatar remote URL """ avatarLocalFileID: ID """ @@ -30147,7 +30231,7 @@ type User implements Node { groups: [Group!] organizations: [Organization!] files: [File!] - file: File + avatarFile: File events: [Event!] actionPlans: [ActionPlan!] subcontrols: [Subcontrol!] @@ -30251,11 +30335,7 @@ type UserHistory implements Node { """ avatarRemoteURL: String """ - The user's local avatar file - """ - avatarLocalFile: String - """ - The user's local avatar file id + The user's local avatar file id, takes precedence over the avatar remote URL """ avatarLocalFileID: String """ @@ -30592,24 +30672,6 @@ input UserHistoryWhereInput { avatarRemoteURLEqualFold: String avatarRemoteURLContainsFold: String """ - avatar_local_file field predicates - """ - avatarLocalFile: String - avatarLocalFileNEQ: String - avatarLocalFileIn: [String!] - avatarLocalFileNotIn: [String!] - avatarLocalFileGT: String - avatarLocalFileGTE: String - avatarLocalFileLT: String - avatarLocalFileLTE: String - avatarLocalFileContains: String - avatarLocalFileHasPrefix: String - avatarLocalFileHasSuffix: String - avatarLocalFileIsNil: Boolean - avatarLocalFileNotNil: Boolean - avatarLocalFileEqualFold: String - avatarLocalFileContainsFold: String - """ avatar_local_file_id field predicates """ avatarLocalFileID: String @@ -31572,24 +31634,6 @@ input UserWhereInput { avatarRemoteURLEqualFold: String avatarRemoteURLContainsFold: String """ - avatar_local_file field predicates - """ - avatarLocalFile: String - avatarLocalFileNEQ: String - avatarLocalFileIn: [String!] - avatarLocalFileNotIn: [String!] - avatarLocalFileGT: String - avatarLocalFileGTE: String - avatarLocalFileLT: String - avatarLocalFileLTE: String - avatarLocalFileContains: String - avatarLocalFileHasPrefix: String - avatarLocalFileHasSuffix: String - avatarLocalFileIsNil: Boolean - avatarLocalFileNotNil: Boolean - avatarLocalFileEqualFold: String - avatarLocalFileContainsFold: String - """ avatar_local_file_id field predicates """ avatarLocalFileID: ID @@ -31698,10 +31742,10 @@ input UserWhereInput { hasFiles: Boolean hasFilesWith: [FileWhereInput!] """ - file edge predicates + avatar_file edge predicates """ - hasFile: Boolean - hasFileWith: [FileWhereInput!] + hasAvatarFile: Boolean + hasAvatarFileWith: [FileWhereInput!] """ events edge predicates """ diff --git a/internal/graphapi/controlobjective_test.go b/internal/graphapi/controlobjective_test.go index a1f50cf3..6adca855 100644 --- a/internal/graphapi/controlobjective_test.go +++ b/internal/graphapi/controlobjective_test.go @@ -304,7 +304,7 @@ func (suite *GraphTestSuite) TestMutationCreateControlObjective() { _, err := suite.client.api.UpdateOrganization(testUser1.UserCtx, testUser1.OrganizationID, openlaneclient.UpdateOrganizationInput{ AddControlObjectiveCreatorIDs: []string{viewOnlyUser.GroupID}, - }) + }, nil) require.NoError(t, err) } diff --git a/internal/graphapi/generated/actionplan.generated.go b/internal/graphapi/generated/actionplan.generated.go index 3ad1246e..00584bf0 100644 --- a/internal/graphapi/generated/actionplan.generated.go +++ b/internal/graphapi/generated/actionplan.generated.go @@ -104,10 +104,10 @@ type MutationResolver interface { CreateBulkCSVNarrative(ctx context.Context, input graphql.Upload) (*model.NarrativeBulkCreatePayload, error) UpdateNarrative(ctx context.Context, id string, input generated.UpdateNarrativeInput) (*model.NarrativeUpdatePayload, error) DeleteNarrative(ctx context.Context, id string) (*model.NarrativeDeletePayload, error) - CreateOrganization(ctx context.Context, input generated.CreateOrganizationInput) (*model.OrganizationCreatePayload, error) + CreateOrganization(ctx context.Context, input generated.CreateOrganizationInput, avatarFile *graphql.Upload) (*model.OrganizationCreatePayload, error) CreateBulkOrganization(ctx context.Context, input []*generated.CreateOrganizationInput) (*model.OrganizationBulkCreatePayload, error) CreateBulkCSVOrganization(ctx context.Context, input graphql.Upload) (*model.OrganizationBulkCreatePayload, error) - UpdateOrganization(ctx context.Context, id string, input generated.UpdateOrganizationInput) (*model.OrganizationUpdatePayload, error) + UpdateOrganization(ctx context.Context, id string, input generated.UpdateOrganizationInput, avatarFile *graphql.Upload) (*model.OrganizationUpdatePayload, error) DeleteOrganization(ctx context.Context, id string) (*model.OrganizationDeletePayload, error) CreateOrganizationSetting(ctx context.Context, input generated.CreateOrganizationSettingInput) (*model.OrganizationSettingCreatePayload, error) CreateBulkOrganizationSetting(ctx context.Context, input []*generated.CreateOrganizationSettingInput) (*model.OrganizationSettingBulkCreatePayload, error) @@ -2519,6 +2519,11 @@ func (ec *executionContext) field_Mutation_createOrganization_args(ctx context.C return nil, err } args["input"] = arg0 + arg1, err := ec.field_Mutation_createOrganization_argsAvatarFile(ctx, rawArgs) + if err != nil { + return nil, err + } + args["avatarFile"] = arg1 return args, nil } func (ec *executionContext) field_Mutation_createOrganization_argsInput( @@ -2539,6 +2544,24 @@ func (ec *executionContext) field_Mutation_createOrganization_argsInput( return zeroVal, nil } +func (ec *executionContext) field_Mutation_createOrganization_argsAvatarFile( + ctx context.Context, + rawArgs map[string]any, +) (*graphql.Upload, error) { + if _, ok := rawArgs["avatarFile"]; !ok { + var zeroVal *graphql.Upload + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarFile")) + if tmp, ok := rawArgs["avatarFile"]; ok { + return ec.unmarshalOUpload2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx, tmp) + } + + var zeroVal *graphql.Upload + return zeroVal, nil +} + func (ec *executionContext) field_Mutation_createPersonalAccessToken_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -4855,6 +4878,11 @@ func (ec *executionContext) field_Mutation_updateOrganization_args(ctx context.C return nil, err } args["input"] = arg1 + arg2, err := ec.field_Mutation_updateOrganization_argsAvatarFile(ctx, rawArgs) + if err != nil { + return nil, err + } + args["avatarFile"] = arg2 return args, nil } func (ec *executionContext) field_Mutation_updateOrganization_argsID( @@ -4893,6 +4921,24 @@ func (ec *executionContext) field_Mutation_updateOrganization_argsInput( return zeroVal, nil } +func (ec *executionContext) field_Mutation_updateOrganization_argsAvatarFile( + ctx context.Context, + rawArgs map[string]any, +) (*graphql.Upload, error) { + if _, ok := rawArgs["avatarFile"]; !ok { + var zeroVal *graphql.Upload + return zeroVal, nil + } + + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarFile")) + if tmp, ok := rawArgs["avatarFile"]; ok { + return ec.unmarshalOUpload2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx, tmp) + } + + var zeroVal *graphql.Upload + return zeroVal, nil +} + func (ec *executionContext) field_Mutation_updatePersonalAccessToken_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -10951,7 +10997,7 @@ func (ec *executionContext) _Mutation_createOrganization(ctx context.Context, fi }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().CreateOrganization(rctx, fc.Args["input"].(generated.CreateOrganizationInput)) + return ec.resolvers.Mutation().CreateOrganization(rctx, fc.Args["input"].(generated.CreateOrganizationInput), fc.Args["avatarFile"].(*graphql.Upload)) }) if err != nil { ec.Error(ctx, err) @@ -11128,7 +11174,7 @@ func (ec *executionContext) _Mutation_updateOrganization(ctx context.Context, fi }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return ec.resolvers.Mutation().UpdateOrganization(rctx, fc.Args["id"].(string), fc.Args["input"].(generated.UpdateOrganizationInput)) + return ec.resolvers.Mutation().UpdateOrganization(rctx, fc.Args["id"].(string), fc.Args["input"].(generated.UpdateOrganizationInput), fc.Args["avatarFile"].(*graphql.Upload)) }) if err != nil { ec.Error(ctx, err) diff --git a/internal/graphapi/generated/ent.generated.go b/internal/graphapi/generated/ent.generated.go index 623bd05f..365a7e0f 100644 --- a/internal/graphapi/generated/ent.generated.go +++ b/internal/graphapi/generated/ent.generated.go @@ -12391,6 +12391,10 @@ func (ec *executionContext) fieldContext_APIToken_owner(_ context.Context, field return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -12443,6 +12447,8 @@ func (ec *executionContext) fieldContext_APIToken_owner(_ context.Context, field return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -13722,8 +13728,6 @@ func (ec *executionContext) fieldContext_ActionPlan_user(_ context.Context, fiel return ec.fieldContext_User_displayName(ctx, field) case "avatarRemoteURL": return ec.fieldContext_User_avatarRemoteURL(ctx, field) - case "avatarLocalFile": - return ec.fieldContext_User_avatarLocalFile(ctx, field) case "avatarLocalFileID": return ec.fieldContext_User_avatarLocalFileID(ctx, field) case "avatarUpdatedAt": @@ -13748,8 +13752,8 @@ func (ec *executionContext) fieldContext_ActionPlan_user(_ context.Context, fiel return ec.fieldContext_User_organizations(ctx, field) case "files": return ec.fieldContext_User_files(ctx, field) - case "file": - return ec.fieldContext_User_file(ctx, field) + case "avatarFile": + return ec.fieldContext_User_avatarFile(ctx, field) case "events": return ec.fieldContext_User_events(ctx, field) case "actionPlans": @@ -15905,6 +15909,10 @@ func (ec *executionContext) fieldContext_Contact_owner(_ context.Context, field return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -15957,6 +15965,8 @@ func (ec *executionContext) fieldContext_Contact_owner(_ context.Context, field return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -16177,6 +16187,8 @@ func (ec *executionContext) fieldContext_Contact_files(_ context.Context, field return ec.fieldContext_File_events(ctx, field) case "program": return ec.fieldContext_File_program(ctx, field) + case "presignedURL": + return ec.fieldContext_File_presignedURL(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type File", field.Name) }, @@ -18453,6 +18465,10 @@ func (ec *executionContext) fieldContext_Control_owner(_ context.Context, field return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -18505,6 +18521,8 @@ func (ec *executionContext) fieldContext_Control_owner(_ context.Context, field return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -22313,6 +22331,10 @@ func (ec *executionContext) fieldContext_ControlObjective_owner(_ context.Contex return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -22365,6 +22387,8 @@ func (ec *executionContext) fieldContext_ControlObjective_owner(_ context.Contex return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -25770,6 +25794,10 @@ func (ec *executionContext) fieldContext_DocumentData_owner(_ context.Context, f return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -25822,6 +25850,8 @@ func (ec *executionContext) fieldContext_DocumentData_owner(_ context.Context, f return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -26122,6 +26152,8 @@ func (ec *executionContext) fieldContext_DocumentData_files(_ context.Context, f return ec.fieldContext_File_events(ctx, field) case "program": return ec.fieldContext_File_program(ctx, field) + case "presignedURL": + return ec.fieldContext_File_presignedURL(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type File", field.Name) }, @@ -27920,6 +27952,10 @@ func (ec *executionContext) fieldContext_Entity_owner(_ context.Context, field g return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -27972,6 +28008,8 @@ func (ec *executionContext) fieldContext_Entity_owner(_ context.Context, field g return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -28332,6 +28370,8 @@ func (ec *executionContext) fieldContext_Entity_files(_ context.Context, field g return ec.fieldContext_File_events(ctx, field) case "program": return ec.fieldContext_File_program(ctx, field) + case "presignedURL": + return ec.fieldContext_File_presignedURL(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type File", field.Name) }, @@ -30173,6 +30213,10 @@ func (ec *executionContext) fieldContext_EntityType_owner(_ context.Context, fie return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -30225,6 +30269,8 @@ func (ec *executionContext) fieldContext_EntityType_owner(_ context.Context, fie return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -31882,8 +31928,6 @@ func (ec *executionContext) fieldContext_Event_user(_ context.Context, field gra return ec.fieldContext_User_displayName(ctx, field) case "avatarRemoteURL": return ec.fieldContext_User_avatarRemoteURL(ctx, field) - case "avatarLocalFile": - return ec.fieldContext_User_avatarLocalFile(ctx, field) case "avatarLocalFileID": return ec.fieldContext_User_avatarLocalFileID(ctx, field) case "avatarUpdatedAt": @@ -31908,8 +31952,8 @@ func (ec *executionContext) fieldContext_Event_user(_ context.Context, field gra return ec.fieldContext_User_organizations(ctx, field) case "files": return ec.fieldContext_User_files(ctx, field) - case "file": - return ec.fieldContext_User_file(ctx, field) + case "avatarFile": + return ec.fieldContext_User_avatarFile(ctx, field) case "events": return ec.fieldContext_User_events(ctx, field) case "actionPlans": @@ -32213,6 +32257,10 @@ func (ec *executionContext) fieldContext_Event_organization(_ context.Context, f return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -32265,6 +32313,8 @@ func (ec *executionContext) fieldContext_Event_organization(_ context.Context, f return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -32836,6 +32886,8 @@ func (ec *executionContext) fieldContext_Event_file(_ context.Context, field gra return ec.fieldContext_File_events(ctx, field) case "program": return ec.fieldContext_File_program(ctx, field) + case "presignedURL": + return ec.fieldContext_File_presignedURL(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type File", field.Name) }, @@ -34855,8 +34907,6 @@ func (ec *executionContext) fieldContext_File_user(_ context.Context, field grap return ec.fieldContext_User_displayName(ctx, field) case "avatarRemoteURL": return ec.fieldContext_User_avatarRemoteURL(ctx, field) - case "avatarLocalFile": - return ec.fieldContext_User_avatarLocalFile(ctx, field) case "avatarLocalFileID": return ec.fieldContext_User_avatarLocalFileID(ctx, field) case "avatarUpdatedAt": @@ -34881,8 +34931,8 @@ func (ec *executionContext) fieldContext_File_user(_ context.Context, field grap return ec.fieldContext_User_organizations(ctx, field) case "files": return ec.fieldContext_User_files(ctx, field) - case "file": - return ec.fieldContext_User_file(ctx, field) + case "avatarFile": + return ec.fieldContext_User_avatarFile(ctx, field) case "events": return ec.fieldContext_User_events(ctx, field) case "actionPlans": @@ -34970,6 +35020,10 @@ func (ec *executionContext) fieldContext_File_organization(_ context.Context, fi return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -35022,6 +35076,8 @@ func (ec *executionContext) fieldContext_File_organization(_ context.Context, fi return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -35876,6 +35932,47 @@ func (ec *executionContext) fieldContext_File_program(_ context.Context, field g return fc, nil } +func (ec *executionContext) _File_presignedURL(ctx context.Context, field graphql.CollectedField, obj *generated.File) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_File_presignedURL(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.PresignedURL, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalOString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_File_presignedURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "File", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _FileConnection_edges(ctx context.Context, field graphql.CollectedField, obj *generated.FileConnection) (ret graphql.Marshaler) { fc, err := ec.fieldContext_FileConnection_edges(ctx, field) if err != nil { @@ -36121,6 +36218,8 @@ func (ec *executionContext) fieldContext_FileEdge_node(_ context.Context, field return ec.fieldContext_File_events(ctx, field) case "program": return ec.fieldContext_File_program(ctx, field) + case "presignedURL": + return ec.fieldContext_File_presignedURL(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type File", field.Name) }, @@ -38099,6 +38198,10 @@ func (ec *executionContext) fieldContext_Group_owner(_ context.Context, field gr return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -38151,6 +38254,8 @@ func (ec *executionContext) fieldContext_Group_owner(_ context.Context, field gr return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -38248,6 +38353,10 @@ func (ec *executionContext) fieldContext_Group_controlCreators(_ context.Context return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -38300,6 +38409,8 @@ func (ec *executionContext) fieldContext_Group_controlCreators(_ context.Context return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -38397,6 +38508,10 @@ func (ec *executionContext) fieldContext_Group_controlObjectiveCreators(_ contex return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -38449,6 +38564,8 @@ func (ec *executionContext) fieldContext_Group_controlObjectiveCreators(_ contex return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -38546,6 +38663,10 @@ func (ec *executionContext) fieldContext_Group_groupCreators(_ context.Context, return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -38598,6 +38719,8 @@ func (ec *executionContext) fieldContext_Group_groupCreators(_ context.Context, return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -38695,6 +38818,10 @@ func (ec *executionContext) fieldContext_Group_internalPolicyCreators(_ context. return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -38747,6 +38874,8 @@ func (ec *executionContext) fieldContext_Group_internalPolicyCreators(_ context. return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -38844,6 +38973,10 @@ func (ec *executionContext) fieldContext_Group_narrativeCreators(_ context.Conte return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -38896,6 +39029,8 @@ func (ec *executionContext) fieldContext_Group_narrativeCreators(_ context.Conte return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -38993,6 +39128,10 @@ func (ec *executionContext) fieldContext_Group_procedureCreators(_ context.Conte return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -39045,6 +39184,8 @@ func (ec *executionContext) fieldContext_Group_procedureCreators(_ context.Conte return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -39142,6 +39283,10 @@ func (ec *executionContext) fieldContext_Group_programCreators(_ context.Context return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -39194,6 +39339,8 @@ func (ec *executionContext) fieldContext_Group_programCreators(_ context.Context return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -39291,6 +39438,10 @@ func (ec *executionContext) fieldContext_Group_riskCreators(_ context.Context, f return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -39343,6 +39494,8 @@ func (ec *executionContext) fieldContext_Group_riskCreators(_ context.Context, f return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -39440,6 +39593,10 @@ func (ec *executionContext) fieldContext_Group_templateCreators(_ context.Contex return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -39492,6 +39649,8 @@ func (ec *executionContext) fieldContext_Group_templateCreators(_ context.Contex return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -41598,8 +41757,6 @@ func (ec *executionContext) fieldContext_Group_users(_ context.Context, field gr return ec.fieldContext_User_displayName(ctx, field) case "avatarRemoteURL": return ec.fieldContext_User_avatarRemoteURL(ctx, field) - case "avatarLocalFile": - return ec.fieldContext_User_avatarLocalFile(ctx, field) case "avatarLocalFileID": return ec.fieldContext_User_avatarLocalFileID(ctx, field) case "avatarUpdatedAt": @@ -41624,8 +41781,8 @@ func (ec *executionContext) fieldContext_Group_users(_ context.Context, field gr return ec.fieldContext_User_organizations(ctx, field) case "files": return ec.fieldContext_User_files(ctx, field) - case "file": - return ec.fieldContext_User_file(ctx, field) + case "avatarFile": + return ec.fieldContext_User_avatarFile(ctx, field) case "events": return ec.fieldContext_User_events(ctx, field) case "actionPlans": @@ -41909,6 +42066,8 @@ func (ec *executionContext) fieldContext_Group_files(_ context.Context, field gr return ec.fieldContext_File_events(ctx, field) case "program": return ec.fieldContext_File_program(ctx, field) + case "presignedURL": + return ec.fieldContext_File_presignedURL(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type File", field.Name) }, @@ -44019,8 +44178,6 @@ func (ec *executionContext) fieldContext_GroupMembership_user(_ context.Context, return ec.fieldContext_User_displayName(ctx, field) case "avatarRemoteURL": return ec.fieldContext_User_avatarRemoteURL(ctx, field) - case "avatarLocalFile": - return ec.fieldContext_User_avatarLocalFile(ctx, field) case "avatarLocalFileID": return ec.fieldContext_User_avatarLocalFileID(ctx, field) case "avatarUpdatedAt": @@ -44045,8 +44202,8 @@ func (ec *executionContext) fieldContext_GroupMembership_user(_ context.Context, return ec.fieldContext_User_organizations(ctx, field) case "files": return ec.fieldContext_User_files(ctx, field) - case "file": - return ec.fieldContext_User_file(ctx, field) + case "avatarFile": + return ec.fieldContext_User_avatarFile(ctx, field) case "events": return ec.fieldContext_User_events(ctx, field) case "actionPlans": @@ -47696,6 +47853,10 @@ func (ec *executionContext) fieldContext_Hush_organization(_ context.Context, fi return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -47748,6 +47909,8 @@ func (ec *executionContext) fieldContext_Hush_organization(_ context.Context, fi return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -49534,6 +49697,10 @@ func (ec *executionContext) fieldContext_Integration_owner(_ context.Context, fi return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -49586,6 +49753,8 @@ func (ec *executionContext) fieldContext_Integration_owner(_ context.Context, fi return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -51693,6 +51862,10 @@ func (ec *executionContext) fieldContext_InternalPolicy_owner(_ context.Context, return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -51745,6 +51918,8 @@ func (ec *executionContext) fieldContext_InternalPolicy_owner(_ context.Context, return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -54713,6 +54888,10 @@ func (ec *executionContext) fieldContext_Invite_owner(_ context.Context, field g return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -54765,6 +54944,8 @@ func (ec *executionContext) fieldContext_Invite_owner(_ context.Context, field g return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -55756,6 +55937,10 @@ func (ec *executionContext) fieldContext_Narrative_owner(_ context.Context, fiel return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -55808,6 +55993,8 @@ func (ec *executionContext) fieldContext_Narrative_owner(_ context.Context, fiel return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -58486,6 +58673,10 @@ func (ec *executionContext) fieldContext_Note_owner(_ context.Context, field gra return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -58538,6 +58729,8 @@ func (ec *executionContext) fieldContext_Note_owner(_ context.Context, field gra return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -60426,6 +60619,10 @@ func (ec *executionContext) fieldContext_OrgMembership_organization(_ context.Co return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -60478,6 +60675,8 @@ func (ec *executionContext) fieldContext_OrgMembership_organization(_ context.Co return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -60578,8 +60777,6 @@ func (ec *executionContext) fieldContext_OrgMembership_user(_ context.Context, f return ec.fieldContext_User_displayName(ctx, field) case "avatarRemoteURL": return ec.fieldContext_User_avatarRemoteURL(ctx, field) - case "avatarLocalFile": - return ec.fieldContext_User_avatarLocalFile(ctx, field) case "avatarLocalFileID": return ec.fieldContext_User_avatarLocalFileID(ctx, field) case "avatarUpdatedAt": @@ -60604,8 +60801,8 @@ func (ec *executionContext) fieldContext_OrgMembership_user(_ context.Context, f return ec.fieldContext_User_organizations(ctx, field) case "files": return ec.fieldContext_User_files(ctx, field) - case "file": - return ec.fieldContext_User_file(ctx, field) + case "avatarFile": + return ec.fieldContext_User_avatarFile(ctx, field) case "events": return ec.fieldContext_User_events(ctx, field) case "actionPlans": @@ -62630,6 +62827,10 @@ func (ec *executionContext) fieldContext_OrgSubscription_owner(_ context.Context return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -62682,6 +62883,8 @@ func (ec *executionContext) fieldContext_OrgSubscription_owner(_ context.Context return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -64764,8 +64967,8 @@ func (ec *executionContext) fieldContext_Organization_avatarRemoteURL(_ context. return fc, nil } -func (ec *executionContext) _Organization_dedicatedDb(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Organization_dedicatedDb(ctx, field) +func (ec *executionContext) _Organization_avatarLocalFileID(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Organization_avatarLocalFileID(ctx, field) if err != nil { return graphql.Null } @@ -64778,38 +64981,76 @@ func (ec *executionContext) _Organization_dedicatedDb(ctx context.Context, field }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.DedicatedDb, nil + return obj.AvatarLocalFileID, 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.(*string) + fc.Result = res + return ec.marshalOID2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Organization_avatarLocalFileID(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Organization", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Organization_avatarUpdatedAt(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Organization_avatarUpdatedAt(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.AvatarUpdatedAt, nil + }) + if err != nil { + ec.Error(ctx, err) return graphql.Null } - res := resTmp.(bool) + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*time.Time) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalOTime2ᚖtimeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Organization_dedicatedDb(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Organization_avatarUpdatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Organization", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + return nil, errors.New("field of type Time does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Organization_controlCreators(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Organization_controlCreators(ctx, field) +func (ec *executionContext) _Organization_dedicatedDb(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Organization_dedicatedDb(ctx, field) if err != nil { return graphql.Null } @@ -64822,137 +65063,38 @@ func (ec *executionContext) _Organization_controlCreators(ctx context.Context, f }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.ControlCreators(ctx) + return obj.DedicatedDb, 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.([]*generated.Group) + res := resTmp.(bool) fc.Result = res - return ec.marshalOGroup2ᚕᚖgithubᚗcomᚋtheopenlaneᚋcoreᚋinternalᚋentᚋgeneratedᚐGroupᚄ(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Organization_controlCreators(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Organization_dedicatedDb(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Organization", Field: field, - IsMethod: true, + IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Group_id(ctx, field) - case "createdAt": - return ec.fieldContext_Group_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Group_updatedAt(ctx, field) - case "createdBy": - return ec.fieldContext_Group_createdBy(ctx, field) - case "updatedBy": - return ec.fieldContext_Group_updatedBy(ctx, field) - case "deletedAt": - return ec.fieldContext_Group_deletedAt(ctx, field) - case "deletedBy": - return ec.fieldContext_Group_deletedBy(ctx, field) - case "tags": - return ec.fieldContext_Group_tags(ctx, field) - case "ownerID": - return ec.fieldContext_Group_ownerID(ctx, field) - case "name": - return ec.fieldContext_Group_name(ctx, field) - case "description": - return ec.fieldContext_Group_description(ctx, field) - case "gravatarLogoURL": - return ec.fieldContext_Group_gravatarLogoURL(ctx, field) - case "logoURL": - return ec.fieldContext_Group_logoURL(ctx, field) - case "displayName": - return ec.fieldContext_Group_displayName(ctx, field) - case "owner": - return ec.fieldContext_Group_owner(ctx, field) - case "controlCreators": - return ec.fieldContext_Group_controlCreators(ctx, field) - case "controlObjectiveCreators": - return ec.fieldContext_Group_controlObjectiveCreators(ctx, field) - case "groupCreators": - return ec.fieldContext_Group_groupCreators(ctx, field) - case "internalPolicyCreators": - return ec.fieldContext_Group_internalPolicyCreators(ctx, field) - case "narrativeCreators": - return ec.fieldContext_Group_narrativeCreators(ctx, field) - case "procedureCreators": - return ec.fieldContext_Group_procedureCreators(ctx, field) - case "programCreators": - return ec.fieldContext_Group_programCreators(ctx, field) - case "riskCreators": - return ec.fieldContext_Group_riskCreators(ctx, field) - case "templateCreators": - return ec.fieldContext_Group_templateCreators(ctx, field) - case "procedureEditors": - return ec.fieldContext_Group_procedureEditors(ctx, field) - case "procedureBlockedGroups": - return ec.fieldContext_Group_procedureBlockedGroups(ctx, field) - case "internalPolicyEditors": - return ec.fieldContext_Group_internalPolicyEditors(ctx, field) - case "internalPolicyBlockedGroups": - return ec.fieldContext_Group_internalPolicyBlockedGroups(ctx, field) - case "programEditors": - return ec.fieldContext_Group_programEditors(ctx, field) - case "programBlockedGroups": - return ec.fieldContext_Group_programBlockedGroups(ctx, field) - case "programViewers": - return ec.fieldContext_Group_programViewers(ctx, field) - case "riskEditors": - return ec.fieldContext_Group_riskEditors(ctx, field) - case "riskBlockedGroups": - return ec.fieldContext_Group_riskBlockedGroups(ctx, field) - case "riskViewers": - return ec.fieldContext_Group_riskViewers(ctx, field) - case "controlObjectiveEditors": - return ec.fieldContext_Group_controlObjectiveEditors(ctx, field) - case "controlObjectiveBlockedGroups": - return ec.fieldContext_Group_controlObjectiveBlockedGroups(ctx, field) - case "controlObjectiveViewers": - return ec.fieldContext_Group_controlObjectiveViewers(ctx, field) - case "controlEditors": - return ec.fieldContext_Group_controlEditors(ctx, field) - case "controlBlockedGroups": - return ec.fieldContext_Group_controlBlockedGroups(ctx, field) - case "controlViewers": - return ec.fieldContext_Group_controlViewers(ctx, field) - case "narrativeEditors": - return ec.fieldContext_Group_narrativeEditors(ctx, field) - case "narrativeBlockedGroups": - return ec.fieldContext_Group_narrativeBlockedGroups(ctx, field) - case "narrativeViewers": - return ec.fieldContext_Group_narrativeViewers(ctx, field) - case "setting": - return ec.fieldContext_Group_setting(ctx, field) - case "users": - return ec.fieldContext_Group_users(ctx, field) - case "events": - return ec.fieldContext_Group_events(ctx, field) - case "integrations": - return ec.fieldContext_Group_integrations(ctx, field) - case "files": - return ec.fieldContext_Group_files(ctx, field) - case "tasks": - return ec.fieldContext_Group_tasks(ctx, field) - case "members": - return ec.fieldContext_Group_members(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Group", field.Name) + return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } -func (ec *executionContext) _Organization_controlObjectiveCreators(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Organization_controlObjectiveCreators(ctx, field) +func (ec *executionContext) _Organization_controlCreators(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Organization_controlCreators(ctx, field) if err != nil { return graphql.Null } @@ -64965,7 +65107,7 @@ func (ec *executionContext) _Organization_controlObjectiveCreators(ctx context.C }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.ControlObjectiveCreators(ctx) + return obj.ControlCreators(ctx) }) if err != nil { ec.Error(ctx, err) @@ -64979,7 +65121,7 @@ func (ec *executionContext) _Organization_controlObjectiveCreators(ctx context.C return ec.marshalOGroup2ᚕᚖgithubᚗcomᚋtheopenlaneᚋcoreᚋinternalᚋentᚋgeneratedᚐGroupᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Organization_controlObjectiveCreators(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Organization_controlCreators(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Organization", Field: field, @@ -65094,8 +65236,8 @@ func (ec *executionContext) fieldContext_Organization_controlObjectiveCreators(_ return fc, nil } -func (ec *executionContext) _Organization_groupCreators(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Organization_groupCreators(ctx, field) +func (ec *executionContext) _Organization_controlObjectiveCreators(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Organization_controlObjectiveCreators(ctx, field) if err != nil { return graphql.Null } @@ -65108,7 +65250,7 @@ func (ec *executionContext) _Organization_groupCreators(ctx context.Context, fie }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.GroupCreators(ctx) + return obj.ControlObjectiveCreators(ctx) }) if err != nil { ec.Error(ctx, err) @@ -65122,7 +65264,7 @@ func (ec *executionContext) _Organization_groupCreators(ctx context.Context, fie return ec.marshalOGroup2ᚕᚖgithubᚗcomᚋtheopenlaneᚋcoreᚋinternalᚋentᚋgeneratedᚐGroupᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Organization_groupCreators(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Organization_controlObjectiveCreators(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Organization", Field: field, @@ -65237,8 +65379,8 @@ func (ec *executionContext) fieldContext_Organization_groupCreators(_ context.Co return fc, nil } -func (ec *executionContext) _Organization_internalPolicyCreators(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Organization_internalPolicyCreators(ctx, field) +func (ec *executionContext) _Organization_groupCreators(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Organization_groupCreators(ctx, field) if err != nil { return graphql.Null } @@ -65251,7 +65393,7 @@ func (ec *executionContext) _Organization_internalPolicyCreators(ctx context.Con }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.InternalPolicyCreators(ctx) + return obj.GroupCreators(ctx) }) if err != nil { ec.Error(ctx, err) @@ -65265,7 +65407,7 @@ func (ec *executionContext) _Organization_internalPolicyCreators(ctx context.Con return ec.marshalOGroup2ᚕᚖgithubᚗcomᚋtheopenlaneᚋcoreᚋinternalᚋentᚋgeneratedᚐGroupᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Organization_internalPolicyCreators(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Organization_groupCreators(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Organization", Field: field, @@ -65380,8 +65522,8 @@ func (ec *executionContext) fieldContext_Organization_internalPolicyCreators(_ c return fc, nil } -func (ec *executionContext) _Organization_narrativeCreators(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Organization_narrativeCreators(ctx, field) +func (ec *executionContext) _Organization_internalPolicyCreators(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Organization_internalPolicyCreators(ctx, field) if err != nil { return graphql.Null } @@ -65394,7 +65536,7 @@ func (ec *executionContext) _Organization_narrativeCreators(ctx context.Context, }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.NarrativeCreators(ctx) + return obj.InternalPolicyCreators(ctx) }) if err != nil { ec.Error(ctx, err) @@ -65408,7 +65550,7 @@ func (ec *executionContext) _Organization_narrativeCreators(ctx context.Context, return ec.marshalOGroup2ᚕᚖgithubᚗcomᚋtheopenlaneᚋcoreᚋinternalᚋentᚋgeneratedᚐGroupᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Organization_narrativeCreators(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Organization_internalPolicyCreators(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Organization", Field: field, @@ -65523,8 +65665,8 @@ func (ec *executionContext) fieldContext_Organization_narrativeCreators(_ contex return fc, nil } -func (ec *executionContext) _Organization_procedureCreators(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Organization_procedureCreators(ctx, field) +func (ec *executionContext) _Organization_narrativeCreators(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Organization_narrativeCreators(ctx, field) if err != nil { return graphql.Null } @@ -65537,7 +65679,7 @@ func (ec *executionContext) _Organization_procedureCreators(ctx context.Context, }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.ProcedureCreators(ctx) + return obj.NarrativeCreators(ctx) }) if err != nil { ec.Error(ctx, err) @@ -65551,7 +65693,7 @@ func (ec *executionContext) _Organization_procedureCreators(ctx context.Context, return ec.marshalOGroup2ᚕᚖgithubᚗcomᚋtheopenlaneᚋcoreᚋinternalᚋentᚋgeneratedᚐGroupᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Organization_procedureCreators(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Organization_narrativeCreators(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Organization", Field: field, @@ -65666,8 +65808,8 @@ func (ec *executionContext) fieldContext_Organization_procedureCreators(_ contex return fc, nil } -func (ec *executionContext) _Organization_programCreators(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Organization_programCreators(ctx, field) +func (ec *executionContext) _Organization_procedureCreators(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Organization_procedureCreators(ctx, field) if err != nil { return graphql.Null } @@ -65680,7 +65822,7 @@ func (ec *executionContext) _Organization_programCreators(ctx context.Context, f }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.ProgramCreators(ctx) + return obj.ProcedureCreators(ctx) }) if err != nil { ec.Error(ctx, err) @@ -65694,7 +65836,7 @@ func (ec *executionContext) _Organization_programCreators(ctx context.Context, f return ec.marshalOGroup2ᚕᚖgithubᚗcomᚋtheopenlaneᚋcoreᚋinternalᚋentᚋgeneratedᚐGroupᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Organization_programCreators(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Organization_procedureCreators(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Organization", Field: field, @@ -65809,8 +65951,8 @@ func (ec *executionContext) fieldContext_Organization_programCreators(_ context. return fc, nil } -func (ec *executionContext) _Organization_riskCreators(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Organization_riskCreators(ctx, field) +func (ec *executionContext) _Organization_programCreators(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Organization_programCreators(ctx, field) if err != nil { return graphql.Null } @@ -65823,7 +65965,7 @@ func (ec *executionContext) _Organization_riskCreators(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.RiskCreators(ctx) + return obj.ProgramCreators(ctx) }) if err != nil { ec.Error(ctx, err) @@ -65837,7 +65979,7 @@ func (ec *executionContext) _Organization_riskCreators(ctx context.Context, fiel return ec.marshalOGroup2ᚕᚖgithubᚗcomᚋtheopenlaneᚋcoreᚋinternalᚋentᚋgeneratedᚐGroupᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Organization_riskCreators(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Organization_programCreators(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Organization", Field: field, @@ -65952,8 +66094,8 @@ func (ec *executionContext) fieldContext_Organization_riskCreators(_ context.Con return fc, nil } -func (ec *executionContext) _Organization_templateCreators(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Organization_templateCreators(ctx, field) +func (ec *executionContext) _Organization_riskCreators(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Organization_riskCreators(ctx, field) if err != nil { return graphql.Null } @@ -65966,7 +66108,7 @@ func (ec *executionContext) _Organization_templateCreators(ctx context.Context, }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.TemplateCreators(ctx) + return obj.RiskCreators(ctx) }) if err != nil { ec.Error(ctx, err) @@ -65980,7 +66122,7 @@ func (ec *executionContext) _Organization_templateCreators(ctx context.Context, return ec.marshalOGroup2ᚕᚖgithubᚗcomᚋtheopenlaneᚋcoreᚋinternalᚋentᚋgeneratedᚐGroupᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Organization_templateCreators(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Organization_riskCreators(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Organization", Field: field, @@ -66095,220 +66237,8 @@ func (ec *executionContext) fieldContext_Organization_templateCreators(_ context return fc, nil } -func (ec *executionContext) _Organization_parent(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Organization_parent(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.Parent(ctx) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*generated.Organization) - fc.Result = res - return ec.marshalOOrganization2ᚖgithubᚗcomᚋtheopenlaneᚋcoreᚋinternalᚋentᚋgeneratedᚐOrganization(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Organization_parent(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Organization", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "id": - return ec.fieldContext_Organization_id(ctx, field) - case "createdAt": - return ec.fieldContext_Organization_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Organization_updatedAt(ctx, field) - case "createdBy": - return ec.fieldContext_Organization_createdBy(ctx, field) - case "updatedBy": - return ec.fieldContext_Organization_updatedBy(ctx, field) - case "tags": - return ec.fieldContext_Organization_tags(ctx, field) - case "deletedAt": - return ec.fieldContext_Organization_deletedAt(ctx, field) - case "deletedBy": - return ec.fieldContext_Organization_deletedBy(ctx, field) - case "name": - return ec.fieldContext_Organization_name(ctx, field) - case "displayName": - return ec.fieldContext_Organization_displayName(ctx, field) - case "description": - return ec.fieldContext_Organization_description(ctx, field) - case "personalOrg": - return ec.fieldContext_Organization_personalOrg(ctx, field) - case "avatarRemoteURL": - return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) - case "dedicatedDb": - return ec.fieldContext_Organization_dedicatedDb(ctx, field) - case "controlCreators": - return ec.fieldContext_Organization_controlCreators(ctx, field) - case "controlObjectiveCreators": - return ec.fieldContext_Organization_controlObjectiveCreators(ctx, field) - case "groupCreators": - return ec.fieldContext_Organization_groupCreators(ctx, field) - case "internalPolicyCreators": - return ec.fieldContext_Organization_internalPolicyCreators(ctx, field) - case "narrativeCreators": - return ec.fieldContext_Organization_narrativeCreators(ctx, field) - case "procedureCreators": - return ec.fieldContext_Organization_procedureCreators(ctx, field) - case "programCreators": - return ec.fieldContext_Organization_programCreators(ctx, field) - case "riskCreators": - return ec.fieldContext_Organization_riskCreators(ctx, field) - case "templateCreators": - return ec.fieldContext_Organization_templateCreators(ctx, field) - case "parent": - return ec.fieldContext_Organization_parent(ctx, field) - case "children": - return ec.fieldContext_Organization_children(ctx, field) - case "groups": - return ec.fieldContext_Organization_groups(ctx, field) - case "templates": - return ec.fieldContext_Organization_templates(ctx, field) - case "integrations": - return ec.fieldContext_Organization_integrations(ctx, field) - case "setting": - return ec.fieldContext_Organization_setting(ctx, field) - case "documentData": - return ec.fieldContext_Organization_documentData(ctx, field) - case "orgSubscriptions": - return ec.fieldContext_Organization_orgSubscriptions(ctx, field) - case "personalAccessTokens": - return ec.fieldContext_Organization_personalAccessTokens(ctx, field) - case "apiTokens": - return ec.fieldContext_Organization_apiTokens(ctx, field) - case "users": - return ec.fieldContext_Organization_users(ctx, field) - case "invites": - return ec.fieldContext_Organization_invites(ctx, field) - case "subscribers": - return ec.fieldContext_Organization_subscribers(ctx, field) - case "events": - return ec.fieldContext_Organization_events(ctx, field) - case "secrets": - return ec.fieldContext_Organization_secrets(ctx, field) - case "files": - return ec.fieldContext_Organization_files(ctx, field) - case "entities": - return ec.fieldContext_Organization_entities(ctx, field) - case "entityTypes": - return ec.fieldContext_Organization_entityTypes(ctx, field) - case "contacts": - return ec.fieldContext_Organization_contacts(ctx, field) - case "notes": - return ec.fieldContext_Organization_notes(ctx, field) - case "tasks": - return ec.fieldContext_Organization_tasks(ctx, field) - case "programs": - return ec.fieldContext_Organization_programs(ctx, field) - case "procedures": - return ec.fieldContext_Organization_procedures(ctx, field) - case "internalPolicies": - return ec.fieldContext_Organization_internalPolicies(ctx, field) - case "risks": - return ec.fieldContext_Organization_risks(ctx, field) - case "controlObjectives": - return ec.fieldContext_Organization_controlObjectives(ctx, field) - case "narratives": - return ec.fieldContext_Organization_narratives(ctx, field) - case "controls": - return ec.fieldContext_Organization_controls(ctx, field) - case "subcontrols": - return ec.fieldContext_Organization_subcontrols(ctx, field) - case "members": - return ec.fieldContext_Organization_members(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type Organization", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) _Organization_children(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Organization_children(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.Children(ctx, fc.Args["after"].(*entgql.Cursor[string]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[string]), fc.Args["last"].(*int), fc.Args["orderBy"].(*generated.OrganizationOrder), fc.Args["where"].(*generated.OrganizationWhereInput)) - }) - 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.(*generated.OrganizationConnection) - fc.Result = res - return ec.marshalNOrganizationConnection2ᚖgithubᚗcomᚋtheopenlaneᚋcoreᚋinternalᚋentᚋgeneratedᚐOrganizationConnection(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Organization_children(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Organization", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "edges": - return ec.fieldContext_OrganizationConnection_edges(ctx, field) - case "pageInfo": - return ec.fieldContext_OrganizationConnection_pageInfo(ctx, field) - case "totalCount": - return ec.fieldContext_OrganizationConnection_totalCount(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type OrganizationConnection", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Organization_children_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - -func (ec *executionContext) _Organization_groups(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Organization_groups(ctx, field) +func (ec *executionContext) _Organization_templateCreators(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Organization_templateCreators(ctx, field) if err != nil { return graphql.Null } @@ -66321,7 +66251,7 @@ func (ec *executionContext) _Organization_groups(ctx context.Context, field grap }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.Groups(ctx) + return obj.TemplateCreators(ctx) }) if err != nil { ec.Error(ctx, err) @@ -66335,7 +66265,368 @@ func (ec *executionContext) _Organization_groups(ctx context.Context, field grap return ec.marshalOGroup2ᚕᚖgithubᚗcomᚋtheopenlaneᚋcoreᚋinternalᚋentᚋgeneratedᚐGroupᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_Organization_groups(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_Organization_templateCreators(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Organization", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Group_id(ctx, field) + case "createdAt": + return ec.fieldContext_Group_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Group_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_Group_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_Group_updatedBy(ctx, field) + case "deletedAt": + return ec.fieldContext_Group_deletedAt(ctx, field) + case "deletedBy": + return ec.fieldContext_Group_deletedBy(ctx, field) + case "tags": + return ec.fieldContext_Group_tags(ctx, field) + case "ownerID": + return ec.fieldContext_Group_ownerID(ctx, field) + case "name": + return ec.fieldContext_Group_name(ctx, field) + case "description": + return ec.fieldContext_Group_description(ctx, field) + case "gravatarLogoURL": + return ec.fieldContext_Group_gravatarLogoURL(ctx, field) + case "logoURL": + return ec.fieldContext_Group_logoURL(ctx, field) + case "displayName": + return ec.fieldContext_Group_displayName(ctx, field) + case "owner": + return ec.fieldContext_Group_owner(ctx, field) + case "controlCreators": + return ec.fieldContext_Group_controlCreators(ctx, field) + case "controlObjectiveCreators": + return ec.fieldContext_Group_controlObjectiveCreators(ctx, field) + case "groupCreators": + return ec.fieldContext_Group_groupCreators(ctx, field) + case "internalPolicyCreators": + return ec.fieldContext_Group_internalPolicyCreators(ctx, field) + case "narrativeCreators": + return ec.fieldContext_Group_narrativeCreators(ctx, field) + case "procedureCreators": + return ec.fieldContext_Group_procedureCreators(ctx, field) + case "programCreators": + return ec.fieldContext_Group_programCreators(ctx, field) + case "riskCreators": + return ec.fieldContext_Group_riskCreators(ctx, field) + case "templateCreators": + return ec.fieldContext_Group_templateCreators(ctx, field) + case "procedureEditors": + return ec.fieldContext_Group_procedureEditors(ctx, field) + case "procedureBlockedGroups": + return ec.fieldContext_Group_procedureBlockedGroups(ctx, field) + case "internalPolicyEditors": + return ec.fieldContext_Group_internalPolicyEditors(ctx, field) + case "internalPolicyBlockedGroups": + return ec.fieldContext_Group_internalPolicyBlockedGroups(ctx, field) + case "programEditors": + return ec.fieldContext_Group_programEditors(ctx, field) + case "programBlockedGroups": + return ec.fieldContext_Group_programBlockedGroups(ctx, field) + case "programViewers": + return ec.fieldContext_Group_programViewers(ctx, field) + case "riskEditors": + return ec.fieldContext_Group_riskEditors(ctx, field) + case "riskBlockedGroups": + return ec.fieldContext_Group_riskBlockedGroups(ctx, field) + case "riskViewers": + return ec.fieldContext_Group_riskViewers(ctx, field) + case "controlObjectiveEditors": + return ec.fieldContext_Group_controlObjectiveEditors(ctx, field) + case "controlObjectiveBlockedGroups": + return ec.fieldContext_Group_controlObjectiveBlockedGroups(ctx, field) + case "controlObjectiveViewers": + return ec.fieldContext_Group_controlObjectiveViewers(ctx, field) + case "controlEditors": + return ec.fieldContext_Group_controlEditors(ctx, field) + case "controlBlockedGroups": + return ec.fieldContext_Group_controlBlockedGroups(ctx, field) + case "controlViewers": + return ec.fieldContext_Group_controlViewers(ctx, field) + case "narrativeEditors": + return ec.fieldContext_Group_narrativeEditors(ctx, field) + case "narrativeBlockedGroups": + return ec.fieldContext_Group_narrativeBlockedGroups(ctx, field) + case "narrativeViewers": + return ec.fieldContext_Group_narrativeViewers(ctx, field) + case "setting": + return ec.fieldContext_Group_setting(ctx, field) + case "users": + return ec.fieldContext_Group_users(ctx, field) + case "events": + return ec.fieldContext_Group_events(ctx, field) + case "integrations": + return ec.fieldContext_Group_integrations(ctx, field) + case "files": + return ec.fieldContext_Group_files(ctx, field) + case "tasks": + return ec.fieldContext_Group_tasks(ctx, field) + case "members": + return ec.fieldContext_Group_members(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Group", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Organization_parent(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Organization_parent(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.Parent(ctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*generated.Organization) + fc.Result = res + return ec.marshalOOrganization2ᚖgithubᚗcomᚋtheopenlaneᚋcoreᚋinternalᚋentᚋgeneratedᚐOrganization(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Organization_parent(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Organization", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Organization_id(ctx, field) + case "createdAt": + return ec.fieldContext_Organization_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Organization_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_Organization_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_Organization_updatedBy(ctx, field) + case "tags": + return ec.fieldContext_Organization_tags(ctx, field) + case "deletedAt": + return ec.fieldContext_Organization_deletedAt(ctx, field) + case "deletedBy": + return ec.fieldContext_Organization_deletedBy(ctx, field) + case "name": + return ec.fieldContext_Organization_name(ctx, field) + case "displayName": + return ec.fieldContext_Organization_displayName(ctx, field) + case "description": + return ec.fieldContext_Organization_description(ctx, field) + case "personalOrg": + return ec.fieldContext_Organization_personalOrg(ctx, field) + case "avatarRemoteURL": + return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) + case "dedicatedDb": + return ec.fieldContext_Organization_dedicatedDb(ctx, field) + case "controlCreators": + return ec.fieldContext_Organization_controlCreators(ctx, field) + case "controlObjectiveCreators": + return ec.fieldContext_Organization_controlObjectiveCreators(ctx, field) + case "groupCreators": + return ec.fieldContext_Organization_groupCreators(ctx, field) + case "internalPolicyCreators": + return ec.fieldContext_Organization_internalPolicyCreators(ctx, field) + case "narrativeCreators": + return ec.fieldContext_Organization_narrativeCreators(ctx, field) + case "procedureCreators": + return ec.fieldContext_Organization_procedureCreators(ctx, field) + case "programCreators": + return ec.fieldContext_Organization_programCreators(ctx, field) + case "riskCreators": + return ec.fieldContext_Organization_riskCreators(ctx, field) + case "templateCreators": + return ec.fieldContext_Organization_templateCreators(ctx, field) + case "parent": + return ec.fieldContext_Organization_parent(ctx, field) + case "children": + return ec.fieldContext_Organization_children(ctx, field) + case "groups": + return ec.fieldContext_Organization_groups(ctx, field) + case "templates": + return ec.fieldContext_Organization_templates(ctx, field) + case "integrations": + return ec.fieldContext_Organization_integrations(ctx, field) + case "setting": + return ec.fieldContext_Organization_setting(ctx, field) + case "documentData": + return ec.fieldContext_Organization_documentData(ctx, field) + case "orgSubscriptions": + return ec.fieldContext_Organization_orgSubscriptions(ctx, field) + case "personalAccessTokens": + return ec.fieldContext_Organization_personalAccessTokens(ctx, field) + case "apiTokens": + return ec.fieldContext_Organization_apiTokens(ctx, field) + case "users": + return ec.fieldContext_Organization_users(ctx, field) + case "invites": + return ec.fieldContext_Organization_invites(ctx, field) + case "subscribers": + return ec.fieldContext_Organization_subscribers(ctx, field) + case "events": + return ec.fieldContext_Organization_events(ctx, field) + case "secrets": + return ec.fieldContext_Organization_secrets(ctx, field) + case "files": + return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) + case "entities": + return ec.fieldContext_Organization_entities(ctx, field) + case "entityTypes": + return ec.fieldContext_Organization_entityTypes(ctx, field) + case "contacts": + return ec.fieldContext_Organization_contacts(ctx, field) + case "notes": + return ec.fieldContext_Organization_notes(ctx, field) + case "tasks": + return ec.fieldContext_Organization_tasks(ctx, field) + case "programs": + return ec.fieldContext_Organization_programs(ctx, field) + case "procedures": + return ec.fieldContext_Organization_procedures(ctx, field) + case "internalPolicies": + return ec.fieldContext_Organization_internalPolicies(ctx, field) + case "risks": + return ec.fieldContext_Organization_risks(ctx, field) + case "controlObjectives": + return ec.fieldContext_Organization_controlObjectives(ctx, field) + case "narratives": + return ec.fieldContext_Organization_narratives(ctx, field) + case "controls": + return ec.fieldContext_Organization_controls(ctx, field) + case "subcontrols": + return ec.fieldContext_Organization_subcontrols(ctx, field) + case "members": + return ec.fieldContext_Organization_members(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Organization", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Organization_children(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Organization_children(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.Children(ctx, fc.Args["after"].(*entgql.Cursor[string]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[string]), fc.Args["last"].(*int), fc.Args["orderBy"].(*generated.OrganizationOrder), fc.Args["where"].(*generated.OrganizationWhereInput)) + }) + 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.(*generated.OrganizationConnection) + fc.Result = res + return ec.marshalNOrganizationConnection2ᚖgithubᚗcomᚋtheopenlaneᚋcoreᚋinternalᚋentᚋgeneratedᚐOrganizationConnection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Organization_children(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Organization", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_OrganizationConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_OrganizationConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_OrganizationConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type OrganizationConnection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Organization_children_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Organization_groups(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Organization_groups(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.Groups(ctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.([]*generated.Group) + fc.Result = res + return ec.marshalOGroup2ᚕᚖgithubᚗcomᚋtheopenlaneᚋcoreᚋinternalᚋentᚋgeneratedᚐGroupᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Organization_groups(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "Organization", Field: field, @@ -67053,8 +67344,6 @@ func (ec *executionContext) fieldContext_Organization_users(_ context.Context, f return ec.fieldContext_User_displayName(ctx, field) case "avatarRemoteURL": return ec.fieldContext_User_avatarRemoteURL(ctx, field) - case "avatarLocalFile": - return ec.fieldContext_User_avatarLocalFile(ctx, field) case "avatarLocalFileID": return ec.fieldContext_User_avatarLocalFileID(ctx, field) case "avatarUpdatedAt": @@ -67079,8 +67368,8 @@ func (ec *executionContext) fieldContext_Organization_users(_ context.Context, f return ec.fieldContext_User_organizations(ctx, field) case "files": return ec.fieldContext_User_files(ctx, field) - case "file": - return ec.fieldContext_User_file(ctx, field) + case "avatarFile": + return ec.fieldContext_User_avatarFile(ctx, field) case "events": return ec.fieldContext_User_events(ctx, field) case "actionPlans": @@ -67512,6 +67801,117 @@ func (ec *executionContext) fieldContext_Organization_files(_ context.Context, f return ec.fieldContext_File_events(ctx, field) case "program": return ec.fieldContext_File_program(ctx, field) + case "presignedURL": + return ec.fieldContext_File_presignedURL(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type File", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Organization_avatarFile(ctx context.Context, field graphql.CollectedField, obj *generated.Organization) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Organization_avatarFile(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.AvatarFile(ctx) + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*generated.File) + fc.Result = res + return ec.marshalOFile2ᚖgithubᚗcomᚋtheopenlaneᚋcoreᚋinternalᚋentᚋgeneratedᚐFile(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Organization_avatarFile(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Organization", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_File_id(ctx, field) + case "createdAt": + return ec.fieldContext_File_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_File_updatedAt(ctx, field) + case "createdBy": + return ec.fieldContext_File_createdBy(ctx, field) + case "updatedBy": + return ec.fieldContext_File_updatedBy(ctx, field) + case "deletedAt": + return ec.fieldContext_File_deletedAt(ctx, field) + case "deletedBy": + return ec.fieldContext_File_deletedBy(ctx, field) + case "tags": + return ec.fieldContext_File_tags(ctx, field) + case "providedFileName": + return ec.fieldContext_File_providedFileName(ctx, field) + case "providedFileExtension": + return ec.fieldContext_File_providedFileExtension(ctx, field) + case "providedFileSize": + return ec.fieldContext_File_providedFileSize(ctx, field) + case "persistedFileSize": + return ec.fieldContext_File_persistedFileSize(ctx, field) + case "detectedMimeType": + return ec.fieldContext_File_detectedMimeType(ctx, field) + case "md5Hash": + return ec.fieldContext_File_md5Hash(ctx, field) + case "detectedContentType": + return ec.fieldContext_File_detectedContentType(ctx, field) + case "storeKey": + return ec.fieldContext_File_storeKey(ctx, field) + case "categoryType": + return ec.fieldContext_File_categoryType(ctx, field) + case "uri": + return ec.fieldContext_File_uri(ctx, field) + case "storageScheme": + return ec.fieldContext_File_storageScheme(ctx, field) + case "storageVolume": + return ec.fieldContext_File_storageVolume(ctx, field) + case "storagePath": + return ec.fieldContext_File_storagePath(ctx, field) + case "user": + return ec.fieldContext_File_user(ctx, field) + case "organization": + return ec.fieldContext_File_organization(ctx, field) + case "group": + return ec.fieldContext_File_group(ctx, field) + case "contact": + return ec.fieldContext_File_contact(ctx, field) + case "entity": + return ec.fieldContext_File_entity(ctx, field) + case "userSetting": + return ec.fieldContext_File_userSetting(ctx, field) + case "organizationSetting": + return ec.fieldContext_File_organizationSetting(ctx, field) + case "template": + return ec.fieldContext_File_template(ctx, field) + case "documentData": + return ec.fieldContext_File_documentData(ctx, field) + case "events": + return ec.fieldContext_File_events(ctx, field) + case "program": + return ec.fieldContext_File_program(ctx, field) + case "presignedURL": + return ec.fieldContext_File_presignedURL(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type File", field.Name) }, @@ -69004,6 +69404,10 @@ func (ec *executionContext) fieldContext_OrganizationEdge_node(_ context.Context return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -69056,6 +69460,8 @@ func (ec *executionContext) fieldContext_OrganizationEdge_node(_ context.Context return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -69806,6 +70212,88 @@ func (ec *executionContext) fieldContext_OrganizationHistory_avatarRemoteURL(_ c return fc, nil } +func (ec *executionContext) _OrganizationHistory_avatarLocalFileID(ctx context.Context, field graphql.CollectedField, obj *generated.OrganizationHistory) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_OrganizationHistory_avatarLocalFileID(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.AvatarLocalFileID, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*string) + fc.Result = res + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_OrganizationHistory_avatarLocalFileID(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "OrganizationHistory", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _OrganizationHistory_avatarUpdatedAt(ctx context.Context, field graphql.CollectedField, obj *generated.OrganizationHistory) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_OrganizationHistory_avatarUpdatedAt(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.AvatarUpdatedAt, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + return graphql.Null + } + res := resTmp.(*time.Time) + fc.Result = res + return ec.marshalOTime2ᚖtimeᚐTime(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_OrganizationHistory_avatarUpdatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "OrganizationHistory", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Time does not have child fields") + }, + } + return fc, nil +} + func (ec *executionContext) _OrganizationHistory_dedicatedDb(ctx context.Context, field graphql.CollectedField, obj *generated.OrganizationHistory) (ret graphql.Marshaler) { fc, err := ec.fieldContext_OrganizationHistory_dedicatedDb(ctx, field) if err != nil { @@ -70063,6 +70551,10 @@ func (ec *executionContext) fieldContext_OrganizationHistoryEdge_node(_ context. return ec.fieldContext_OrganizationHistory_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_OrganizationHistory_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_OrganizationHistory_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_OrganizationHistory_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_OrganizationHistory_dedicatedDb(ctx, field) } @@ -70881,6 +71373,10 @@ func (ec *executionContext) fieldContext_OrganizationSetting_organization(_ cont return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -70933,6 +71429,8 @@ func (ec *executionContext) fieldContext_OrganizationSetting_organization(_ cont return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -71068,6 +71566,8 @@ func (ec *executionContext) fieldContext_OrganizationSetting_files(_ context.Con return ec.fieldContext_File_events(ctx, field) case "program": return ec.fieldContext_File_program(ctx, field) + case "presignedURL": + return ec.fieldContext_File_presignedURL(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type File", field.Name) }, @@ -73267,8 +73767,6 @@ func (ec *executionContext) fieldContext_PersonalAccessToken_owner(_ context.Con return ec.fieldContext_User_displayName(ctx, field) case "avatarRemoteURL": return ec.fieldContext_User_avatarRemoteURL(ctx, field) - case "avatarLocalFile": - return ec.fieldContext_User_avatarLocalFile(ctx, field) case "avatarLocalFileID": return ec.fieldContext_User_avatarLocalFileID(ctx, field) case "avatarUpdatedAt": @@ -73293,8 +73791,8 @@ func (ec *executionContext) fieldContext_PersonalAccessToken_owner(_ context.Con return ec.fieldContext_User_organizations(ctx, field) case "files": return ec.fieldContext_User_files(ctx, field) - case "file": - return ec.fieldContext_User_file(ctx, field) + case "avatarFile": + return ec.fieldContext_User_avatarFile(ctx, field) case "events": return ec.fieldContext_User_events(ctx, field) case "actionPlans": @@ -73382,6 +73880,10 @@ func (ec *executionContext) fieldContext_PersonalAccessToken_organizations(_ con return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -73434,6 +73936,8 @@ func (ec *executionContext) fieldContext_PersonalAccessToken_organizations(_ con return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -74626,6 +75130,10 @@ func (ec *executionContext) fieldContext_Procedure_owner(_ context.Context, fiel return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -74678,6 +75186,8 @@ func (ec *executionContext) fieldContext_Procedure_owner(_ context.Context, fiel return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -77803,6 +78313,10 @@ func (ec *executionContext) fieldContext_Program_owner(_ context.Context, field return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -77855,6 +78369,8 @@ func (ec *executionContext) fieldContext_Program_owner(_ context.Context, field return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -79195,6 +79711,8 @@ func (ec *executionContext) fieldContext_Program_files(_ context.Context, field return ec.fieldContext_File_events(ctx, field) case "program": return ec.fieldContext_File_program(ctx, field) + case "presignedURL": + return ec.fieldContext_File_presignedURL(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type File", field.Name) }, @@ -79523,8 +80041,6 @@ func (ec *executionContext) fieldContext_Program_users(_ context.Context, field return ec.fieldContext_User_displayName(ctx, field) case "avatarRemoteURL": return ec.fieldContext_User_avatarRemoteURL(ctx, field) - case "avatarLocalFile": - return ec.fieldContext_User_avatarLocalFile(ctx, field) case "avatarLocalFileID": return ec.fieldContext_User_avatarLocalFileID(ctx, field) case "avatarUpdatedAt": @@ -79549,8 +80065,8 @@ func (ec *executionContext) fieldContext_Program_users(_ context.Context, field return ec.fieldContext_User_organizations(ctx, field) case "files": return ec.fieldContext_User_files(ctx, field) - case "file": - return ec.fieldContext_User_file(ctx, field) + case "avatarFile": + return ec.fieldContext_User_avatarFile(ctx, field) case "events": return ec.fieldContext_User_events(ctx, field) case "actionPlans": @@ -81664,8 +82180,6 @@ func (ec *executionContext) fieldContext_ProgramMembership_user(_ context.Contex return ec.fieldContext_User_displayName(ctx, field) case "avatarRemoteURL": return ec.fieldContext_User_avatarRemoteURL(ctx, field) - case "avatarLocalFile": - return ec.fieldContext_User_avatarLocalFile(ctx, field) case "avatarLocalFileID": return ec.fieldContext_User_avatarLocalFileID(ctx, field) case "avatarUpdatedAt": @@ -81690,8 +82204,8 @@ func (ec *executionContext) fieldContext_ProgramMembership_user(_ context.Contex return ec.fieldContext_User_organizations(ctx, field) case "files": return ec.fieldContext_User_files(ctx, field) - case "file": - return ec.fieldContext_User_file(ctx, field) + case "avatarFile": + return ec.fieldContext_User_avatarFile(ctx, field) case "events": return ec.fieldContext_User_events(ctx, field) case "actionPlans": @@ -89851,6 +90365,8 @@ func (ec *executionContext) fieldContext_Query_file(ctx context.Context, field g return ec.fieldContext_File_events(ctx, field) case "program": return ec.fieldContext_File_program(ctx, field) + case "presignedURL": + return ec.fieldContext_File_presignedURL(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type File", field.Name) }, @@ -90730,6 +91246,10 @@ func (ec *executionContext) fieldContext_Query_organization(ctx context.Context, return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -90782,6 +91302,8 @@ func (ec *executionContext) fieldContext_Query_organization(ctx context.Context, return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -94081,8 +94603,6 @@ func (ec *executionContext) fieldContext_Query_user(ctx context.Context, field g return ec.fieldContext_User_displayName(ctx, field) case "avatarRemoteURL": return ec.fieldContext_User_avatarRemoteURL(ctx, field) - case "avatarLocalFile": - return ec.fieldContext_User_avatarLocalFile(ctx, field) case "avatarLocalFileID": return ec.fieldContext_User_avatarLocalFileID(ctx, field) case "avatarUpdatedAt": @@ -94107,8 +94627,8 @@ func (ec *executionContext) fieldContext_Query_user(ctx context.Context, field g return ec.fieldContext_User_organizations(ctx, field) case "files": return ec.fieldContext_User_files(ctx, field) - case "file": - return ec.fieldContext_User_file(ctx, field) + case "avatarFile": + return ec.fieldContext_User_avatarFile(ctx, field) case "events": return ec.fieldContext_User_events(ctx, field) case "actionPlans": @@ -95222,6 +95742,10 @@ func (ec *executionContext) fieldContext_Risk_owner(_ context.Context, field gra return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -95274,6 +95798,8 @@ func (ec *executionContext) fieldContext_Risk_owner(_ context.Context, field gra return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -101402,6 +101928,10 @@ func (ec *executionContext) fieldContext_Subcontrol_owner(_ context.Context, fie return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -101454,6 +101984,8 @@ func (ec *executionContext) fieldContext_Subcontrol_owner(_ context.Context, fie return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -101665,8 +102197,6 @@ func (ec *executionContext) fieldContext_Subcontrol_user(_ context.Context, fiel return ec.fieldContext_User_displayName(ctx, field) case "avatarRemoteURL": return ec.fieldContext_User_avatarRemoteURL(ctx, field) - case "avatarLocalFile": - return ec.fieldContext_User_avatarLocalFile(ctx, field) case "avatarLocalFileID": return ec.fieldContext_User_avatarLocalFileID(ctx, field) case "avatarUpdatedAt": @@ -101691,8 +102221,8 @@ func (ec *executionContext) fieldContext_Subcontrol_user(_ context.Context, fiel return ec.fieldContext_User_organizations(ctx, field) case "files": return ec.fieldContext_User_files(ctx, field) - case "file": - return ec.fieldContext_User_file(ctx, field) + case "avatarFile": + return ec.fieldContext_User_avatarFile(ctx, field) case "events": return ec.fieldContext_User_events(ctx, field) case "actionPlans": @@ -104389,6 +104919,10 @@ func (ec *executionContext) fieldContext_Subscriber_owner(_ context.Context, fie return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -104441,6 +104975,8 @@ func (ec *executionContext) fieldContext_Subscriber_owner(_ context.Context, fie return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -105385,8 +105921,6 @@ func (ec *executionContext) fieldContext_TFASetting_owner(_ context.Context, fie return ec.fieldContext_User_displayName(ctx, field) case "avatarRemoteURL": return ec.fieldContext_User_avatarRemoteURL(ctx, field) - case "avatarLocalFile": - return ec.fieldContext_User_avatarLocalFile(ctx, field) case "avatarLocalFileID": return ec.fieldContext_User_avatarLocalFileID(ctx, field) case "avatarUpdatedAt": @@ -105411,8 +105945,8 @@ func (ec *executionContext) fieldContext_TFASetting_owner(_ context.Context, fie return ec.fieldContext_User_organizations(ctx, field) case "files": return ec.fieldContext_User_files(ctx, field) - case "file": - return ec.fieldContext_User_file(ctx, field) + case "avatarFile": + return ec.fieldContext_User_avatarFile(ctx, field) case "events": return ec.fieldContext_User_events(ctx, field) case "actionPlans": @@ -106344,8 +106878,6 @@ func (ec *executionContext) fieldContext_Task_assigner(_ context.Context, field return ec.fieldContext_User_displayName(ctx, field) case "avatarRemoteURL": return ec.fieldContext_User_avatarRemoteURL(ctx, field) - case "avatarLocalFile": - return ec.fieldContext_User_avatarLocalFile(ctx, field) case "avatarLocalFileID": return ec.fieldContext_User_avatarLocalFileID(ctx, field) case "avatarUpdatedAt": @@ -106370,8 +106902,8 @@ func (ec *executionContext) fieldContext_Task_assigner(_ context.Context, field return ec.fieldContext_User_organizations(ctx, field) case "files": return ec.fieldContext_User_files(ctx, field) - case "file": - return ec.fieldContext_User_file(ctx, field) + case "avatarFile": + return ec.fieldContext_User_avatarFile(ctx, field) case "events": return ec.fieldContext_User_events(ctx, field) case "actionPlans": @@ -106459,8 +106991,6 @@ func (ec *executionContext) fieldContext_Task_assignee(_ context.Context, field return ec.fieldContext_User_displayName(ctx, field) case "avatarRemoteURL": return ec.fieldContext_User_avatarRemoteURL(ctx, field) - case "avatarLocalFile": - return ec.fieldContext_User_avatarLocalFile(ctx, field) case "avatarLocalFileID": return ec.fieldContext_User_avatarLocalFileID(ctx, field) case "avatarUpdatedAt": @@ -106485,8 +107015,8 @@ func (ec *executionContext) fieldContext_Task_assignee(_ context.Context, field return ec.fieldContext_User_organizations(ctx, field) case "files": return ec.fieldContext_User_files(ctx, field) - case "file": - return ec.fieldContext_User_file(ctx, field) + case "avatarFile": + return ec.fieldContext_User_avatarFile(ctx, field) case "events": return ec.fieldContext_User_events(ctx, field) case "actionPlans": @@ -106574,6 +107104,10 @@ func (ec *executionContext) fieldContext_Task_organization(_ context.Context, fi return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -106626,6 +107160,8 @@ func (ec *executionContext) fieldContext_Task_organization(_ context.Context, fi return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -109340,6 +109876,10 @@ func (ec *executionContext) fieldContext_Template_owner(_ context.Context, field return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -109392,6 +109932,8 @@ func (ec *executionContext) fieldContext_Template_owner(_ context.Context, field return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -109600,6 +110142,8 @@ func (ec *executionContext) fieldContext_Template_files(_ context.Context, field return ec.fieldContext_File_events(ctx, field) case "program": return ec.fieldContext_File_program(ctx, field) + case "presignedURL": + return ec.fieldContext_File_presignedURL(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type File", field.Name) }, @@ -111396,47 +111940,6 @@ func (ec *executionContext) fieldContext_User_avatarRemoteURL(_ context.Context, return fc, nil } -func (ec *executionContext) _User_avatarLocalFile(ctx context.Context, field graphql.CollectedField, obj *generated.User) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_User_avatarLocalFile(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.AvatarLocalFile, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_User_avatarLocalFile(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "User", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - func (ec *executionContext) _User_avatarLocalFileID(ctx context.Context, field graphql.CollectedField, obj *generated.User) (ret graphql.Marshaler) { fc, err := ec.fieldContext_User_avatarLocalFileID(ctx, field) if err != nil { @@ -112121,6 +112624,10 @@ func (ec *executionContext) fieldContext_User_organizations(_ context.Context, f return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -112173,6 +112680,8 @@ func (ec *executionContext) fieldContext_User_organizations(_ context.Context, f return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -112308,6 +112817,8 @@ func (ec *executionContext) fieldContext_User_files(_ context.Context, field gra return ec.fieldContext_File_events(ctx, field) case "program": return ec.fieldContext_File_program(ctx, field) + case "presignedURL": + return ec.fieldContext_File_presignedURL(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type File", field.Name) }, @@ -112315,8 +112826,8 @@ func (ec *executionContext) fieldContext_User_files(_ context.Context, field gra return fc, nil } -func (ec *executionContext) _User_file(ctx context.Context, field graphql.CollectedField, obj *generated.User) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_User_file(ctx, field) +func (ec *executionContext) _User_avatarFile(ctx context.Context, field graphql.CollectedField, obj *generated.User) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_User_avatarFile(ctx, field) if err != nil { return graphql.Null } @@ -112329,7 +112840,7 @@ func (ec *executionContext) _User_file(ctx context.Context, field graphql.Collec }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { ctx = rctx // use context from middleware stack in children - return obj.File(ctx) + return obj.AvatarFile(ctx) }) if err != nil { ec.Error(ctx, err) @@ -112343,7 +112854,7 @@ func (ec *executionContext) _User_file(ctx context.Context, field graphql.Collec return ec.marshalOFile2ᚖgithubᚗcomᚋtheopenlaneᚋcoreᚋinternalᚋentᚋgeneratedᚐFile(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_User_file(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_User_avatarFile(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "User", Field: field, @@ -112415,6 +112926,8 @@ func (ec *executionContext) fieldContext_User_file(_ context.Context, field grap return ec.fieldContext_File_events(ctx, field) case "program": return ec.fieldContext_File_program(ctx, field) + case "presignedURL": + return ec.fieldContext_File_presignedURL(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type File", field.Name) }, @@ -113402,8 +113915,6 @@ func (ec *executionContext) fieldContext_UserEdge_node(_ context.Context, field return ec.fieldContext_User_displayName(ctx, field) case "avatarRemoteURL": return ec.fieldContext_User_avatarRemoteURL(ctx, field) - case "avatarLocalFile": - return ec.fieldContext_User_avatarLocalFile(ctx, field) case "avatarLocalFileID": return ec.fieldContext_User_avatarLocalFileID(ctx, field) case "avatarUpdatedAt": @@ -113428,8 +113939,8 @@ func (ec *executionContext) fieldContext_UserEdge_node(_ context.Context, field return ec.fieldContext_User_organizations(ctx, field) case "files": return ec.fieldContext_User_files(ctx, field) - case "file": - return ec.fieldContext_User_file(ctx, field) + case "avatarFile": + return ec.fieldContext_User_avatarFile(ctx, field) case "events": return ec.fieldContext_User_events(ctx, field) case "actionPlans": @@ -114170,47 +114681,6 @@ func (ec *executionContext) fieldContext_UserHistory_avatarRemoteURL(_ context.C return fc, nil } -func (ec *executionContext) _UserHistory_avatarLocalFile(ctx context.Context, field graphql.CollectedField, obj *generated.UserHistory) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_UserHistory_avatarLocalFile(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.AvatarLocalFile, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_UserHistory_avatarLocalFile(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "UserHistory", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - func (ec *executionContext) _UserHistory_avatarLocalFileID(ctx context.Context, field graphql.CollectedField, obj *generated.UserHistory) (ret graphql.Marshaler) { fc, err := ec.fieldContext_UserHistory_avatarLocalFileID(ctx, field) if err != nil { @@ -114673,8 +115143,6 @@ func (ec *executionContext) fieldContext_UserHistoryEdge_node(_ context.Context, return ec.fieldContext_UserHistory_displayName(ctx, field) case "avatarRemoteURL": return ec.fieldContext_UserHistory_avatarRemoteURL(ctx, field) - case "avatarLocalFile": - return ec.fieldContext_UserHistory_avatarLocalFile(ctx, field) case "avatarLocalFileID": return ec.fieldContext_UserHistory_avatarLocalFileID(ctx, field) case "avatarUpdatedAt": @@ -115468,8 +115936,6 @@ func (ec *executionContext) fieldContext_UserSetting_user(_ context.Context, fie return ec.fieldContext_User_displayName(ctx, field) case "avatarRemoteURL": return ec.fieldContext_User_avatarRemoteURL(ctx, field) - case "avatarLocalFile": - return ec.fieldContext_User_avatarLocalFile(ctx, field) case "avatarLocalFileID": return ec.fieldContext_User_avatarLocalFileID(ctx, field) case "avatarUpdatedAt": @@ -115494,8 +115960,8 @@ func (ec *executionContext) fieldContext_UserSetting_user(_ context.Context, fie return ec.fieldContext_User_organizations(ctx, field) case "files": return ec.fieldContext_User_files(ctx, field) - case "file": - return ec.fieldContext_User_file(ctx, field) + case "avatarFile": + return ec.fieldContext_User_avatarFile(ctx, field) case "events": return ec.fieldContext_User_events(ctx, field) case "actionPlans": @@ -115583,6 +116049,10 @@ func (ec *executionContext) fieldContext_UserSetting_defaultOrg(_ context.Contex return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -115635,6 +116105,8 @@ func (ec *executionContext) fieldContext_UserSetting_defaultOrg(_ context.Contex return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -115770,6 +116242,8 @@ func (ec *executionContext) fieldContext_UserSetting_files(_ context.Context, fi return ec.fieldContext_File_events(ctx, field) case "program": return ec.fieldContext_File_program(ctx, field) + case "presignedURL": + return ec.fieldContext_File_presignedURL(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type File", field.Name) }, @@ -134040,7 +134514,7 @@ func (ec *executionContext) unmarshalInputCreateOrganizationInput(ctx context.Co asMap[k] = v } - fieldsInOrder := [...]string{"tags", "name", "displayName", "description", "personalOrg", "avatarRemoteURL", "dedicatedDb", "controlCreatorIDs", "controlObjectiveCreatorIDs", "groupCreatorIDs", "internalPolicyCreatorIDs", "narrativeCreatorIDs", "procedureCreatorIDs", "programCreatorIDs", "riskCreatorIDs", "templateCreatorIDs", "parentID", "groupIDs", "templateIDs", "integrationIDs", "settingID", "documentDatumIDs", "orgSubscriptionIDs", "personalAccessTokenIDs", "apiTokenIDs", "userIDs", "inviteIDs", "subscriberIDs", "eventIDs", "secretIDs", "fileIDs", "entityIDs", "entityTypeIDs", "contactIDs", "noteIDs", "taskIDs", "programIDs", "procedureIDs", "internalPolicyIDs", "riskIDs", "controlObjectiveIDs", "narrativeIDs", "controlIDs", "subcontrolIDs", "createOrgSettings"} + fieldsInOrder := [...]string{"tags", "name", "displayName", "description", "personalOrg", "avatarRemoteURL", "avatarUpdatedAt", "dedicatedDb", "controlCreatorIDs", "controlObjectiveCreatorIDs", "groupCreatorIDs", "internalPolicyCreatorIDs", "narrativeCreatorIDs", "procedureCreatorIDs", "programCreatorIDs", "riskCreatorIDs", "templateCreatorIDs", "parentID", "groupIDs", "templateIDs", "integrationIDs", "settingID", "documentDatumIDs", "orgSubscriptionIDs", "personalAccessTokenIDs", "apiTokenIDs", "userIDs", "inviteIDs", "subscriberIDs", "eventIDs", "secretIDs", "fileIDs", "avatarFileID", "entityIDs", "entityTypeIDs", "contactIDs", "noteIDs", "taskIDs", "programIDs", "procedureIDs", "internalPolicyIDs", "riskIDs", "controlObjectiveIDs", "narrativeIDs", "controlIDs", "subcontrolIDs", "createOrgSettings"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -134089,6 +134563,13 @@ func (ec *executionContext) unmarshalInputCreateOrganizationInput(ctx context.Co return it, err } it.AvatarRemoteURL = data + case "avatarUpdatedAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.AvatarUpdatedAt = data case "dedicatedDb": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("dedicatedDb")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) @@ -134264,6 +134745,13 @@ func (ec *executionContext) unmarshalInputCreateOrganizationInput(ctx context.Co return it, err } it.FileIDs = data + case "avatarFileID": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarFileID")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarFileID = data case "entityIDs": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("entityIDs")) data, err := ec.unmarshalOID2ᚕstringᚄ(ctx, v) @@ -135737,7 +136225,7 @@ func (ec *executionContext) unmarshalInputCreateUserInput(ctx context.Context, o asMap[k] = v } - fieldsInOrder := [...]string{"tags", "email", "firstName", "lastName", "displayName", "avatarRemoteURL", "avatarLocalFile", "avatarUpdatedAt", "lastSeen", "password", "sub", "authProvider", "role", "personalAccessTokenIDs", "tfaSettingIDs", "settingID", "emailVerificationTokenIDs", "passwordResetTokenIDs", "groupIDs", "organizationIDs", "webauthnIDs", "fileIDs", "fileID", "eventIDs", "actionPlanIDs", "subcontrolIDs", "assignerTaskIDs", "assigneeTaskIDs", "programIDs"} + fieldsInOrder := [...]string{"tags", "email", "firstName", "lastName", "displayName", "avatarRemoteURL", "avatarUpdatedAt", "lastSeen", "password", "sub", "authProvider", "role", "personalAccessTokenIDs", "tfaSettingIDs", "settingID", "emailVerificationTokenIDs", "passwordResetTokenIDs", "groupIDs", "organizationIDs", "webauthnIDs", "fileIDs", "avatarFileID", "eventIDs", "actionPlanIDs", "subcontrolIDs", "assignerTaskIDs", "assigneeTaskIDs", "programIDs"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -135786,13 +136274,6 @@ func (ec *executionContext) unmarshalInputCreateUserInput(ctx context.Context, o return it, err } it.AvatarRemoteURL = data - case "avatarLocalFile": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFile")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFile = data case "avatarUpdatedAt": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAt")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) @@ -135898,13 +136379,13 @@ func (ec *executionContext) unmarshalInputCreateUserInput(ctx context.Context, o return it, err } it.FileIDs = data - case "fileID": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("fileID")) + case "avatarFileID": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarFileID")) data, err := ec.unmarshalOID2ᚖstring(ctx, v) if err != nil { return it, err } - it.FileID = data + it.AvatarFileID = data case "eventIDs": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("eventIDs")) data, err := ec.unmarshalOID2ᚕstringᚄ(ctx, v) @@ -172501,7 +172982,7 @@ func (ec *executionContext) unmarshalInputOrganizationHistoryWhereInput(ctx cont asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "idEqualFold", "idContainsFold", "historyTime", "historyTimeNEQ", "historyTimeIn", "historyTimeNotIn", "historyTimeGT", "historyTimeGTE", "historyTimeLT", "historyTimeLTE", "ref", "refNEQ", "refIn", "refNotIn", "refGT", "refGTE", "refLT", "refLTE", "refContains", "refHasPrefix", "refHasSuffix", "refIsNil", "refNotNil", "refEqualFold", "refContainsFold", "operation", "operationNEQ", "operationIn", "operationNotIn", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "createdAtIsNil", "createdAtNotNil", "updatedAt", "updatedAtNEQ", "updatedAtIn", "updatedAtNotIn", "updatedAtGT", "updatedAtGTE", "updatedAtLT", "updatedAtLTE", "updatedAtIsNil", "updatedAtNotNil", "createdBy", "createdByNEQ", "createdByIn", "createdByNotIn", "createdByGT", "createdByGTE", "createdByLT", "createdByLTE", "createdByContains", "createdByHasPrefix", "createdByHasSuffix", "createdByIsNil", "createdByNotNil", "createdByEqualFold", "createdByContainsFold", "updatedBy", "updatedByNEQ", "updatedByIn", "updatedByNotIn", "updatedByGT", "updatedByGTE", "updatedByLT", "updatedByLTE", "updatedByContains", "updatedByHasPrefix", "updatedByHasSuffix", "updatedByIsNil", "updatedByNotNil", "updatedByEqualFold", "updatedByContainsFold", "deletedAt", "deletedAtNEQ", "deletedAtIn", "deletedAtNotIn", "deletedAtGT", "deletedAtGTE", "deletedAtLT", "deletedAtLTE", "deletedAtIsNil", "deletedAtNotNil", "deletedBy", "deletedByNEQ", "deletedByIn", "deletedByNotIn", "deletedByGT", "deletedByGTE", "deletedByLT", "deletedByLTE", "deletedByContains", "deletedByHasPrefix", "deletedByHasSuffix", "deletedByIsNil", "deletedByNotNil", "deletedByEqualFold", "deletedByContainsFold", "displayName", "displayNameNEQ", "displayNameIn", "displayNameNotIn", "displayNameGT", "displayNameGTE", "displayNameLT", "displayNameLTE", "displayNameContains", "displayNameHasPrefix", "displayNameHasSuffix", "displayNameEqualFold", "displayNameContainsFold", "parentOrganizationID", "parentOrganizationIDNEQ", "parentOrganizationIDIn", "parentOrganizationIDNotIn", "parentOrganizationIDGT", "parentOrganizationIDGTE", "parentOrganizationIDLT", "parentOrganizationIDLTE", "parentOrganizationIDContains", "parentOrganizationIDHasPrefix", "parentOrganizationIDHasSuffix", "parentOrganizationIDIsNil", "parentOrganizationIDNotNil", "parentOrganizationIDEqualFold", "parentOrganizationIDContainsFold", "personalOrg", "personalOrgNEQ", "personalOrgIsNil", "personalOrgNotNil", "avatarRemoteURL", "avatarRemoteURLNEQ", "avatarRemoteURLIn", "avatarRemoteURLNotIn", "avatarRemoteURLGT", "avatarRemoteURLGTE", "avatarRemoteURLLT", "avatarRemoteURLLTE", "avatarRemoteURLContains", "avatarRemoteURLHasPrefix", "avatarRemoteURLHasSuffix", "avatarRemoteURLIsNil", "avatarRemoteURLNotNil", "avatarRemoteURLEqualFold", "avatarRemoteURLContainsFold"} + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "idEqualFold", "idContainsFold", "historyTime", "historyTimeNEQ", "historyTimeIn", "historyTimeNotIn", "historyTimeGT", "historyTimeGTE", "historyTimeLT", "historyTimeLTE", "ref", "refNEQ", "refIn", "refNotIn", "refGT", "refGTE", "refLT", "refLTE", "refContains", "refHasPrefix", "refHasSuffix", "refIsNil", "refNotNil", "refEqualFold", "refContainsFold", "operation", "operationNEQ", "operationIn", "operationNotIn", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "createdAtIsNil", "createdAtNotNil", "updatedAt", "updatedAtNEQ", "updatedAtIn", "updatedAtNotIn", "updatedAtGT", "updatedAtGTE", "updatedAtLT", "updatedAtLTE", "updatedAtIsNil", "updatedAtNotNil", "createdBy", "createdByNEQ", "createdByIn", "createdByNotIn", "createdByGT", "createdByGTE", "createdByLT", "createdByLTE", "createdByContains", "createdByHasPrefix", "createdByHasSuffix", "createdByIsNil", "createdByNotNil", "createdByEqualFold", "createdByContainsFold", "updatedBy", "updatedByNEQ", "updatedByIn", "updatedByNotIn", "updatedByGT", "updatedByGTE", "updatedByLT", "updatedByLTE", "updatedByContains", "updatedByHasPrefix", "updatedByHasSuffix", "updatedByIsNil", "updatedByNotNil", "updatedByEqualFold", "updatedByContainsFold", "deletedAt", "deletedAtNEQ", "deletedAtIn", "deletedAtNotIn", "deletedAtGT", "deletedAtGTE", "deletedAtLT", "deletedAtLTE", "deletedAtIsNil", "deletedAtNotNil", "deletedBy", "deletedByNEQ", "deletedByIn", "deletedByNotIn", "deletedByGT", "deletedByGTE", "deletedByLT", "deletedByLTE", "deletedByContains", "deletedByHasPrefix", "deletedByHasSuffix", "deletedByIsNil", "deletedByNotNil", "deletedByEqualFold", "deletedByContainsFold", "displayName", "displayNameNEQ", "displayNameIn", "displayNameNotIn", "displayNameGT", "displayNameGTE", "displayNameLT", "displayNameLTE", "displayNameContains", "displayNameHasPrefix", "displayNameHasSuffix", "displayNameEqualFold", "displayNameContainsFold", "parentOrganizationID", "parentOrganizationIDNEQ", "parentOrganizationIDIn", "parentOrganizationIDNotIn", "parentOrganizationIDGT", "parentOrganizationIDGTE", "parentOrganizationIDLT", "parentOrganizationIDLTE", "parentOrganizationIDContains", "parentOrganizationIDHasPrefix", "parentOrganizationIDHasSuffix", "parentOrganizationIDIsNil", "parentOrganizationIDNotNil", "parentOrganizationIDEqualFold", "parentOrganizationIDContainsFold", "personalOrg", "personalOrgNEQ", "personalOrgIsNil", "personalOrgNotNil", "avatarRemoteURL", "avatarRemoteURLNEQ", "avatarRemoteURLIn", "avatarRemoteURLNotIn", "avatarRemoteURLGT", "avatarRemoteURLGTE", "avatarRemoteURLLT", "avatarRemoteURLLTE", "avatarRemoteURLContains", "avatarRemoteURLHasPrefix", "avatarRemoteURLHasSuffix", "avatarRemoteURLIsNil", "avatarRemoteURLNotNil", "avatarRemoteURLEqualFold", "avatarRemoteURLContainsFold", "avatarLocalFileID", "avatarLocalFileIDNEQ", "avatarLocalFileIDIn", "avatarLocalFileIDNotIn", "avatarLocalFileIDGT", "avatarLocalFileIDGTE", "avatarLocalFileIDLT", "avatarLocalFileIDLTE", "avatarLocalFileIDContains", "avatarLocalFileIDHasPrefix", "avatarLocalFileIDHasSuffix", "avatarLocalFileIDIsNil", "avatarLocalFileIDNotNil", "avatarLocalFileIDEqualFold", "avatarLocalFileIDContainsFold", "avatarUpdatedAt", "avatarUpdatedAtNEQ", "avatarUpdatedAtIn", "avatarUpdatedAtNotIn", "avatarUpdatedAtGT", "avatarUpdatedAtGTE", "avatarUpdatedAtLT", "avatarUpdatedAtLTE", "avatarUpdatedAtIsNil", "avatarUpdatedAtNotNil"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -173642,6 +174123,181 @@ func (ec *executionContext) unmarshalInputOrganizationHistoryWhereInput(ctx cont return it, err } it.AvatarRemoteURLContainsFold = data + case "avatarLocalFileID": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileID")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileID = data + case "avatarLocalFileIDNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDNEQ")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDNEQ = data + case "avatarLocalFileIDIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDIn = data + case "avatarLocalFileIDNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDNotIn")) + data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDNotIn = data + case "avatarLocalFileIDGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDGT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDGT = data + case "avatarLocalFileIDGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDGTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDGTE = data + case "avatarLocalFileIDLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDLT")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDLT = data + case "avatarLocalFileIDLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDLTE")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDLTE = data + case "avatarLocalFileIDContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDContains")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDContains = data + case "avatarLocalFileIDHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDHasPrefix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDHasPrefix = data + case "avatarLocalFileIDHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDHasSuffix")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDHasSuffix = data + case "avatarLocalFileIDIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDIsNil = data + case "avatarLocalFileIDNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDNotNil = data + case "avatarLocalFileIDEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDEqualFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDEqualFold = data + case "avatarLocalFileIDContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDContainsFold")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDContainsFold = data + case "avatarUpdatedAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.AvatarUpdatedAt = data + case "avatarUpdatedAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.AvatarUpdatedAtNEQ = data + case "avatarUpdatedAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.AvatarUpdatedAtIn = data + case "avatarUpdatedAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.AvatarUpdatedAtNotIn = data + case "avatarUpdatedAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.AvatarUpdatedAtGT = data + case "avatarUpdatedAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.AvatarUpdatedAtGTE = data + case "avatarUpdatedAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.AvatarUpdatedAtLT = data + case "avatarUpdatedAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.AvatarUpdatedAtLTE = data + case "avatarUpdatedAtIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAtIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.AvatarUpdatedAtIsNil = data + case "avatarUpdatedAtNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAtNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.AvatarUpdatedAtNotNil = data } } @@ -176344,7 +177000,7 @@ func (ec *executionContext) unmarshalInputOrganizationWhereInput(ctx context.Con asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "idEqualFold", "idContainsFold", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "createdAtIsNil", "createdAtNotNil", "updatedAt", "updatedAtNEQ", "updatedAtIn", "updatedAtNotIn", "updatedAtGT", "updatedAtGTE", "updatedAtLT", "updatedAtLTE", "updatedAtIsNil", "updatedAtNotNil", "createdBy", "createdByNEQ", "createdByIn", "createdByNotIn", "createdByGT", "createdByGTE", "createdByLT", "createdByLTE", "createdByContains", "createdByHasPrefix", "createdByHasSuffix", "createdByIsNil", "createdByNotNil", "createdByEqualFold", "createdByContainsFold", "updatedBy", "updatedByNEQ", "updatedByIn", "updatedByNotIn", "updatedByGT", "updatedByGTE", "updatedByLT", "updatedByLTE", "updatedByContains", "updatedByHasPrefix", "updatedByHasSuffix", "updatedByIsNil", "updatedByNotNil", "updatedByEqualFold", "updatedByContainsFold", "deletedAt", "deletedAtNEQ", "deletedAtIn", "deletedAtNotIn", "deletedAtGT", "deletedAtGTE", "deletedAtLT", "deletedAtLTE", "deletedAtIsNil", "deletedAtNotNil", "deletedBy", "deletedByNEQ", "deletedByIn", "deletedByNotIn", "deletedByGT", "deletedByGTE", "deletedByLT", "deletedByLTE", "deletedByContains", "deletedByHasPrefix", "deletedByHasSuffix", "deletedByIsNil", "deletedByNotNil", "deletedByEqualFold", "deletedByContainsFold", "displayName", "displayNameNEQ", "displayNameIn", "displayNameNotIn", "displayNameGT", "displayNameGTE", "displayNameLT", "displayNameLTE", "displayNameContains", "displayNameHasPrefix", "displayNameHasSuffix", "displayNameEqualFold", "displayNameContainsFold", "parentOrganizationID", "parentOrganizationIDNEQ", "parentOrganizationIDIn", "parentOrganizationIDNotIn", "parentOrganizationIDGT", "parentOrganizationIDGTE", "parentOrganizationIDLT", "parentOrganizationIDLTE", "parentOrganizationIDContains", "parentOrganizationIDHasPrefix", "parentOrganizationIDHasSuffix", "parentOrganizationIDIsNil", "parentOrganizationIDNotNil", "parentOrganizationIDEqualFold", "parentOrganizationIDContainsFold", "personalOrg", "personalOrgNEQ", "personalOrgIsNil", "personalOrgNotNil", "avatarRemoteURL", "avatarRemoteURLNEQ", "avatarRemoteURLIn", "avatarRemoteURLNotIn", "avatarRemoteURLGT", "avatarRemoteURLGTE", "avatarRemoteURLLT", "avatarRemoteURLLTE", "avatarRemoteURLContains", "avatarRemoteURLHasPrefix", "avatarRemoteURLHasSuffix", "avatarRemoteURLIsNil", "avatarRemoteURLNotNil", "avatarRemoteURLEqualFold", "avatarRemoteURLContainsFold", "hasControlCreators", "hasControlCreatorsWith", "hasControlObjectiveCreators", "hasControlObjectiveCreatorsWith", "hasGroupCreators", "hasGroupCreatorsWith", "hasInternalPolicyCreators", "hasInternalPolicyCreatorsWith", "hasNarrativeCreators", "hasNarrativeCreatorsWith", "hasProcedureCreators", "hasProcedureCreatorsWith", "hasProgramCreators", "hasProgramCreatorsWith", "hasRiskCreators", "hasRiskCreatorsWith", "hasTemplateCreators", "hasTemplateCreatorsWith", "hasParent", "hasParentWith", "hasChildren", "hasChildrenWith", "hasGroups", "hasGroupsWith", "hasTemplates", "hasTemplatesWith", "hasIntegrations", "hasIntegrationsWith", "hasSetting", "hasSettingWith", "hasDocumentData", "hasDocumentDataWith", "hasOrgSubscriptions", "hasOrgSubscriptionsWith", "hasPersonalAccessTokens", "hasPersonalAccessTokensWith", "hasAPITokens", "hasAPITokensWith", "hasUsers", "hasUsersWith", "hasInvites", "hasInvitesWith", "hasSubscribers", "hasSubscribersWith", "hasEvents", "hasEventsWith", "hasSecrets", "hasSecretsWith", "hasFiles", "hasFilesWith", "hasEntities", "hasEntitiesWith", "hasEntityTypes", "hasEntityTypesWith", "hasContacts", "hasContactsWith", "hasNotes", "hasNotesWith", "hasTasks", "hasTasksWith", "hasPrograms", "hasProgramsWith", "hasProcedures", "hasProceduresWith", "hasInternalPolicies", "hasInternalPoliciesWith", "hasRisks", "hasRisksWith", "hasControlObjectives", "hasControlObjectivesWith", "hasNarratives", "hasNarrativesWith", "hasControls", "hasControlsWith", "hasSubcontrols", "hasSubcontrolsWith", "hasMembers", "hasMembersWith"} + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "idEqualFold", "idContainsFold", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "createdAtIsNil", "createdAtNotNil", "updatedAt", "updatedAtNEQ", "updatedAtIn", "updatedAtNotIn", "updatedAtGT", "updatedAtGTE", "updatedAtLT", "updatedAtLTE", "updatedAtIsNil", "updatedAtNotNil", "createdBy", "createdByNEQ", "createdByIn", "createdByNotIn", "createdByGT", "createdByGTE", "createdByLT", "createdByLTE", "createdByContains", "createdByHasPrefix", "createdByHasSuffix", "createdByIsNil", "createdByNotNil", "createdByEqualFold", "createdByContainsFold", "updatedBy", "updatedByNEQ", "updatedByIn", "updatedByNotIn", "updatedByGT", "updatedByGTE", "updatedByLT", "updatedByLTE", "updatedByContains", "updatedByHasPrefix", "updatedByHasSuffix", "updatedByIsNil", "updatedByNotNil", "updatedByEqualFold", "updatedByContainsFold", "deletedAt", "deletedAtNEQ", "deletedAtIn", "deletedAtNotIn", "deletedAtGT", "deletedAtGTE", "deletedAtLT", "deletedAtLTE", "deletedAtIsNil", "deletedAtNotNil", "deletedBy", "deletedByNEQ", "deletedByIn", "deletedByNotIn", "deletedByGT", "deletedByGTE", "deletedByLT", "deletedByLTE", "deletedByContains", "deletedByHasPrefix", "deletedByHasSuffix", "deletedByIsNil", "deletedByNotNil", "deletedByEqualFold", "deletedByContainsFold", "displayName", "displayNameNEQ", "displayNameIn", "displayNameNotIn", "displayNameGT", "displayNameGTE", "displayNameLT", "displayNameLTE", "displayNameContains", "displayNameHasPrefix", "displayNameHasSuffix", "displayNameEqualFold", "displayNameContainsFold", "parentOrganizationID", "parentOrganizationIDNEQ", "parentOrganizationIDIn", "parentOrganizationIDNotIn", "parentOrganizationIDGT", "parentOrganizationIDGTE", "parentOrganizationIDLT", "parentOrganizationIDLTE", "parentOrganizationIDContains", "parentOrganizationIDHasPrefix", "parentOrganizationIDHasSuffix", "parentOrganizationIDIsNil", "parentOrganizationIDNotNil", "parentOrganizationIDEqualFold", "parentOrganizationIDContainsFold", "personalOrg", "personalOrgNEQ", "personalOrgIsNil", "personalOrgNotNil", "avatarRemoteURL", "avatarRemoteURLNEQ", "avatarRemoteURLIn", "avatarRemoteURLNotIn", "avatarRemoteURLGT", "avatarRemoteURLGTE", "avatarRemoteURLLT", "avatarRemoteURLLTE", "avatarRemoteURLContains", "avatarRemoteURLHasPrefix", "avatarRemoteURLHasSuffix", "avatarRemoteURLIsNil", "avatarRemoteURLNotNil", "avatarRemoteURLEqualFold", "avatarRemoteURLContainsFold", "avatarLocalFileID", "avatarLocalFileIDNEQ", "avatarLocalFileIDIn", "avatarLocalFileIDNotIn", "avatarLocalFileIDGT", "avatarLocalFileIDGTE", "avatarLocalFileIDLT", "avatarLocalFileIDLTE", "avatarLocalFileIDContains", "avatarLocalFileIDHasPrefix", "avatarLocalFileIDHasSuffix", "avatarLocalFileIDIsNil", "avatarLocalFileIDNotNil", "avatarLocalFileIDEqualFold", "avatarLocalFileIDContainsFold", "avatarUpdatedAt", "avatarUpdatedAtNEQ", "avatarUpdatedAtIn", "avatarUpdatedAtNotIn", "avatarUpdatedAtGT", "avatarUpdatedAtGTE", "avatarUpdatedAtLT", "avatarUpdatedAtLTE", "avatarUpdatedAtIsNil", "avatarUpdatedAtNotNil", "hasControlCreators", "hasControlCreatorsWith", "hasControlObjectiveCreators", "hasControlObjectiveCreatorsWith", "hasGroupCreators", "hasGroupCreatorsWith", "hasInternalPolicyCreators", "hasInternalPolicyCreatorsWith", "hasNarrativeCreators", "hasNarrativeCreatorsWith", "hasProcedureCreators", "hasProcedureCreatorsWith", "hasProgramCreators", "hasProgramCreatorsWith", "hasRiskCreators", "hasRiskCreatorsWith", "hasTemplateCreators", "hasTemplateCreatorsWith", "hasParent", "hasParentWith", "hasChildren", "hasChildrenWith", "hasGroups", "hasGroupsWith", "hasTemplates", "hasTemplatesWith", "hasIntegrations", "hasIntegrationsWith", "hasSetting", "hasSettingWith", "hasDocumentData", "hasDocumentDataWith", "hasOrgSubscriptions", "hasOrgSubscriptionsWith", "hasPersonalAccessTokens", "hasPersonalAccessTokensWith", "hasAPITokens", "hasAPITokensWith", "hasUsers", "hasUsersWith", "hasInvites", "hasInvitesWith", "hasSubscribers", "hasSubscribersWith", "hasEvents", "hasEventsWith", "hasSecrets", "hasSecretsWith", "hasFiles", "hasFilesWith", "hasAvatarFile", "hasAvatarFileWith", "hasEntities", "hasEntitiesWith", "hasEntityTypes", "hasEntityTypesWith", "hasContacts", "hasContactsWith", "hasNotes", "hasNotesWith", "hasTasks", "hasTasksWith", "hasPrograms", "hasProgramsWith", "hasProcedures", "hasProceduresWith", "hasInternalPolicies", "hasInternalPoliciesWith", "hasRisks", "hasRisksWith", "hasControlObjectives", "hasControlObjectivesWith", "hasNarratives", "hasNarrativesWith", "hasControls", "hasControlsWith", "hasSubcontrols", "hasSubcontrolsWith", "hasMembers", "hasMembersWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -177296,6 +177952,181 @@ func (ec *executionContext) unmarshalInputOrganizationWhereInput(ctx context.Con return it, err } it.AvatarRemoteURLContainsFold = data + case "avatarLocalFileID": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileID")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileID = data + case "avatarLocalFileIDNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDNEQ")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDNEQ = data + case "avatarLocalFileIDIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDIn")) + data, err := ec.unmarshalOID2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDIn = data + case "avatarLocalFileIDNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDNotIn")) + data, err := ec.unmarshalOID2ᚕstringᚄ(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDNotIn = data + case "avatarLocalFileIDGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDGT")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDGT = data + case "avatarLocalFileIDGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDGTE")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDGTE = data + case "avatarLocalFileIDLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDLT")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDLT = data + case "avatarLocalFileIDLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDLTE")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDLTE = data + case "avatarLocalFileIDContains": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDContains")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDContains = data + case "avatarLocalFileIDHasPrefix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDHasPrefix")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDHasPrefix = data + case "avatarLocalFileIDHasSuffix": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDHasSuffix")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDHasSuffix = data + case "avatarLocalFileIDIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDIsNil = data + case "avatarLocalFileIDNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDNotNil = data + case "avatarLocalFileIDEqualFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDEqualFold")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDEqualFold = data + case "avatarLocalFileIDContainsFold": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIDContainsFold")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarLocalFileIDContainsFold = data + case "avatarUpdatedAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.AvatarUpdatedAt = data + case "avatarUpdatedAtNEQ": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAtNEQ")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.AvatarUpdatedAtNEQ = data + case "avatarUpdatedAtIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAtIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.AvatarUpdatedAtIn = data + case "avatarUpdatedAtNotIn": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAtNotIn")) + data, err := ec.unmarshalOTime2ᚕtimeᚐTimeᚄ(ctx, v) + if err != nil { + return it, err + } + it.AvatarUpdatedAtNotIn = data + case "avatarUpdatedAtGT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAtGT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.AvatarUpdatedAtGT = data + case "avatarUpdatedAtGTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAtGTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.AvatarUpdatedAtGTE = data + case "avatarUpdatedAtLT": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAtLT")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.AvatarUpdatedAtLT = data + case "avatarUpdatedAtLTE": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAtLTE")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.AvatarUpdatedAtLTE = data + case "avatarUpdatedAtIsNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAtIsNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.AvatarUpdatedAtIsNil = data + case "avatarUpdatedAtNotNil": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAtNotNil")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.AvatarUpdatedAtNotNil = data case "hasControlCreators": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasControlCreators")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) @@ -177646,6 +178477,20 @@ func (ec *executionContext) unmarshalInputOrganizationWhereInput(ctx context.Con return it, err } it.HasFilesWith = data + case "hasAvatarFile": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasAvatarFile")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasAvatarFile = data + case "hasAvatarFileWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasAvatarFileWith")) + data, err := ec.unmarshalOFileWhereInput2ᚕᚖgithubᚗcomᚋtheopenlaneᚋcoreᚋinternalᚋentᚋgeneratedᚐFileWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasAvatarFileWith = data case "hasEntities": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasEntities")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) @@ -209153,7 +209998,7 @@ func (ec *executionContext) unmarshalInputUpdateOrganizationInput(ctx context.Co asMap[k] = v } - fieldsInOrder := [...]string{"tags", "appendTags", "clearTags", "name", "displayName", "description", "clearDescription", "avatarRemoteURL", "clearAvatarRemoteURL", "addControlCreatorIDs", "removeControlCreatorIDs", "clearControlCreators", "addControlObjectiveCreatorIDs", "removeControlObjectiveCreatorIDs", "clearControlObjectiveCreators", "addGroupCreatorIDs", "removeGroupCreatorIDs", "clearGroupCreators", "addInternalPolicyCreatorIDs", "removeInternalPolicyCreatorIDs", "clearInternalPolicyCreators", "addNarrativeCreatorIDs", "removeNarrativeCreatorIDs", "clearNarrativeCreators", "addProcedureCreatorIDs", "removeProcedureCreatorIDs", "clearProcedureCreators", "addProgramCreatorIDs", "removeProgramCreatorIDs", "clearProgramCreators", "addRiskCreatorIDs", "removeRiskCreatorIDs", "clearRiskCreators", "addTemplateCreatorIDs", "removeTemplateCreatorIDs", "clearTemplateCreators", "addGroupIDs", "removeGroupIDs", "clearGroups", "addTemplateIDs", "removeTemplateIDs", "clearTemplates", "addIntegrationIDs", "removeIntegrationIDs", "clearIntegrations", "settingID", "clearSetting", "addDocumentDatumIDs", "removeDocumentDatumIDs", "clearDocumentData", "addOrgSubscriptionIDs", "removeOrgSubscriptionIDs", "clearOrgSubscriptions", "addPersonalAccessTokenIDs", "removePersonalAccessTokenIDs", "clearPersonalAccessTokens", "addAPITokenIDs", "removeAPITokenIDs", "clearAPITokens", "addUserIDs", "removeUserIDs", "clearUsers", "addInviteIDs", "removeInviteIDs", "clearInvites", "addSubscriberIDs", "removeSubscriberIDs", "clearSubscribers", "addEventIDs", "removeEventIDs", "clearEvents", "addSecretIDs", "removeSecretIDs", "clearSecrets", "addFileIDs", "removeFileIDs", "clearFiles", "addEntityIDs", "removeEntityIDs", "clearEntities", "addEntityTypeIDs", "removeEntityTypeIDs", "clearEntityTypes", "addContactIDs", "removeContactIDs", "clearContacts", "addNoteIDs", "removeNoteIDs", "clearNotes", "addTaskIDs", "removeTaskIDs", "clearTasks", "addProgramIDs", "removeProgramIDs", "clearPrograms", "addProcedureIDs", "removeProcedureIDs", "clearProcedures", "addInternalPolicyIDs", "removeInternalPolicyIDs", "clearInternalPolicies", "addRiskIDs", "removeRiskIDs", "clearRisks", "addControlObjectiveIDs", "removeControlObjectiveIDs", "clearControlObjectives", "addNarrativeIDs", "removeNarrativeIDs", "clearNarratives", "addControlIDs", "removeControlIDs", "clearControls", "addSubcontrolIDs", "removeSubcontrolIDs", "clearSubcontrols", "addOrgMembers", "updateOrgSettings"} + fieldsInOrder := [...]string{"tags", "appendTags", "clearTags", "name", "displayName", "description", "clearDescription", "avatarRemoteURL", "clearAvatarRemoteURL", "avatarUpdatedAt", "clearAvatarUpdatedAt", "addControlCreatorIDs", "removeControlCreatorIDs", "clearControlCreators", "addControlObjectiveCreatorIDs", "removeControlObjectiveCreatorIDs", "clearControlObjectiveCreators", "addGroupCreatorIDs", "removeGroupCreatorIDs", "clearGroupCreators", "addInternalPolicyCreatorIDs", "removeInternalPolicyCreatorIDs", "clearInternalPolicyCreators", "addNarrativeCreatorIDs", "removeNarrativeCreatorIDs", "clearNarrativeCreators", "addProcedureCreatorIDs", "removeProcedureCreatorIDs", "clearProcedureCreators", "addProgramCreatorIDs", "removeProgramCreatorIDs", "clearProgramCreators", "addRiskCreatorIDs", "removeRiskCreatorIDs", "clearRiskCreators", "addTemplateCreatorIDs", "removeTemplateCreatorIDs", "clearTemplateCreators", "addGroupIDs", "removeGroupIDs", "clearGroups", "addTemplateIDs", "removeTemplateIDs", "clearTemplates", "addIntegrationIDs", "removeIntegrationIDs", "clearIntegrations", "settingID", "clearSetting", "addDocumentDatumIDs", "removeDocumentDatumIDs", "clearDocumentData", "addOrgSubscriptionIDs", "removeOrgSubscriptionIDs", "clearOrgSubscriptions", "addPersonalAccessTokenIDs", "removePersonalAccessTokenIDs", "clearPersonalAccessTokens", "addAPITokenIDs", "removeAPITokenIDs", "clearAPITokens", "addUserIDs", "removeUserIDs", "clearUsers", "addInviteIDs", "removeInviteIDs", "clearInvites", "addSubscriberIDs", "removeSubscriberIDs", "clearSubscribers", "addEventIDs", "removeEventIDs", "clearEvents", "addSecretIDs", "removeSecretIDs", "clearSecrets", "addFileIDs", "removeFileIDs", "clearFiles", "avatarFileID", "clearAvatarFile", "addEntityIDs", "removeEntityIDs", "clearEntities", "addEntityTypeIDs", "removeEntityTypeIDs", "clearEntityTypes", "addContactIDs", "removeContactIDs", "clearContacts", "addNoteIDs", "removeNoteIDs", "clearNotes", "addTaskIDs", "removeTaskIDs", "clearTasks", "addProgramIDs", "removeProgramIDs", "clearPrograms", "addProcedureIDs", "removeProcedureIDs", "clearProcedures", "addInternalPolicyIDs", "removeInternalPolicyIDs", "clearInternalPolicies", "addRiskIDs", "removeRiskIDs", "clearRisks", "addControlObjectiveIDs", "removeControlObjectiveIDs", "clearControlObjectives", "addNarrativeIDs", "removeNarrativeIDs", "clearNarratives", "addControlIDs", "removeControlIDs", "clearControls", "addSubcontrolIDs", "removeSubcontrolIDs", "clearSubcontrols", "addOrgMembers", "updateOrgSettings"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -209223,6 +210068,20 @@ func (ec *executionContext) unmarshalInputUpdateOrganizationInput(ctx context.Co return it, err } it.ClearAvatarRemoteURL = data + case "avatarUpdatedAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.AvatarUpdatedAt = data + case "clearAvatarUpdatedAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clearAvatarUpdatedAt")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.ClearAvatarUpdatedAt = data case "addControlCreatorIDs": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("addControlCreatorIDs")) data, err := ec.unmarshalOID2ᚕstringᚄ(ctx, v) @@ -209699,6 +210558,20 @@ func (ec *executionContext) unmarshalInputUpdateOrganizationInput(ctx context.Co return it, err } it.ClearFiles = data + case "avatarFileID": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarFileID")) + data, err := ec.unmarshalOID2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.AvatarFileID = data + case "clearAvatarFile": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clearAvatarFile")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.ClearAvatarFile = data case "addEntityIDs": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("addEntityIDs")) data, err := ec.unmarshalOID2ᚕstringᚄ(ctx, v) @@ -212753,7 +213626,7 @@ func (ec *executionContext) unmarshalInputUpdateUserInput(ctx context.Context, o asMap[k] = v } - fieldsInOrder := [...]string{"tags", "appendTags", "clearTags", "email", "firstName", "clearFirstName", "lastName", "clearLastName", "displayName", "avatarRemoteURL", "clearAvatarRemoteURL", "avatarLocalFile", "clearAvatarLocalFile", "avatarUpdatedAt", "clearAvatarUpdatedAt", "lastSeen", "clearLastSeen", "password", "clearPassword", "sub", "clearSub", "authProvider", "role", "clearRole", "addPersonalAccessTokenIDs", "removePersonalAccessTokenIDs", "clearPersonalAccessTokens", "addTfaSettingIDs", "removeTfaSettingIDs", "clearTfaSettings", "settingID", "addEmailVerificationTokenIDs", "removeEmailVerificationTokenIDs", "clearEmailVerificationTokens", "addPasswordResetTokenIDs", "removePasswordResetTokenIDs", "clearPasswordResetTokens", "addGroupIDs", "removeGroupIDs", "clearGroups", "addOrganizationIDs", "removeOrganizationIDs", "clearOrganizations", "addWebauthnIDs", "removeWebauthnIDs", "clearWebauthn", "addFileIDs", "removeFileIDs", "clearFiles", "fileID", "clearFile", "addEventIDs", "removeEventIDs", "clearEvents", "addActionPlanIDs", "removeActionPlanIDs", "clearActionPlans", "addSubcontrolIDs", "removeSubcontrolIDs", "clearSubcontrols", "addAssignerTaskIDs", "removeAssignerTaskIDs", "clearAssignerTasks", "addAssigneeTaskIDs", "removeAssigneeTaskIDs", "clearAssigneeTasks", "addProgramIDs", "removeProgramIDs", "clearPrograms"} + fieldsInOrder := [...]string{"tags", "appendTags", "clearTags", "email", "firstName", "clearFirstName", "lastName", "clearLastName", "displayName", "avatarRemoteURL", "clearAvatarRemoteURL", "avatarUpdatedAt", "clearAvatarUpdatedAt", "lastSeen", "clearLastSeen", "password", "clearPassword", "sub", "clearSub", "authProvider", "role", "clearRole", "addPersonalAccessTokenIDs", "removePersonalAccessTokenIDs", "clearPersonalAccessTokens", "addTfaSettingIDs", "removeTfaSettingIDs", "clearTfaSettings", "settingID", "addEmailVerificationTokenIDs", "removeEmailVerificationTokenIDs", "clearEmailVerificationTokens", "addPasswordResetTokenIDs", "removePasswordResetTokenIDs", "clearPasswordResetTokens", "addGroupIDs", "removeGroupIDs", "clearGroups", "addOrganizationIDs", "removeOrganizationIDs", "clearOrganizations", "addWebauthnIDs", "removeWebauthnIDs", "clearWebauthn", "addFileIDs", "removeFileIDs", "clearFiles", "avatarFileID", "clearAvatarFile", "addEventIDs", "removeEventIDs", "clearEvents", "addActionPlanIDs", "removeActionPlanIDs", "clearActionPlans", "addSubcontrolIDs", "removeSubcontrolIDs", "clearSubcontrols", "addAssignerTaskIDs", "removeAssignerTaskIDs", "clearAssignerTasks", "addAssigneeTaskIDs", "removeAssigneeTaskIDs", "clearAssigneeTasks", "addProgramIDs", "removeProgramIDs", "clearPrograms"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -212837,20 +213710,6 @@ func (ec *executionContext) unmarshalInputUpdateUserInput(ctx context.Context, o return it, err } it.ClearAvatarRemoteURL = data - case "avatarLocalFile": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFile")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFile = data - case "clearAvatarLocalFile": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clearAvatarLocalFile")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.ClearAvatarLocalFile = data case "avatarUpdatedAt": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarUpdatedAt")) data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) @@ -213103,20 +213962,20 @@ func (ec *executionContext) unmarshalInputUpdateUserInput(ctx context.Context, o return it, err } it.ClearFiles = data - case "fileID": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("fileID")) + case "avatarFileID": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarFileID")) data, err := ec.unmarshalOID2ᚖstring(ctx, v) if err != nil { return it, err } - it.FileID = data - case "clearFile": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clearFile")) + it.AvatarFileID = data + case "clearAvatarFile": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clearAvatarFile")) data, err := ec.unmarshalOBoolean2bool(ctx, v) if err != nil { return it, err } - it.ClearFile = data + it.ClearAvatarFile = data case "addEventIDs": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("addEventIDs")) data, err := ec.unmarshalOID2ᚕstringᚄ(ctx, v) @@ -213461,7 +214320,7 @@ func (ec *executionContext) unmarshalInputUserHistoryWhereInput(ctx context.Cont asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "idEqualFold", "idContainsFold", "historyTime", "historyTimeNEQ", "historyTimeIn", "historyTimeNotIn", "historyTimeGT", "historyTimeGTE", "historyTimeLT", "historyTimeLTE", "ref", "refNEQ", "refIn", "refNotIn", "refGT", "refGTE", "refLT", "refLTE", "refContains", "refHasPrefix", "refHasSuffix", "refIsNil", "refNotNil", "refEqualFold", "refContainsFold", "operation", "operationNEQ", "operationIn", "operationNotIn", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "createdAtIsNil", "createdAtNotNil", "updatedAt", "updatedAtNEQ", "updatedAtIn", "updatedAtNotIn", "updatedAtGT", "updatedAtGTE", "updatedAtLT", "updatedAtLTE", "updatedAtIsNil", "updatedAtNotNil", "createdBy", "createdByNEQ", "createdByIn", "createdByNotIn", "createdByGT", "createdByGTE", "createdByLT", "createdByLTE", "createdByContains", "createdByHasPrefix", "createdByHasSuffix", "createdByIsNil", "createdByNotNil", "createdByEqualFold", "createdByContainsFold", "updatedBy", "updatedByNEQ", "updatedByIn", "updatedByNotIn", "updatedByGT", "updatedByGTE", "updatedByLT", "updatedByLTE", "updatedByContains", "updatedByHasPrefix", "updatedByHasSuffix", "updatedByIsNil", "updatedByNotNil", "updatedByEqualFold", "updatedByContainsFold", "deletedAt", "deletedAtNEQ", "deletedAtIn", "deletedAtNotIn", "deletedAtGT", "deletedAtGTE", "deletedAtLT", "deletedAtLTE", "deletedAtIsNil", "deletedAtNotNil", "deletedBy", "deletedByNEQ", "deletedByIn", "deletedByNotIn", "deletedByGT", "deletedByGTE", "deletedByLT", "deletedByLTE", "deletedByContains", "deletedByHasPrefix", "deletedByHasSuffix", "deletedByIsNil", "deletedByNotNil", "deletedByEqualFold", "deletedByContainsFold", "email", "emailNEQ", "emailIn", "emailNotIn", "emailGT", "emailGTE", "emailLT", "emailLTE", "emailContains", "emailHasPrefix", "emailHasSuffix", "emailEqualFold", "emailContainsFold", "firstName", "firstNameNEQ", "firstNameIn", "firstNameNotIn", "firstNameGT", "firstNameGTE", "firstNameLT", "firstNameLTE", "firstNameContains", "firstNameHasPrefix", "firstNameHasSuffix", "firstNameIsNil", "firstNameNotNil", "firstNameEqualFold", "firstNameContainsFold", "lastName", "lastNameNEQ", "lastNameIn", "lastNameNotIn", "lastNameGT", "lastNameGTE", "lastNameLT", "lastNameLTE", "lastNameContains", "lastNameHasPrefix", "lastNameHasSuffix", "lastNameIsNil", "lastNameNotNil", "lastNameEqualFold", "lastNameContainsFold", "displayName", "displayNameNEQ", "displayNameIn", "displayNameNotIn", "displayNameGT", "displayNameGTE", "displayNameLT", "displayNameLTE", "displayNameContains", "displayNameHasPrefix", "displayNameHasSuffix", "displayNameEqualFold", "displayNameContainsFold", "avatarRemoteURL", "avatarRemoteURLNEQ", "avatarRemoteURLIn", "avatarRemoteURLNotIn", "avatarRemoteURLGT", "avatarRemoteURLGTE", "avatarRemoteURLLT", "avatarRemoteURLLTE", "avatarRemoteURLContains", "avatarRemoteURLHasPrefix", "avatarRemoteURLHasSuffix", "avatarRemoteURLIsNil", "avatarRemoteURLNotNil", "avatarRemoteURLEqualFold", "avatarRemoteURLContainsFold", "avatarLocalFile", "avatarLocalFileNEQ", "avatarLocalFileIn", "avatarLocalFileNotIn", "avatarLocalFileGT", "avatarLocalFileGTE", "avatarLocalFileLT", "avatarLocalFileLTE", "avatarLocalFileContains", "avatarLocalFileHasPrefix", "avatarLocalFileHasSuffix", "avatarLocalFileIsNil", "avatarLocalFileNotNil", "avatarLocalFileEqualFold", "avatarLocalFileContainsFold", "avatarLocalFileID", "avatarLocalFileIDNEQ", "avatarLocalFileIDIn", "avatarLocalFileIDNotIn", "avatarLocalFileIDGT", "avatarLocalFileIDGTE", "avatarLocalFileIDLT", "avatarLocalFileIDLTE", "avatarLocalFileIDContains", "avatarLocalFileIDHasPrefix", "avatarLocalFileIDHasSuffix", "avatarLocalFileIDIsNil", "avatarLocalFileIDNotNil", "avatarLocalFileIDEqualFold", "avatarLocalFileIDContainsFold", "avatarUpdatedAt", "avatarUpdatedAtNEQ", "avatarUpdatedAtIn", "avatarUpdatedAtNotIn", "avatarUpdatedAtGT", "avatarUpdatedAtGTE", "avatarUpdatedAtLT", "avatarUpdatedAtLTE", "avatarUpdatedAtIsNil", "avatarUpdatedAtNotNil", "lastSeen", "lastSeenNEQ", "lastSeenIn", "lastSeenNotIn", "lastSeenGT", "lastSeenGTE", "lastSeenLT", "lastSeenLTE", "lastSeenIsNil", "lastSeenNotNil", "sub", "subNEQ", "subIn", "subNotIn", "subGT", "subGTE", "subLT", "subLTE", "subContains", "subHasPrefix", "subHasSuffix", "subIsNil", "subNotNil", "subEqualFold", "subContainsFold", "authProvider", "authProviderNEQ", "authProviderIn", "authProviderNotIn", "role", "roleNEQ", "roleIn", "roleNotIn", "roleIsNil", "roleNotNil"} + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "idEqualFold", "idContainsFold", "historyTime", "historyTimeNEQ", "historyTimeIn", "historyTimeNotIn", "historyTimeGT", "historyTimeGTE", "historyTimeLT", "historyTimeLTE", "ref", "refNEQ", "refIn", "refNotIn", "refGT", "refGTE", "refLT", "refLTE", "refContains", "refHasPrefix", "refHasSuffix", "refIsNil", "refNotNil", "refEqualFold", "refContainsFold", "operation", "operationNEQ", "operationIn", "operationNotIn", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "createdAtIsNil", "createdAtNotNil", "updatedAt", "updatedAtNEQ", "updatedAtIn", "updatedAtNotIn", "updatedAtGT", "updatedAtGTE", "updatedAtLT", "updatedAtLTE", "updatedAtIsNil", "updatedAtNotNil", "createdBy", "createdByNEQ", "createdByIn", "createdByNotIn", "createdByGT", "createdByGTE", "createdByLT", "createdByLTE", "createdByContains", "createdByHasPrefix", "createdByHasSuffix", "createdByIsNil", "createdByNotNil", "createdByEqualFold", "createdByContainsFold", "updatedBy", "updatedByNEQ", "updatedByIn", "updatedByNotIn", "updatedByGT", "updatedByGTE", "updatedByLT", "updatedByLTE", "updatedByContains", "updatedByHasPrefix", "updatedByHasSuffix", "updatedByIsNil", "updatedByNotNil", "updatedByEqualFold", "updatedByContainsFold", "deletedAt", "deletedAtNEQ", "deletedAtIn", "deletedAtNotIn", "deletedAtGT", "deletedAtGTE", "deletedAtLT", "deletedAtLTE", "deletedAtIsNil", "deletedAtNotNil", "deletedBy", "deletedByNEQ", "deletedByIn", "deletedByNotIn", "deletedByGT", "deletedByGTE", "deletedByLT", "deletedByLTE", "deletedByContains", "deletedByHasPrefix", "deletedByHasSuffix", "deletedByIsNil", "deletedByNotNil", "deletedByEqualFold", "deletedByContainsFold", "email", "emailNEQ", "emailIn", "emailNotIn", "emailGT", "emailGTE", "emailLT", "emailLTE", "emailContains", "emailHasPrefix", "emailHasSuffix", "emailEqualFold", "emailContainsFold", "firstName", "firstNameNEQ", "firstNameIn", "firstNameNotIn", "firstNameGT", "firstNameGTE", "firstNameLT", "firstNameLTE", "firstNameContains", "firstNameHasPrefix", "firstNameHasSuffix", "firstNameIsNil", "firstNameNotNil", "firstNameEqualFold", "firstNameContainsFold", "lastName", "lastNameNEQ", "lastNameIn", "lastNameNotIn", "lastNameGT", "lastNameGTE", "lastNameLT", "lastNameLTE", "lastNameContains", "lastNameHasPrefix", "lastNameHasSuffix", "lastNameIsNil", "lastNameNotNil", "lastNameEqualFold", "lastNameContainsFold", "displayName", "displayNameNEQ", "displayNameIn", "displayNameNotIn", "displayNameGT", "displayNameGTE", "displayNameLT", "displayNameLTE", "displayNameContains", "displayNameHasPrefix", "displayNameHasSuffix", "displayNameEqualFold", "displayNameContainsFold", "avatarRemoteURL", "avatarRemoteURLNEQ", "avatarRemoteURLIn", "avatarRemoteURLNotIn", "avatarRemoteURLGT", "avatarRemoteURLGTE", "avatarRemoteURLLT", "avatarRemoteURLLTE", "avatarRemoteURLContains", "avatarRemoteURLHasPrefix", "avatarRemoteURLHasSuffix", "avatarRemoteURLIsNil", "avatarRemoteURLNotNil", "avatarRemoteURLEqualFold", "avatarRemoteURLContainsFold", "avatarLocalFileID", "avatarLocalFileIDNEQ", "avatarLocalFileIDIn", "avatarLocalFileIDNotIn", "avatarLocalFileIDGT", "avatarLocalFileIDGTE", "avatarLocalFileIDLT", "avatarLocalFileIDLTE", "avatarLocalFileIDContains", "avatarLocalFileIDHasPrefix", "avatarLocalFileIDHasSuffix", "avatarLocalFileIDIsNil", "avatarLocalFileIDNotNil", "avatarLocalFileIDEqualFold", "avatarLocalFileIDContainsFold", "avatarUpdatedAt", "avatarUpdatedAtNEQ", "avatarUpdatedAtIn", "avatarUpdatedAtNotIn", "avatarUpdatedAtGT", "avatarUpdatedAtGTE", "avatarUpdatedAtLT", "avatarUpdatedAtLTE", "avatarUpdatedAtIsNil", "avatarUpdatedAtNotNil", "lastSeen", "lastSeenNEQ", "lastSeenIn", "lastSeenNotIn", "lastSeenGT", "lastSeenGTE", "lastSeenLT", "lastSeenLTE", "lastSeenIsNil", "lastSeenNotNil", "sub", "subNEQ", "subIn", "subNotIn", "subGT", "subGTE", "subLT", "subLTE", "subContains", "subHasPrefix", "subHasSuffix", "subIsNil", "subNotNil", "subEqualFold", "subContainsFold", "authProvider", "authProviderNEQ", "authProviderIn", "authProviderNotIn", "role", "roleNEQ", "roleIn", "roleNotIn", "roleIsNil", "roleNotNil"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -214770,111 +215629,6 @@ func (ec *executionContext) unmarshalInputUserHistoryWhereInput(ctx context.Cont return it, err } it.AvatarRemoteURLContainsFold = data - case "avatarLocalFile": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFile")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFile = data - case "avatarLocalFileNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileNEQ = data - case "avatarLocalFileIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileIn = data - case "avatarLocalFileNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileNotIn = data - case "avatarLocalFileGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileGT = data - case "avatarLocalFileGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileGTE = data - case "avatarLocalFileLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileLT = data - case "avatarLocalFileLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileLTE = data - case "avatarLocalFileContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileContains = data - case "avatarLocalFileHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileHasPrefix = data - case "avatarLocalFileHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileHasSuffix = data - case "avatarLocalFileIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileIsNil = data - case "avatarLocalFileNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileNotNil = data - case "avatarLocalFileEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileEqualFold = data - case "avatarLocalFileContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileContainsFold = data case "avatarLocalFileID": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileID")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) @@ -217563,7 +218317,7 @@ func (ec *executionContext) unmarshalInputUserWhereInput(ctx context.Context, ob asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "idEqualFold", "idContainsFold", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "createdAtIsNil", "createdAtNotNil", "updatedAt", "updatedAtNEQ", "updatedAtIn", "updatedAtNotIn", "updatedAtGT", "updatedAtGTE", "updatedAtLT", "updatedAtLTE", "updatedAtIsNil", "updatedAtNotNil", "createdBy", "createdByNEQ", "createdByIn", "createdByNotIn", "createdByGT", "createdByGTE", "createdByLT", "createdByLTE", "createdByContains", "createdByHasPrefix", "createdByHasSuffix", "createdByIsNil", "createdByNotNil", "createdByEqualFold", "createdByContainsFold", "updatedBy", "updatedByNEQ", "updatedByIn", "updatedByNotIn", "updatedByGT", "updatedByGTE", "updatedByLT", "updatedByLTE", "updatedByContains", "updatedByHasPrefix", "updatedByHasSuffix", "updatedByIsNil", "updatedByNotNil", "updatedByEqualFold", "updatedByContainsFold", "deletedAt", "deletedAtNEQ", "deletedAtIn", "deletedAtNotIn", "deletedAtGT", "deletedAtGTE", "deletedAtLT", "deletedAtLTE", "deletedAtIsNil", "deletedAtNotNil", "deletedBy", "deletedByNEQ", "deletedByIn", "deletedByNotIn", "deletedByGT", "deletedByGTE", "deletedByLT", "deletedByLTE", "deletedByContains", "deletedByHasPrefix", "deletedByHasSuffix", "deletedByIsNil", "deletedByNotNil", "deletedByEqualFold", "deletedByContainsFold", "email", "emailNEQ", "emailIn", "emailNotIn", "emailGT", "emailGTE", "emailLT", "emailLTE", "emailContains", "emailHasPrefix", "emailHasSuffix", "emailEqualFold", "emailContainsFold", "firstName", "firstNameNEQ", "firstNameIn", "firstNameNotIn", "firstNameGT", "firstNameGTE", "firstNameLT", "firstNameLTE", "firstNameContains", "firstNameHasPrefix", "firstNameHasSuffix", "firstNameIsNil", "firstNameNotNil", "firstNameEqualFold", "firstNameContainsFold", "lastName", "lastNameNEQ", "lastNameIn", "lastNameNotIn", "lastNameGT", "lastNameGTE", "lastNameLT", "lastNameLTE", "lastNameContains", "lastNameHasPrefix", "lastNameHasSuffix", "lastNameIsNil", "lastNameNotNil", "lastNameEqualFold", "lastNameContainsFold", "displayName", "displayNameNEQ", "displayNameIn", "displayNameNotIn", "displayNameGT", "displayNameGTE", "displayNameLT", "displayNameLTE", "displayNameContains", "displayNameHasPrefix", "displayNameHasSuffix", "displayNameEqualFold", "displayNameContainsFold", "avatarRemoteURL", "avatarRemoteURLNEQ", "avatarRemoteURLIn", "avatarRemoteURLNotIn", "avatarRemoteURLGT", "avatarRemoteURLGTE", "avatarRemoteURLLT", "avatarRemoteURLLTE", "avatarRemoteURLContains", "avatarRemoteURLHasPrefix", "avatarRemoteURLHasSuffix", "avatarRemoteURLIsNil", "avatarRemoteURLNotNil", "avatarRemoteURLEqualFold", "avatarRemoteURLContainsFold", "avatarLocalFile", "avatarLocalFileNEQ", "avatarLocalFileIn", "avatarLocalFileNotIn", "avatarLocalFileGT", "avatarLocalFileGTE", "avatarLocalFileLT", "avatarLocalFileLTE", "avatarLocalFileContains", "avatarLocalFileHasPrefix", "avatarLocalFileHasSuffix", "avatarLocalFileIsNil", "avatarLocalFileNotNil", "avatarLocalFileEqualFold", "avatarLocalFileContainsFold", "avatarLocalFileID", "avatarLocalFileIDNEQ", "avatarLocalFileIDIn", "avatarLocalFileIDNotIn", "avatarLocalFileIDGT", "avatarLocalFileIDGTE", "avatarLocalFileIDLT", "avatarLocalFileIDLTE", "avatarLocalFileIDContains", "avatarLocalFileIDHasPrefix", "avatarLocalFileIDHasSuffix", "avatarLocalFileIDIsNil", "avatarLocalFileIDNotNil", "avatarLocalFileIDEqualFold", "avatarLocalFileIDContainsFold", "avatarUpdatedAt", "avatarUpdatedAtNEQ", "avatarUpdatedAtIn", "avatarUpdatedAtNotIn", "avatarUpdatedAtGT", "avatarUpdatedAtGTE", "avatarUpdatedAtLT", "avatarUpdatedAtLTE", "avatarUpdatedAtIsNil", "avatarUpdatedAtNotNil", "lastSeen", "lastSeenNEQ", "lastSeenIn", "lastSeenNotIn", "lastSeenGT", "lastSeenGTE", "lastSeenLT", "lastSeenLTE", "lastSeenIsNil", "lastSeenNotNil", "sub", "subNEQ", "subIn", "subNotIn", "subGT", "subGTE", "subLT", "subLTE", "subContains", "subHasPrefix", "subHasSuffix", "subIsNil", "subNotNil", "subEqualFold", "subContainsFold", "authProvider", "authProviderNEQ", "authProviderIn", "authProviderNotIn", "role", "roleNEQ", "roleIn", "roleNotIn", "roleIsNil", "roleNotNil", "hasPersonalAccessTokens", "hasPersonalAccessTokensWith", "hasTfaSettings", "hasTfaSettingsWith", "hasSetting", "hasSettingWith", "hasGroups", "hasGroupsWith", "hasOrganizations", "hasOrganizationsWith", "hasFiles", "hasFilesWith", "hasFile", "hasFileWith", "hasEvents", "hasEventsWith", "hasActionPlans", "hasActionPlansWith", "hasSubcontrols", "hasSubcontrolsWith", "hasAssignerTasks", "hasAssignerTasksWith", "hasAssigneeTasks", "hasAssigneeTasksWith", "hasPrograms", "hasProgramsWith", "hasGroupMemberships", "hasGroupMembershipsWith", "hasOrgMemberships", "hasOrgMembershipsWith", "hasProgramMemberships", "hasProgramMembershipsWith"} + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "idEqualFold", "idContainsFold", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "createdAtIsNil", "createdAtNotNil", "updatedAt", "updatedAtNEQ", "updatedAtIn", "updatedAtNotIn", "updatedAtGT", "updatedAtGTE", "updatedAtLT", "updatedAtLTE", "updatedAtIsNil", "updatedAtNotNil", "createdBy", "createdByNEQ", "createdByIn", "createdByNotIn", "createdByGT", "createdByGTE", "createdByLT", "createdByLTE", "createdByContains", "createdByHasPrefix", "createdByHasSuffix", "createdByIsNil", "createdByNotNil", "createdByEqualFold", "createdByContainsFold", "updatedBy", "updatedByNEQ", "updatedByIn", "updatedByNotIn", "updatedByGT", "updatedByGTE", "updatedByLT", "updatedByLTE", "updatedByContains", "updatedByHasPrefix", "updatedByHasSuffix", "updatedByIsNil", "updatedByNotNil", "updatedByEqualFold", "updatedByContainsFold", "deletedAt", "deletedAtNEQ", "deletedAtIn", "deletedAtNotIn", "deletedAtGT", "deletedAtGTE", "deletedAtLT", "deletedAtLTE", "deletedAtIsNil", "deletedAtNotNil", "deletedBy", "deletedByNEQ", "deletedByIn", "deletedByNotIn", "deletedByGT", "deletedByGTE", "deletedByLT", "deletedByLTE", "deletedByContains", "deletedByHasPrefix", "deletedByHasSuffix", "deletedByIsNil", "deletedByNotNil", "deletedByEqualFold", "deletedByContainsFold", "email", "emailNEQ", "emailIn", "emailNotIn", "emailGT", "emailGTE", "emailLT", "emailLTE", "emailContains", "emailHasPrefix", "emailHasSuffix", "emailEqualFold", "emailContainsFold", "firstName", "firstNameNEQ", "firstNameIn", "firstNameNotIn", "firstNameGT", "firstNameGTE", "firstNameLT", "firstNameLTE", "firstNameContains", "firstNameHasPrefix", "firstNameHasSuffix", "firstNameIsNil", "firstNameNotNil", "firstNameEqualFold", "firstNameContainsFold", "lastName", "lastNameNEQ", "lastNameIn", "lastNameNotIn", "lastNameGT", "lastNameGTE", "lastNameLT", "lastNameLTE", "lastNameContains", "lastNameHasPrefix", "lastNameHasSuffix", "lastNameIsNil", "lastNameNotNil", "lastNameEqualFold", "lastNameContainsFold", "displayName", "displayNameNEQ", "displayNameIn", "displayNameNotIn", "displayNameGT", "displayNameGTE", "displayNameLT", "displayNameLTE", "displayNameContains", "displayNameHasPrefix", "displayNameHasSuffix", "displayNameEqualFold", "displayNameContainsFold", "avatarRemoteURL", "avatarRemoteURLNEQ", "avatarRemoteURLIn", "avatarRemoteURLNotIn", "avatarRemoteURLGT", "avatarRemoteURLGTE", "avatarRemoteURLLT", "avatarRemoteURLLTE", "avatarRemoteURLContains", "avatarRemoteURLHasPrefix", "avatarRemoteURLHasSuffix", "avatarRemoteURLIsNil", "avatarRemoteURLNotNil", "avatarRemoteURLEqualFold", "avatarRemoteURLContainsFold", "avatarLocalFileID", "avatarLocalFileIDNEQ", "avatarLocalFileIDIn", "avatarLocalFileIDNotIn", "avatarLocalFileIDGT", "avatarLocalFileIDGTE", "avatarLocalFileIDLT", "avatarLocalFileIDLTE", "avatarLocalFileIDContains", "avatarLocalFileIDHasPrefix", "avatarLocalFileIDHasSuffix", "avatarLocalFileIDIsNil", "avatarLocalFileIDNotNil", "avatarLocalFileIDEqualFold", "avatarLocalFileIDContainsFold", "avatarUpdatedAt", "avatarUpdatedAtNEQ", "avatarUpdatedAtIn", "avatarUpdatedAtNotIn", "avatarUpdatedAtGT", "avatarUpdatedAtGTE", "avatarUpdatedAtLT", "avatarUpdatedAtLTE", "avatarUpdatedAtIsNil", "avatarUpdatedAtNotNil", "lastSeen", "lastSeenNEQ", "lastSeenIn", "lastSeenNotIn", "lastSeenGT", "lastSeenGTE", "lastSeenLT", "lastSeenLTE", "lastSeenIsNil", "lastSeenNotNil", "sub", "subNEQ", "subIn", "subNotIn", "subGT", "subGTE", "subLT", "subLTE", "subContains", "subHasPrefix", "subHasSuffix", "subIsNil", "subNotNil", "subEqualFold", "subContainsFold", "authProvider", "authProviderNEQ", "authProviderIn", "authProviderNotIn", "role", "roleNEQ", "roleIn", "roleNotIn", "roleIsNil", "roleNotNil", "hasPersonalAccessTokens", "hasPersonalAccessTokensWith", "hasTfaSettings", "hasTfaSettingsWith", "hasSetting", "hasSettingWith", "hasGroups", "hasGroupsWith", "hasOrganizations", "hasOrganizationsWith", "hasFiles", "hasFilesWith", "hasAvatarFile", "hasAvatarFileWith", "hasEvents", "hasEventsWith", "hasActionPlans", "hasActionPlansWith", "hasSubcontrols", "hasSubcontrolsWith", "hasAssignerTasks", "hasAssignerTasksWith", "hasAssigneeTasks", "hasAssigneeTasksWith", "hasPrograms", "hasProgramsWith", "hasGroupMemberships", "hasGroupMembershipsWith", "hasOrgMemberships", "hasOrgMembershipsWith", "hasProgramMemberships", "hasProgramMembershipsWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -218683,111 +219437,6 @@ func (ec *executionContext) unmarshalInputUserWhereInput(ctx context.Context, ob return it, err } it.AvatarRemoteURLContainsFold = data - case "avatarLocalFile": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFile")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFile = data - case "avatarLocalFileNEQ": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileNEQ")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileNEQ = data - case "avatarLocalFileIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileIn = data - case "avatarLocalFileNotIn": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileNotIn")) - data, err := ec.unmarshalOString2ᚕstringᚄ(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileNotIn = data - case "avatarLocalFileGT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileGT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileGT = data - case "avatarLocalFileGTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileGTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileGTE = data - case "avatarLocalFileLT": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileLT")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileLT = data - case "avatarLocalFileLTE": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileLTE")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileLTE = data - case "avatarLocalFileContains": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileContains")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileContains = data - case "avatarLocalFileHasPrefix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileHasPrefix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileHasPrefix = data - case "avatarLocalFileHasSuffix": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileHasSuffix")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileHasSuffix = data - case "avatarLocalFileIsNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileIsNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileIsNil = data - case "avatarLocalFileNotNil": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileNotNil")) - data, err := ec.unmarshalOBoolean2bool(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileNotNil = data - case "avatarLocalFileEqualFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileEqualFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileEqualFold = data - case "avatarLocalFileContainsFold": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileContainsFold")) - data, err := ec.unmarshalOString2ᚖstring(ctx, v) - if err != nil { - return it, err - } - it.AvatarLocalFileContainsFold = data case "avatarLocalFileID": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("avatarLocalFileID")) data, err := ec.unmarshalOID2ᚖstring(ctx, v) @@ -219292,20 +219941,20 @@ func (ec *executionContext) unmarshalInputUserWhereInput(ctx context.Context, ob return it, err } it.HasFilesWith = data - case "hasFile": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasFile")) + case "hasAvatarFile": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasAvatarFile")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } - it.HasFile = data - case "hasFileWith": - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasFileWith")) + it.HasAvatarFile = data + case "hasAvatarFileWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasAvatarFileWith")) data, err := ec.unmarshalOFileWhereInput2ᚕᚖgithubᚗcomᚋtheopenlaneᚋcoreᚋinternalᚋentᚋgeneratedᚐFileWhereInputᚄ(ctx, v) if err != nil { return it, err } - it.HasFileWith = data + it.HasAvatarFileWith = data case "hasEvents": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasEvents")) data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) @@ -224926,6 +225575,8 @@ func (ec *executionContext) _File(ctx context.Context, sel ast.SelectionSet, obj } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "presignedURL": + out.Values[i] = ec._File_presignedURL(ctx, field, obj) default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -231113,6 +231764,10 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection out.Values[i] = ec._Organization_personalOrg(ctx, field, obj) case "avatarRemoteURL": out.Values[i] = ec._Organization_avatarRemoteURL(ctx, field, obj) + case "avatarLocalFileID": + out.Values[i] = ec._Organization_avatarLocalFileID(ctx, field, obj) + case "avatarUpdatedAt": + out.Values[i] = ec._Organization_avatarUpdatedAt(ctx, field, obj) case "dedicatedDb": out.Values[i] = ec._Organization_dedicatedDb(ctx, field, obj) if out.Values[i] == graphql.Null { @@ -231184,307 +231839,340 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "groupCreators": - field := field - - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Organization_groupCreators(ctx, field, obj) - return res - } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "internalPolicyCreators": - field := field - - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Organization_internalPolicyCreators(ctx, field, obj) - return res - } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "narrativeCreators": - field := field - - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Organization_narrativeCreators(ctx, field, obj) - return res - } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "procedureCreators": - field := field - - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Organization_procedureCreators(ctx, field, obj) - return res - } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "programCreators": - field := field - - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Organization_programCreators(ctx, field, obj) - return res - } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "riskCreators": - field := field - - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Organization_riskCreators(ctx, field, obj) - return res - } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "templateCreators": - field := field - - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Organization_templateCreators(ctx, field, obj) - return res - } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "parent": - field := field - - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Organization_parent(ctx, field, obj) - return res - } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "children": - field := field - - innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Organization_children(ctx, field, obj) - if res == graphql.Null { - atomic.AddUint32(&fs.Invalids, 1) - } - return res - } - - if field.Deferrable != nil { - dfs, ok := deferred[field.Deferrable.Label] - di := 0 - if ok { - dfs.AddField(field) - di = len(dfs.Values) - 1 - } else { - dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) - deferred[field.Deferrable.Label] = dfs - } - dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { - return innerFunc(ctx, dfs) - }) - - // don't run the out.Concurrently() call below - out.Values[i] = graphql.Null - continue - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "groups": + case "groupCreators": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Organization_groupCreators(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "internalPolicyCreators": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Organization_internalPolicyCreators(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "narrativeCreators": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Organization_narrativeCreators(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "procedureCreators": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Organization_procedureCreators(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "programCreators": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Organization_programCreators(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "riskCreators": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Organization_riskCreators(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "templateCreators": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Organization_templateCreators(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "parent": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Organization_parent(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "children": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Organization_children(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "groups": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Organization_groups(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "templates": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { @@ -231493,7 +232181,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Organization_groups(ctx, field, obj) + res = ec._Organization_templates(ctx, field, obj) return res } @@ -231517,7 +232205,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "templates": + case "integrations": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { @@ -231526,7 +232214,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Organization_templates(ctx, field, obj) + res = ec._Organization_integrations(ctx, field, obj) return res } @@ -231550,7 +232238,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "integrations": + case "setting": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { @@ -231559,7 +232247,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Organization_integrations(ctx, field, obj) + res = ec._Organization_setting(ctx, field, obj) return res } @@ -231583,7 +232271,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "setting": + case "documentData": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { @@ -231592,7 +232280,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Organization_setting(ctx, field, obj) + res = ec._Organization_documentData(ctx, field, obj) return res } @@ -231616,7 +232304,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "documentData": + case "orgSubscriptions": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { @@ -231625,7 +232313,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Organization_documentData(ctx, field, obj) + res = ec._Organization_orgSubscriptions(ctx, field, obj) return res } @@ -231649,7 +232337,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "orgSubscriptions": + case "personalAccessTokens": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { @@ -231658,7 +232346,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Organization_orgSubscriptions(ctx, field, obj) + res = ec._Organization_personalAccessTokens(ctx, field, obj) return res } @@ -231682,7 +232370,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "personalAccessTokens": + case "apiTokens": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { @@ -231691,7 +232379,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Organization_personalAccessTokens(ctx, field, obj) + res = ec._Organization_apiTokens(ctx, field, obj) return res } @@ -231715,7 +232403,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "apiTokens": + case "users": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { @@ -231724,7 +232412,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Organization_apiTokens(ctx, field, obj) + res = ec._Organization_users(ctx, field, obj) return res } @@ -231748,7 +232436,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "users": + case "invites": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { @@ -231757,7 +232445,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Organization_users(ctx, field, obj) + res = ec._Organization_invites(ctx, field, obj) return res } @@ -231781,7 +232469,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "invites": + case "subscribers": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { @@ -231790,7 +232478,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Organization_invites(ctx, field, obj) + res = ec._Organization_subscribers(ctx, field, obj) return res } @@ -231814,7 +232502,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "subscribers": + case "events": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { @@ -231823,7 +232511,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Organization_subscribers(ctx, field, obj) + res = ec._Organization_events(ctx, field, obj) return res } @@ -231847,7 +232535,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "events": + case "secrets": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { @@ -231856,7 +232544,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Organization_events(ctx, field, obj) + res = ec._Organization_secrets(ctx, field, obj) return res } @@ -231880,7 +232568,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "secrets": + case "files": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { @@ -231889,7 +232577,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Organization_secrets(ctx, field, obj) + res = ec._Organization_files(ctx, field, obj) return res } @@ -231913,7 +232601,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "files": + case "avatarFile": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { @@ -231922,7 +232610,7 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._Organization_files(ctx, field, obj) + res = ec._Organization_avatarFile(ctx, field, obj) return res } @@ -232576,6 +233264,10 @@ func (ec *executionContext) _OrganizationHistory(ctx context.Context, sel ast.Se out.Values[i] = ec._OrganizationHistory_personalOrg(ctx, field, obj) case "avatarRemoteURL": out.Values[i] = ec._OrganizationHistory_avatarRemoteURL(ctx, field, obj) + case "avatarLocalFileID": + out.Values[i] = ec._OrganizationHistory_avatarLocalFileID(ctx, field, obj) + case "avatarUpdatedAt": + out.Values[i] = ec._OrganizationHistory_avatarUpdatedAt(ctx, field, obj) case "dedicatedDb": out.Values[i] = ec._OrganizationHistory_dedicatedDb(ctx, field, obj) if out.Values[i] == graphql.Null { @@ -242159,8 +242851,6 @@ func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj } case "avatarRemoteURL": out.Values[i] = ec._User_avatarRemoteURL(ctx, field, obj) - case "avatarLocalFile": - out.Values[i] = ec._User_avatarLocalFile(ctx, field, obj) case "avatarLocalFileID": out.Values[i] = ec._User_avatarLocalFileID(ctx, field, obj) case "avatarUpdatedAt": @@ -242377,7 +243067,7 @@ func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj } out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - case "file": + case "avatarFile": field := field innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { @@ -242386,7 +243076,7 @@ func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj ec.Error(ctx, ec.Recover(ctx, r)) } }() - res = ec._User_file(ctx, field, obj) + res = ec._User_avatarFile(ctx, field, obj) return res } @@ -242875,8 +243565,6 @@ func (ec *executionContext) _UserHistory(ctx context.Context, sel ast.SelectionS } case "avatarRemoteURL": out.Values[i] = ec._UserHistory_avatarRemoteURL(ctx, field, obj) - case "avatarLocalFile": - out.Values[i] = ec._UserHistory_avatarLocalFile(ctx, field, obj) case "avatarLocalFileID": out.Values[i] = ec._UserHistory_avatarLocalFileID(ctx, field, obj) case "avatarUpdatedAt": diff --git a/internal/graphapi/generated/organization.generated.go b/internal/graphapi/generated/organization.generated.go index acb12e90..fa5fa1dc 100644 --- a/internal/graphapi/generated/organization.generated.go +++ b/internal/graphapi/generated/organization.generated.go @@ -91,6 +91,10 @@ func (ec *executionContext) fieldContext_OrganizationBulkCreatePayload_organizat return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -143,6 +147,8 @@ func (ec *executionContext) fieldContext_OrganizationBulkCreatePayload_organizat return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -243,6 +249,10 @@ func (ec *executionContext) fieldContext_OrganizationCreatePayload_organization( return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -295,6 +305,8 @@ func (ec *executionContext) fieldContext_OrganizationCreatePayload_organization( return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -439,6 +451,10 @@ func (ec *executionContext) fieldContext_OrganizationUpdatePayload_organization( return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -491,6 +507,8 @@ func (ec *executionContext) fieldContext_OrganizationUpdatePayload_organization( return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": diff --git a/internal/graphapi/generated/root_.generated.go b/internal/graphapi/generated/root_.generated.go index 865fe925..472595dc 100644 --- a/internal/graphapi/generated/root_.generated.go +++ b/internal/graphapi/generated/root_.generated.go @@ -840,6 +840,7 @@ type ComplexityRoot struct { Organization func(childComplexity int) int OrganizationSetting func(childComplexity int) int PersistedFileSize func(childComplexity int) int + PresignedURL func(childComplexity int) int Program func(childComplexity int) int ProvidedFileExtension func(childComplexity int) int ProvidedFileName func(childComplexity int) int @@ -1550,7 +1551,7 @@ type ComplexityRoot struct { CreateInvite func(childComplexity int, input generated.CreateInviteInput) int CreateNarrative func(childComplexity int, input generated.CreateNarrativeInput) int CreateOrgMembership func(childComplexity int, input generated.CreateOrgMembershipInput) int - CreateOrganization func(childComplexity int, input generated.CreateOrganizationInput) int + CreateOrganization func(childComplexity int, input generated.CreateOrganizationInput, avatarFile *graphql.Upload) int CreateOrganizationSetting func(childComplexity int, input generated.CreateOrganizationSettingInput) int CreatePersonalAccessToken func(childComplexity int, input generated.CreatePersonalAccessTokenInput) int CreateProcedure func(childComplexity int, input generated.CreateProcedureInput) int @@ -1616,7 +1617,7 @@ type ComplexityRoot struct { UpdateInvite func(childComplexity int, id string, input generated.UpdateInviteInput) int UpdateNarrative func(childComplexity int, id string, input generated.UpdateNarrativeInput) int UpdateOrgMembership func(childComplexity int, id string, input generated.UpdateOrgMembershipInput) int - UpdateOrganization func(childComplexity int, id string, input generated.UpdateOrganizationInput) int + UpdateOrganization func(childComplexity int, id string, input generated.UpdateOrganizationInput, avatarFile *graphql.Upload) int UpdateOrganizationSetting func(childComplexity int, id string, input generated.UpdateOrganizationSettingInput) int UpdatePersonalAccessToken func(childComplexity int, id string, input generated.UpdatePersonalAccessTokenInput) int UpdateProcedure func(childComplexity int, id string, input generated.UpdateProcedureInput) int @@ -1921,7 +1922,10 @@ type ComplexityRoot struct { Organization struct { APITokens func(childComplexity int) int + AvatarFile func(childComplexity int) int + AvatarLocalFileID func(childComplexity int) int AvatarRemoteURL func(childComplexity int) int + AvatarUpdatedAt func(childComplexity int) int Children func(childComplexity int, after *entgql.Cursor[string], first *int, before *entgql.Cursor[string], last *int, orderBy *generated.OrganizationOrder, where *generated.OrganizationWhereInput) int Contacts func(childComplexity int) int ControlCreators func(childComplexity int) int @@ -1999,23 +2003,25 @@ type ComplexityRoot struct { } OrganizationHistory struct { - AvatarRemoteURL func(childComplexity int) int - CreatedAt func(childComplexity int) int - CreatedBy func(childComplexity int) int - DedicatedDb func(childComplexity int) int - DeletedAt func(childComplexity int) int - DeletedBy func(childComplexity int) int - Description func(childComplexity int) int - DisplayName func(childComplexity int) int - HistoryTime func(childComplexity int) int - ID func(childComplexity int) int - Name func(childComplexity int) int - Operation func(childComplexity int) int - PersonalOrg func(childComplexity int) int - Ref func(childComplexity int) int - Tags func(childComplexity int) int - UpdatedAt func(childComplexity int) int - UpdatedBy func(childComplexity int) int + AvatarLocalFileID func(childComplexity int) int + AvatarRemoteURL func(childComplexity int) int + AvatarUpdatedAt func(childComplexity int) int + CreatedAt func(childComplexity int) int + CreatedBy func(childComplexity int) int + DedicatedDb func(childComplexity int) int + DeletedAt func(childComplexity int) int + DeletedBy func(childComplexity int) int + Description func(childComplexity int) int + DisplayName func(childComplexity int) int + HistoryTime func(childComplexity int) int + ID func(childComplexity int) int + Name func(childComplexity int) int + Operation func(childComplexity int) int + PersonalOrg func(childComplexity int) int + Ref func(childComplexity int) int + Tags func(childComplexity int) int + UpdatedAt func(childComplexity int) int + UpdatedBy func(childComplexity int) int } OrganizationHistoryConnection struct { @@ -3187,7 +3193,7 @@ type ComplexityRoot struct { AssigneeTasks func(childComplexity int) int AssignerTasks func(childComplexity int) int AuthProvider func(childComplexity int) int - AvatarLocalFile func(childComplexity int) int + AvatarFile func(childComplexity int) int AvatarLocalFileID func(childComplexity int) int AvatarRemoteURL func(childComplexity int) int AvatarUpdatedAt func(childComplexity int) int @@ -3198,7 +3204,6 @@ type ComplexityRoot struct { DisplayName func(childComplexity int) int Email func(childComplexity int) int Events func(childComplexity int) int - File func(childComplexity int) int Files func(childComplexity int) int FirstName func(childComplexity int) int GroupMemberships func(childComplexity int) int @@ -3246,7 +3251,6 @@ type ComplexityRoot struct { UserHistory struct { AuthProvider func(childComplexity int) int - AvatarLocalFile func(childComplexity int) int AvatarLocalFileID func(childComplexity int) int AvatarRemoteURL func(childComplexity int) int AvatarUpdatedAt func(childComplexity int) int @@ -6828,6 +6832,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.File.PersistedFileSize(childComplexity), true + case "File.presignedURL": + if e.complexity.File.PresignedURL == nil { + break + } + + return e.complexity.File.PresignedURL(childComplexity), true + case "File.program": if e.complexity.File.Program == nil { break @@ -10559,7 +10570,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Mutation.CreateOrganization(childComplexity, args["input"].(generated.CreateOrganizationInput)), true + return e.complexity.Mutation.CreateOrganization(childComplexity, args["input"].(generated.CreateOrganizationInput), args["avatarFile"].(*graphql.Upload)), true case "Mutation.createOrganizationSetting": if e.complexity.Mutation.CreateOrganizationSetting == nil { @@ -11351,7 +11362,7 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return 0, false } - return e.complexity.Mutation.UpdateOrganization(childComplexity, args["id"].(string), args["input"].(generated.UpdateOrganizationInput)), true + return e.complexity.Mutation.UpdateOrganization(childComplexity, args["id"].(string), args["input"].(generated.UpdateOrganizationInput), args["avatarFile"].(*graphql.Upload)), true case "Mutation.updateOrganizationSetting": if e.complexity.Mutation.UpdateOrganizationSetting == nil { @@ -12816,6 +12827,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Organization.APITokens(childComplexity), true + case "Organization.avatarFile": + if e.complexity.Organization.AvatarFile == nil { + break + } + + return e.complexity.Organization.AvatarFile(childComplexity), true + + case "Organization.avatarLocalFileID": + if e.complexity.Organization.AvatarLocalFileID == nil { + break + } + + return e.complexity.Organization.AvatarLocalFileID(childComplexity), true + case "Organization.avatarRemoteURL": if e.complexity.Organization.AvatarRemoteURL == nil { break @@ -12823,6 +12848,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Organization.AvatarRemoteURL(childComplexity), true + case "Organization.avatarUpdatedAt": + if e.complexity.Organization.AvatarUpdatedAt == nil { + break + } + + return e.complexity.Organization.AvatarUpdatedAt(childComplexity), true + case "Organization.children": if e.complexity.Organization.Children == nil { break @@ -13241,6 +13273,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.OrganizationEdge.Node(childComplexity), true + case "OrganizationHistory.avatarLocalFileID": + if e.complexity.OrganizationHistory.AvatarLocalFileID == nil { + break + } + + return e.complexity.OrganizationHistory.AvatarLocalFileID(childComplexity), true + case "OrganizationHistory.avatarRemoteURL": if e.complexity.OrganizationHistory.AvatarRemoteURL == nil { break @@ -13248,6 +13287,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.OrganizationHistory.AvatarRemoteURL(childComplexity), true + case "OrganizationHistory.avatarUpdatedAt": + if e.complexity.OrganizationHistory.AvatarUpdatedAt == nil { + break + } + + return e.complexity.OrganizationHistory.AvatarUpdatedAt(childComplexity), true + case "OrganizationHistory.createdAt": if e.complexity.OrganizationHistory.CreatedAt == nil { break @@ -19704,12 +19750,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.User.AuthProvider(childComplexity), true - case "User.avatarLocalFile": - if e.complexity.User.AvatarLocalFile == nil { + case "User.avatarFile": + if e.complexity.User.AvatarFile == nil { break } - return e.complexity.User.AvatarLocalFile(childComplexity), true + return e.complexity.User.AvatarFile(childComplexity), true case "User.avatarLocalFileID": if e.complexity.User.AvatarLocalFileID == nil { @@ -19781,13 +19827,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.User.Events(childComplexity), true - case "User.file": - if e.complexity.User.File == nil { - break - } - - return e.complexity.User.File(childComplexity), true - case "User.files": if e.complexity.User.Files == nil { break @@ -19991,13 +20030,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.UserHistory.AuthProvider(childComplexity), true - case "UserHistory.avatarLocalFile": - if e.complexity.UserHistory.AvatarLocalFile == nil { - break - } - - return e.complexity.UserHistory.AvatarLocalFile(childComplexity), true - case "UserHistory.avatarLocalFileID": if e.complexity.UserHistory.AvatarLocalFileID == nil { break @@ -26060,6 +26092,10 @@ input CreateOrganizationInput { """ avatarRemoteURL: String """ + The time the user's (local) avatar was last updated + """ + avatarUpdatedAt: Time + """ Whether the organization has a dedicated database """ dedicatedDb: Boolean @@ -26087,6 +26123,7 @@ input CreateOrganizationInput { eventIDs: [ID!] secretIDs: [ID!] fileIDs: [ID!] + avatarFileID: ID entityIDs: [ID!] entityTypeIDs: [ID!] contactIDs: [ID!] @@ -26621,10 +26658,6 @@ input CreateUserInput { """ avatarRemoteURL: String """ - The user's local avatar file - """ - avatarLocalFile: String - """ The time the user's (local) avatar was last updated """ avatarUpdatedAt: Time @@ -26657,7 +26690,7 @@ input CreateUserInput { organizationIDs: [ID!] webauthnIDs: [ID!] fileIDs: [ID!] - fileID: ID + avatarFileID: ID eventIDs: [ID!] actionPlanIDs: [ID!] subcontrolIDs: [ID!] @@ -35978,6 +36011,14 @@ type Organization implements Node { """ avatarRemoteURL: String """ + The organizations's local avatar file id, takes precedence over the avatar remote URL + """ + avatarLocalFileID: ID + """ + The time the user's (local) avatar was last updated + """ + avatarUpdatedAt: Time + """ Whether the organization has a dedicated database """ dedicatedDb: Boolean! @@ -36063,6 +36104,7 @@ type Organization implements Node { events: [Event!] secrets: [Hush!] files: [File!] + avatarFile: File entities: [Entity!] entityTypes: [EntityType!] contacts: [Contact!] @@ -36144,6 +36186,14 @@ type OrganizationHistory implements Node { """ avatarRemoteURL: String """ + The organizations's local avatar file id, takes precedence over the avatar remote URL + """ + avatarLocalFileID: String + """ + The time the user's (local) avatar was last updated + """ + avatarUpdatedAt: Time + """ Whether the organization has a dedicated database """ dedicatedDb: Boolean! @@ -36415,6 +36465,37 @@ input OrganizationHistoryWhereInput { avatarRemoteURLNotNil: Boolean avatarRemoteURLEqualFold: String avatarRemoteURLContainsFold: String + """ + avatar_local_file_id field predicates + """ + avatarLocalFileID: String + avatarLocalFileIDNEQ: String + avatarLocalFileIDIn: [String!] + avatarLocalFileIDNotIn: [String!] + avatarLocalFileIDGT: String + avatarLocalFileIDGTE: String + avatarLocalFileIDLT: String + avatarLocalFileIDLTE: String + avatarLocalFileIDContains: String + avatarLocalFileIDHasPrefix: String + avatarLocalFileIDHasSuffix: String + avatarLocalFileIDIsNil: Boolean + avatarLocalFileIDNotNil: Boolean + avatarLocalFileIDEqualFold: String + avatarLocalFileIDContainsFold: String + """ + avatar_updated_at field predicates + """ + avatarUpdatedAt: Time + avatarUpdatedAtNEQ: Time + avatarUpdatedAtIn: [Time!] + avatarUpdatedAtNotIn: [Time!] + avatarUpdatedAtGT: Time + avatarUpdatedAtGTE: Time + avatarUpdatedAtLT: Time + avatarUpdatedAtLTE: Time + avatarUpdatedAtIsNil: Boolean + avatarUpdatedAtNotNil: Boolean } """ Ordering options for Organization connections @@ -37281,6 +37362,37 @@ input OrganizationWhereInput { avatarRemoteURLEqualFold: String avatarRemoteURLContainsFold: String """ + avatar_local_file_id field predicates + """ + avatarLocalFileID: ID + avatarLocalFileIDNEQ: ID + avatarLocalFileIDIn: [ID!] + avatarLocalFileIDNotIn: [ID!] + avatarLocalFileIDGT: ID + avatarLocalFileIDGTE: ID + avatarLocalFileIDLT: ID + avatarLocalFileIDLTE: ID + avatarLocalFileIDContains: ID + avatarLocalFileIDHasPrefix: ID + avatarLocalFileIDHasSuffix: ID + avatarLocalFileIDIsNil: Boolean + avatarLocalFileIDNotNil: Boolean + avatarLocalFileIDEqualFold: ID + avatarLocalFileIDContainsFold: ID + """ + avatar_updated_at field predicates + """ + avatarUpdatedAt: Time + avatarUpdatedAtNEQ: Time + avatarUpdatedAtIn: [Time!] + avatarUpdatedAtNotIn: [Time!] + avatarUpdatedAtGT: Time + avatarUpdatedAtGTE: Time + avatarUpdatedAtLT: Time + avatarUpdatedAtLTE: Time + avatarUpdatedAtIsNil: Boolean + avatarUpdatedAtNotNil: Boolean + """ control_creators edge predicates """ hasControlCreators: Boolean @@ -37406,6 +37518,11 @@ input OrganizationWhereInput { hasFiles: Boolean hasFilesWith: [FileWhereInput!] """ + avatar_file edge predicates + """ + hasAvatarFile: Boolean + hasAvatarFileWith: [FileWhereInput!] + """ entities edge predicates """ hasEntities: Boolean @@ -47093,6 +47210,11 @@ input UpdateOrganizationInput { """ avatarRemoteURL: String clearAvatarRemoteURL: Boolean + """ + The time the user's (local) avatar was last updated + """ + avatarUpdatedAt: Time + clearAvatarUpdatedAt: Boolean addControlCreatorIDs: [ID!] removeControlCreatorIDs: [ID!] clearControlCreators: Boolean @@ -47161,6 +47283,8 @@ input UpdateOrganizationInput { addFileIDs: [ID!] removeFileIDs: [ID!] clearFiles: Boolean + avatarFileID: ID + clearAvatarFile: Boolean addEntityIDs: [ID!] removeEntityIDs: [ID!] clearEntities: Boolean @@ -47922,11 +48046,6 @@ input UpdateUserInput { avatarRemoteURL: String clearAvatarRemoteURL: Boolean """ - The user's local avatar file - """ - avatarLocalFile: String - clearAvatarLocalFile: Boolean - """ The time the user's (local) avatar was last updated """ avatarUpdatedAt: Time @@ -47980,8 +48099,8 @@ input UpdateUserInput { addFileIDs: [ID!] removeFileIDs: [ID!] clearFiles: Boolean - fileID: ID - clearFile: Boolean + avatarFileID: ID + clearAvatarFile: Boolean addEventIDs: [ID!] removeEventIDs: [ID!] clearEvents: Boolean @@ -48076,11 +48195,7 @@ type User implements Node { """ avatarRemoteURL: String """ - The user's local avatar file - """ - avatarLocalFile: String - """ - The user's local avatar file id + The user's local avatar file id, takes precedence over the avatar remote URL """ avatarLocalFileID: ID """ @@ -48109,7 +48224,7 @@ type User implements Node { groups: [Group!] organizations: [Organization!] files: [File!] - file: File + avatarFile: File events: [Event!] actionPlans: [ActionPlan!] subcontrols: [Subcontrol!] @@ -48186,11 +48301,7 @@ type UserHistory implements Node { """ avatarRemoteURL: String """ - The user's local avatar file - """ - avatarLocalFile: String - """ - The user's local avatar file id + The user's local avatar file id, takes precedence over the avatar remote URL """ avatarLocalFileID: String """ @@ -48527,24 +48638,6 @@ input UserHistoryWhereInput { avatarRemoteURLEqualFold: String avatarRemoteURLContainsFold: String """ - avatar_local_file field predicates - """ - avatarLocalFile: String - avatarLocalFileNEQ: String - avatarLocalFileIn: [String!] - avatarLocalFileNotIn: [String!] - avatarLocalFileGT: String - avatarLocalFileGTE: String - avatarLocalFileLT: String - avatarLocalFileLTE: String - avatarLocalFileContains: String - avatarLocalFileHasPrefix: String - avatarLocalFileHasSuffix: String - avatarLocalFileIsNil: Boolean - avatarLocalFileNotNil: Boolean - avatarLocalFileEqualFold: String - avatarLocalFileContainsFold: String - """ avatar_local_file_id field predicates """ avatarLocalFileID: String @@ -49465,24 +49558,6 @@ input UserWhereInput { avatarRemoteURLEqualFold: String avatarRemoteURLContainsFold: String """ - avatar_local_file field predicates - """ - avatarLocalFile: String - avatarLocalFileNEQ: String - avatarLocalFileIn: [String!] - avatarLocalFileNotIn: [String!] - avatarLocalFileGT: String - avatarLocalFileGTE: String - avatarLocalFileLT: String - avatarLocalFileLTE: String - avatarLocalFileContains: String - avatarLocalFileHasPrefix: String - avatarLocalFileHasSuffix: String - avatarLocalFileIsNil: Boolean - avatarLocalFileNotNil: Boolean - avatarLocalFileEqualFold: String - avatarLocalFileContainsFold: String - """ avatar_local_file_id field predicates """ avatarLocalFileID: ID @@ -49591,10 +49666,10 @@ input UserWhereInput { hasFiles: Boolean hasFilesWith: [FileWhereInput!] """ - file edge predicates + avatar_file edge predicates """ - hasFile: Boolean - hasFileWith: [FileWhereInput!] + hasAvatarFile: Boolean + hasAvatarFileWith: [FileWhereInput!] """ events edge predicates """ @@ -49994,6 +50069,9 @@ type FileDeletePayload { } `, BuiltIn: false}, + {Name: "../schema/fileextended.graphql", Input: `extend type File { + presignedURL: String +}`, BuiltIn: false}, {Name: "../schema/group.graphql", Input: `extend type Query { """ Look up group by ID @@ -50852,6 +50930,7 @@ extend type Mutation{ values of the organization """ input: CreateOrganizationInput! + avatarFile: Upload ): OrganizationCreatePayload! """ Create multiple new organizations @@ -50883,6 +50962,7 @@ extend type Mutation{ New values for the organization """ input: UpdateOrganizationInput! + avatarFile: Upload ): OrganizationUpdatePayload! """ Delete an existing organization diff --git a/internal/graphapi/generated/search.generated.go b/internal/graphapi/generated/search.generated.go index 4f7e9a4b..d021d22d 100644 --- a/internal/graphapi/generated/search.generated.go +++ b/internal/graphapi/generated/search.generated.go @@ -900,6 +900,8 @@ func (ec *executionContext) fieldContext_FileSearchResult_files(_ context.Contex return ec.fieldContext_File_events(ctx, field) case "program": return ec.fieldContext_File_program(ctx, field) + case "presignedURL": + return ec.fieldContext_File_presignedURL(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type File", field.Name) }, @@ -1523,6 +1525,10 @@ func (ec *executionContext) fieldContext_OrganizationSearchResult_organizations( return ec.fieldContext_Organization_personalOrg(ctx, field) case "avatarRemoteURL": return ec.fieldContext_Organization_avatarRemoteURL(ctx, field) + case "avatarLocalFileID": + return ec.fieldContext_Organization_avatarLocalFileID(ctx, field) + case "avatarUpdatedAt": + return ec.fieldContext_Organization_avatarUpdatedAt(ctx, field) case "dedicatedDb": return ec.fieldContext_Organization_dedicatedDb(ctx, field) case "controlCreators": @@ -1575,6 +1581,8 @@ func (ec *executionContext) fieldContext_OrganizationSearchResult_organizations( return ec.fieldContext_Organization_secrets(ctx, field) case "files": return ec.fieldContext_Organization_files(ctx, field) + case "avatarFile": + return ec.fieldContext_Organization_avatarFile(ctx, field) case "entities": return ec.fieldContext_Organization_entities(ctx, field) case "entityTypes": @@ -2785,8 +2793,6 @@ func (ec *executionContext) fieldContext_UserSearchResult_users(_ context.Contex return ec.fieldContext_User_displayName(ctx, field) case "avatarRemoteURL": return ec.fieldContext_User_avatarRemoteURL(ctx, field) - case "avatarLocalFile": - return ec.fieldContext_User_avatarLocalFile(ctx, field) case "avatarLocalFileID": return ec.fieldContext_User_avatarLocalFileID(ctx, field) case "avatarUpdatedAt": @@ -2811,8 +2817,8 @@ func (ec *executionContext) fieldContext_UserSearchResult_users(_ context.Contex return ec.fieldContext_User_organizations(ctx, field) case "files": return ec.fieldContext_User_files(ctx, field) - case "file": - return ec.fieldContext_User_file(ctx, field) + case "avatarFile": + return ec.fieldContext_User_avatarFile(ctx, field) case "events": return ec.fieldContext_User_events(ctx, field) case "actionPlans": diff --git a/internal/graphapi/generated/user.generated.go b/internal/graphapi/generated/user.generated.go index c158b9b9..7189279e 100644 --- a/internal/graphapi/generated/user.generated.go +++ b/internal/graphapi/generated/user.generated.go @@ -91,8 +91,6 @@ func (ec *executionContext) fieldContext_UserBulkCreatePayload_users(_ context.C return ec.fieldContext_User_displayName(ctx, field) case "avatarRemoteURL": return ec.fieldContext_User_avatarRemoteURL(ctx, field) - case "avatarLocalFile": - return ec.fieldContext_User_avatarLocalFile(ctx, field) case "avatarLocalFileID": return ec.fieldContext_User_avatarLocalFileID(ctx, field) case "avatarUpdatedAt": @@ -117,8 +115,8 @@ func (ec *executionContext) fieldContext_UserBulkCreatePayload_users(_ context.C return ec.fieldContext_User_organizations(ctx, field) case "files": return ec.fieldContext_User_files(ctx, field) - case "file": - return ec.fieldContext_User_file(ctx, field) + case "avatarFile": + return ec.fieldContext_User_avatarFile(ctx, field) case "events": return ec.fieldContext_User_events(ctx, field) case "actionPlans": @@ -209,8 +207,6 @@ func (ec *executionContext) fieldContext_UserCreatePayload_user(_ context.Contex return ec.fieldContext_User_displayName(ctx, field) case "avatarRemoteURL": return ec.fieldContext_User_avatarRemoteURL(ctx, field) - case "avatarLocalFile": - return ec.fieldContext_User_avatarLocalFile(ctx, field) case "avatarLocalFileID": return ec.fieldContext_User_avatarLocalFileID(ctx, field) case "avatarUpdatedAt": @@ -235,8 +231,8 @@ func (ec *executionContext) fieldContext_UserCreatePayload_user(_ context.Contex return ec.fieldContext_User_organizations(ctx, field) case "files": return ec.fieldContext_User_files(ctx, field) - case "file": - return ec.fieldContext_User_file(ctx, field) + case "avatarFile": + return ec.fieldContext_User_avatarFile(ctx, field) case "events": return ec.fieldContext_User_events(ctx, field) case "actionPlans": @@ -371,8 +367,6 @@ func (ec *executionContext) fieldContext_UserUpdatePayload_user(_ context.Contex return ec.fieldContext_User_displayName(ctx, field) case "avatarRemoteURL": return ec.fieldContext_User_avatarRemoteURL(ctx, field) - case "avatarLocalFile": - return ec.fieldContext_User_avatarLocalFile(ctx, field) case "avatarLocalFileID": return ec.fieldContext_User_avatarLocalFileID(ctx, field) case "avatarUpdatedAt": @@ -397,8 +391,8 @@ func (ec *executionContext) fieldContext_UserUpdatePayload_user(_ context.Contex return ec.fieldContext_User_organizations(ctx, field) case "files": return ec.fieldContext_User_files(ctx, field) - case "file": - return ec.fieldContext_User_file(ctx, field) + case "avatarFile": + return ec.fieldContext_User_avatarFile(ctx, field) case "events": return ec.fieldContext_User_events(ctx, field) case "actionPlans": diff --git a/internal/graphapi/group_test.go b/internal/graphapi/group_test.go index 892be5ee..2861db10 100644 --- a/internal/graphapi/group_test.go +++ b/internal/graphapi/group_test.go @@ -277,7 +277,7 @@ func (suite *GraphTestSuite) TestMutationCreateGroup() { _, err := suite.client.api.UpdateOrganization(testUser1.UserCtx, testUser1.OrganizationID, openlaneclient.UpdateOrganizationInput{ AddGroupCreatorIDs: []string{viewOnlyUser.GroupID}, - }) + }, nil) require.NoError(t, err) } diff --git a/internal/graphapi/internalpolicy_test.go b/internal/graphapi/internalpolicy_test.go index 6520ef60..8eda0141 100644 --- a/internal/graphapi/internalpolicy_test.go +++ b/internal/graphapi/internalpolicy_test.go @@ -249,7 +249,7 @@ func (suite *GraphTestSuite) TestMutationCreateInternalPolicy() { _, err := suite.client.api.UpdateOrganization(testUser1.UserCtx, testUser1.OrganizationID, openlaneclient.UpdateOrganizationInput{ AddInternalPolicyCreatorIDs: []string{viewOnlyUser.GroupID}, - }) + }, nil) require.NoError(t, err) } diff --git a/internal/graphapi/narrative_test.go b/internal/graphapi/narrative_test.go index c47a0977..64d78c3b 100644 --- a/internal/graphapi/narrative_test.go +++ b/internal/graphapi/narrative_test.go @@ -297,7 +297,7 @@ func (suite *GraphTestSuite) TestMutationCreateNarrative() { _, err := suite.client.api.UpdateOrganization(testUser1.UserCtx, testUser1.OrganizationID, openlaneclient.UpdateOrganizationInput{ AddNarrativeCreatorIDs: []string{viewOnlyUser.GroupID}, - }) + }, nil) require.NoError(t, err) } diff --git a/internal/graphapi/organization.resolvers.go b/internal/graphapi/organization.resolvers.go index 6f998115..66ede436 100644 --- a/internal/graphapi/organization.resolvers.go +++ b/internal/graphapi/organization.resolvers.go @@ -14,7 +14,7 @@ import ( ) // CreateOrganization is the resolver for the createOrganization field. -func (r *mutationResolver) CreateOrganization(ctx context.Context, input generated.CreateOrganizationInput) (*model.OrganizationCreatePayload, error) { +func (r *mutationResolver) CreateOrganization(ctx context.Context, input generated.CreateOrganizationInput, avatarFile *graphql.Upload) (*model.OrganizationCreatePayload, error) { res, err := withTransactionalMutation(ctx).Organization.Create().SetInput(input).Save(ctx) if err != nil { return nil, parseRequestError(err, action{action: ActionCreate, object: "organization"}) @@ -43,7 +43,7 @@ func (r *mutationResolver) CreateBulkCSVOrganization(ctx context.Context, input } // UpdateOrganization is the resolver for the updateOrganization field. -func (r *mutationResolver) UpdateOrganization(ctx context.Context, id string, input generated.UpdateOrganizationInput) (*model.OrganizationUpdatePayload, error) { +func (r *mutationResolver) UpdateOrganization(ctx context.Context, id string, input generated.UpdateOrganizationInput, avatarFile *graphql.Upload) (*model.OrganizationUpdatePayload, error) { res, err := withTransactionalMutation(ctx).Organization.Get(ctx, id) if err != nil { return nil, parseRequestError(err, action{action: ActionUpdate, object: "organization"}) diff --git a/internal/graphapi/organization_test.go b/internal/graphapi/organization_test.go index acf7a7f7..464132d4 100644 --- a/internal/graphapi/organization_test.go +++ b/internal/graphapi/organization_test.go @@ -16,6 +16,7 @@ import ( "github.com/theopenlane/core/internal/ent/generated/privacy" "github.com/theopenlane/core/pkg/enums" "github.com/theopenlane/core/pkg/models" + "github.com/theopenlane/core/pkg/objects" "github.com/theopenlane/core/pkg/openlaneclient" ) @@ -137,14 +138,21 @@ func (suite *GraphTestSuite) TestMutationCreateOrganization() { // delete said org (&OrganizationCleanup{client: suite.client, ID: orgToDelete.ID}).MustDelete(testUser1.UserCtx, t) + // avatar file setup + avatarFile, err := objects.NewUploadFile("testdata/uploads/logo.png") + require.NoError(t, err) + + invalidAvatarFile, err := objects.NewUploadFile("testdata/uploads/hello.txt") + require.NoError(t, err) + testCases := []struct { name string orgName string displayName string orgDescription string parentOrgID string + avatarFile *graphql.Upload settings *openlaneclient.CreateOrganizationSettingInput - listOrgs bool client *openlaneclient.OpenlaneClient ctx context.Context expectedDefaultOrgUpdate bool @@ -155,18 +163,22 @@ func (suite *GraphTestSuite) TestMutationCreateOrganization() { orgName: gofakeit.Name(), displayName: gofakeit.LetterN(50), orgDescription: gofakeit.HipsterSentence(10), - listOrgs: true, expectedDefaultOrgUpdate: true, // only the first org created should update the default org parentOrgID: "", // root org client: suite.client.api, ctx: testUser1.UserCtx, }, { - name: "happy path organization with settings", + name: "happy path organization with settings and avatar", orgName: gofakeit.Name(), displayName: gofakeit.LetterN(50), orgDescription: gofakeit.HipsterSentence(10), - listOrgs: true, + avatarFile: &graphql.Upload{ + File: avatarFile.File, + Filename: avatarFile.Filename, + Size: avatarFile.Size, + ContentType: avatarFile.ContentType, + }, settings: &openlaneclient.CreateOrganizationSettingInput{ Domains: []string{"meow.theopenlane.io"}, BillingAddress: &models.Address{ @@ -185,7 +197,6 @@ func (suite *GraphTestSuite) TestMutationCreateOrganization() { name: "happy path organization with parent org", orgName: gofakeit.Name(), orgDescription: gofakeit.HipsterSentence(10), - listOrgs: true, parentOrgID: testUser1.OrganizationID, client: suite.client.api, ctx: testUser1.UserCtx, @@ -194,7 +205,6 @@ func (suite *GraphTestSuite) TestMutationCreateOrganization() { name: "happy path organization with parent org using personal access token", orgName: gofakeit.Name(), orgDescription: gofakeit.HipsterSentence(10), - listOrgs: true, parentOrgID: testUser1.OrganizationID, client: suite.client.apiWithPAT, ctx: context.Background(), @@ -203,7 +213,6 @@ func (suite *GraphTestSuite) TestMutationCreateOrganization() { name: "organization with parent personal org", orgName: gofakeit.Name(), orgDescription: gofakeit.HipsterSentence(10), - listOrgs: true, parentOrgID: testUser1.PersonalOrgID, errorMsg: "personal organizations are not allowed to have child organizations", client: suite.client.api, @@ -229,7 +238,6 @@ func (suite *GraphTestSuite) TestMutationCreateOrganization() { name: "organization with no description", orgName: gofakeit.Name(), orgDescription: "", - listOrgs: true, parentOrgID: testUser1.OrganizationID, client: suite.client.api, ctx: testUser1.UserCtx, @@ -246,7 +254,6 @@ func (suite *GraphTestSuite) TestMutationCreateOrganization() { name: "duplicate organization name, but other was deleted, should pass", orgName: orgToDelete.Name, orgDescription: gofakeit.HipsterSentence(10), - listOrgs: true, errorMsg: "", client: suite.client.api, ctx: testUser1.UserCtx, @@ -255,7 +262,6 @@ func (suite *GraphTestSuite) TestMutationCreateOrganization() { name: "duplicate display name, should be allowed", orgName: gofakeit.LetterN(80), displayName: parentOrg.Organization.DisplayName, - listOrgs: true, orgDescription: gofakeit.HipsterSentence(10), client: suite.client.api, ctx: testUser1.UserCtx, @@ -265,14 +271,34 @@ func (suite *GraphTestSuite) TestMutationCreateOrganization() { orgName: gofakeit.Name(), displayName: gofakeit.Sentence(3), orgDescription: gofakeit.HipsterSentence(10), - listOrgs: true, client: suite.client.api, ctx: testUser1.UserCtx, }, + { + name: "invalid avatar file", + orgName: gofakeit.Name(), + avatarFile: &graphql.Upload{ + File: invalidAvatarFile.File, + Filename: invalidAvatarFile.Filename, + Size: invalidAvatarFile.Size, + ContentType: invalidAvatarFile.ContentType, + }, + client: suite.client.api, + ctx: testUser1.UserCtx, + errorMsg: "unsupported mime type uploaded: text/plain", + }, } for _, tc := range testCases { t.Run("Create "+tc.name, func(t *testing.T) { + if tc.avatarFile != nil { + if tc.errorMsg == "" { + expectUpload(t, suite.client.objectStore.Storage, []graphql.Upload{*tc.avatarFile}) + } else { + expectUploadCheckOnly(t, suite.client.objectStore.Storage) + } + } + input := openlaneclient.CreateOrganizationInput{ Name: tc.orgName, Description: &tc.orgDescription, @@ -290,7 +316,7 @@ func (suite *GraphTestSuite) TestMutationCreateOrganization() { input.CreateOrgSettings = tc.settings } - resp, err := tc.client.CreateOrganization(tc.ctx, input) + resp, err := tc.client.CreateOrganization(tc.ctx, input, tc.avatarFile) if tc.errorMsg != "" { require.Error(t, err) @@ -321,6 +347,12 @@ func (suite *GraphTestSuite) TestMutationCreateOrganization() { // Ensure display name is not empty assert.NotEmpty(t, resp.CreateOrganization.Organization.DisplayName) + // Ensure avatar file is not empty + if tc.avatarFile != nil { + assert.NotNil(t, resp.CreateOrganization.Organization.AvatarLocalFileID) + assert.NotNil(t, resp.CreateOrganization.Organization.AvatarFile.PresignedURL) + } + if tc.settings != nil { assert.Len(t, resp.CreateOrganization.Organization.Setting.Domains, 1) @@ -399,10 +431,18 @@ func (suite *GraphTestSuite) TestMutationUpdateOrganization() { reqCtx, err := auth.NewTestContextWithOrgID(testUser1.ID, org.ID) require.NoError(t, err) + // avatar file setup + avatarFile, err := objects.NewUploadFile("testdata/uploads/logo.png") + require.NoError(t, err) + + invalidAvatarFile, err := objects.NewUploadFile("testdata/uploads/hello.txt") + require.NoError(t, err) + testCases := []struct { name string orgID string updateInput openlaneclient.UpdateOrganizationInput + avatarFile *graphql.Upload client *openlaneclient.OpenlaneClient ctx context.Context expectedRes openlaneclient.UpdateOrganization_UpdateOrganization_Organization @@ -450,11 +490,17 @@ func (suite *GraphTestSuite) TestMutationUpdateOrganization() { }, }, { - name: "update description, happy path", + name: "update description and avatar file, happy path", orgID: org.ID, updateInput: openlaneclient.UpdateOrganizationInput{ Description: &descriptionUpdate, }, + avatarFile: &graphql.Upload{ + File: avatarFile.File, + Filename: avatarFile.Filename, + Size: avatarFile.Size, + ContentType: avatarFile.ContentType, + }, client: suite.client.api, ctx: reqCtx, expectedRes: openlaneclient.UpdateOrganization_UpdateOrganization_Organization{ @@ -497,6 +543,19 @@ func (suite *GraphTestSuite) TestMutationUpdateOrganization() { Description: &descriptionUpdate, }, }, + { + name: "update avatar, invalid file", + orgID: org.ID, + avatarFile: &graphql.Upload{ + File: invalidAvatarFile.File, + Filename: invalidAvatarFile.Filename, + Size: invalidAvatarFile.Size, + ContentType: invalidAvatarFile.ContentType, + }, + client: suite.client.api, + ctx: reqCtx, + errorMsg: "unsupported mime type uploaded: text/plain", + }, { name: "update name, too long", orgID: org.ID, @@ -531,7 +590,15 @@ func (suite *GraphTestSuite) TestMutationUpdateOrganization() { for _, tc := range testCases { t.Run("Update "+tc.name, func(t *testing.T) { - resp, err := tc.client.UpdateOrganization(tc.ctx, tc.orgID, tc.updateInput) + if tc.avatarFile != nil { + if tc.errorMsg == "" { + expectUpload(t, suite.client.objectStore.Storage, []graphql.Upload{*tc.avatarFile}) + } else { + expectUploadCheckOnly(t, suite.client.objectStore.Storage) + } + } + + resp, err := tc.client.UpdateOrganization(tc.ctx, tc.orgID, tc.updateInput, tc.avatarFile) if tc.errorMsg != "" { require.Error(t, err) @@ -562,6 +629,11 @@ func (suite *GraphTestSuite) TestMutationUpdateOrganization() { if tc.updateInput.UpdateOrgSettings != nil { assert.Len(t, updatedOrg.GetSetting().Domains, 2) } + + if tc.avatarFile != nil { + assert.NotNil(t, updatedOrg.AvatarLocalFileID) + assert.NotNil(t, updatedOrg.AvatarFile.PresignedURL) + } }) } diff --git a/internal/graphapi/procedure_test.go b/internal/graphapi/procedure_test.go index ec3820ad..8978aa67 100644 --- a/internal/graphapi/procedure_test.go +++ b/internal/graphapi/procedure_test.go @@ -251,7 +251,7 @@ func (suite *GraphTestSuite) TestMutationCreateProcedure() { _, err := suite.client.api.UpdateOrganization(testUser1.UserCtx, testUser1.OrganizationID, openlaneclient.UpdateOrganizationInput{ AddProcedureCreatorIDs: []string{viewOnlyUser.GroupID}, - }) + }, nil) require.NoError(t, err) } diff --git a/internal/graphapi/program_test.go b/internal/graphapi/program_test.go index 97315500..b76a4c50 100644 --- a/internal/graphapi/program_test.go +++ b/internal/graphapi/program_test.go @@ -281,7 +281,7 @@ func (suite *GraphTestSuite) TestMutationCreateProgram() { _, err := suite.client.api.UpdateOrganization(testUser1.UserCtx, testUser1.OrganizationID, openlaneclient.UpdateOrganizationInput{ AddProgramCreatorIDs: []string{viewOnlyUser.GroupID}, - }) + }, nil) require.NoError(t, err) } diff --git a/internal/graphapi/query/adminsearch.graphql b/internal/graphapi/query/adminsearch.graphql index 1eff9273..7fcd2257 100644 --- a/internal/graphapi/query/adminsearch.graphql +++ b/internal/graphapi/query/adminsearch.graphql @@ -218,6 +218,7 @@ query AdminSearch($query: String!) { name displayName avatarRemoteURL + avatarLocalFileID } } ... on OrganizationSettingSearchResult { @@ -376,7 +377,6 @@ query AdminSearch($query: String!) { lastName displayName avatarRemoteURL - avatarLocalFile avatarLocalFileID sub } diff --git a/internal/graphapi/query/organization.graphql b/internal/graphapi/query/organization.graphql index 8c824c8a..6b97c810 100644 --- a/internal/graphapi/query/organization.graphql +++ b/internal/graphapi/query/organization.graphql @@ -24,8 +24,8 @@ mutation CreateBulkOrganization($input: [CreateOrganizationInput!]) { } } -mutation CreateOrganization($input: CreateOrganizationInput!) { - createOrganization(input: $input) { +mutation CreateOrganization($input: CreateOrganizationInput!, $avatarFile: Upload) { + createOrganization(input: $input, avatarFile: $avatarFile) { organization { id name @@ -33,6 +33,11 @@ mutation CreateOrganization($input: CreateOrganizationInput!) { description personalOrg tags + avatarRemoteURL + avatarLocalFileID + avatarFile { + presignedURL + } createdAt updatedAt setting { @@ -137,6 +142,8 @@ query GetOrganizationByID($organizationId: ID!) { description personalOrg tags + avatarRemoteURL + avatarLocalFileID parent { id name @@ -237,14 +244,23 @@ query GetOrganizations($where: OrganizationWhereInput) { } } -mutation UpdateOrganization($updateOrganizationId: ID!, $input: UpdateOrganizationInput!) { - updateOrganization(id: $updateOrganizationId, input: $input) { +mutation UpdateOrganization($updateOrganizationId: ID!, $input: UpdateOrganizationInput!, $avatarFile: Upload) { + updateOrganization( + id: $updateOrganizationId + input: $input + avatarFile: $avatarFile + ) { organization { id name displayName description personalOrg + avatarLocalFileID + avatarRemoteURL + avatarFile { + presignedURL + } tags members { id diff --git a/internal/graphapi/query/user.graphql b/internal/graphapi/query/user.graphql index 7ba6002a..a1f83c3a 100644 --- a/internal/graphapi/query/user.graphql +++ b/internal/graphapi/query/user.graphql @@ -2,9 +2,11 @@ mutation CreateUser($input: CreateUserInput!, $avatarFile: Upload) { createUser(input: $input, avatarFile: $avatarFile) { user { authProvider - avatarLocalFile avatarRemoteURL avatarLocalFileID + avatarFile{ + presignedURL + } displayName email firstName @@ -52,9 +54,11 @@ query GetAllUsers { edges { node { authProvider - avatarLocalFile avatarRemoteURL avatarLocalFileID + avatarFile{ + presignedURL + } displayName email firstName @@ -92,9 +96,11 @@ query GetAllUsers { query GetUserByID($userId: ID!) { user(id: $userId) { authProvider - avatarLocalFile avatarRemoteURL avatarLocalFileID + avatarFile{ + presignedURL + } displayName email firstName @@ -139,9 +145,11 @@ query GetUserByID($userId: ID!) { query GetUserByIDWithOrgs($userId: ID!) { user(id: $userId) { authProvider - avatarLocalFile avatarRemoteURL avatarLocalFileID + avatarFile{ + presignedURL + } displayName email firstName @@ -186,9 +194,11 @@ mutation UpdateUser($updateUserId: ID!, $input: UpdateUserInput!, $avatarFile: U updateUser(id: $updateUserId, input: $input, avatarFile: $avatarFile) { user { authProvider - avatarLocalFile avatarRemoteURL avatarLocalFileID + avatarFile{ + presignedURL + } displayName email firstName diff --git a/internal/graphapi/query/userhistory.graphql b/internal/graphapi/query/userhistory.graphql index de52cf49..eedb1422 100644 --- a/internal/graphapi/query/userhistory.graphql +++ b/internal/graphapi/query/userhistory.graphql @@ -3,7 +3,7 @@ query GetAllUserHistories { edges { node { authProvider - avatarLocalFile + avatarLocalFileID avatarRemoteURL avatarUpdatedAt createdAt @@ -32,7 +32,7 @@ query GetUserHistories($where: UserHistoryWhereInput) { edges { node { authProvider - avatarLocalFile + avatarLocalFileID avatarRemoteURL avatarUpdatedAt createdAt diff --git a/internal/graphapi/risk_test.go b/internal/graphapi/risk_test.go index 8fcb2607..9c7478d4 100644 --- a/internal/graphapi/risk_test.go +++ b/internal/graphapi/risk_test.go @@ -303,7 +303,7 @@ func (suite *GraphTestSuite) TestMutationCreateRisk() { _, err := suite.client.api.UpdateOrganization(testUser1.UserCtx, testUser1.OrganizationID, openlaneclient.UpdateOrganizationInput{ AddRiskCreatorIDs: []string{viewOnlyUser.GroupID}, - }) + }, nil) require.NoError(t, err) } diff --git a/internal/graphapi/schema/ent.graphql b/internal/graphapi/schema/ent.graphql index 8f30986f..9dbdb2bd 100644 --- a/internal/graphapi/schema/ent.graphql +++ b/internal/graphapi/schema/ent.graphql @@ -4269,6 +4269,10 @@ input CreateOrganizationInput { """ avatarRemoteURL: String """ + The time the user's (local) avatar was last updated + """ + avatarUpdatedAt: Time + """ Whether the organization has a dedicated database """ dedicatedDb: Boolean @@ -4296,6 +4300,7 @@ input CreateOrganizationInput { eventIDs: [ID!] secretIDs: [ID!] fileIDs: [ID!] + avatarFileID: ID entityIDs: [ID!] entityTypeIDs: [ID!] contactIDs: [ID!] @@ -4830,10 +4835,6 @@ input CreateUserInput { """ avatarRemoteURL: String """ - The user's local avatar file - """ - avatarLocalFile: String - """ The time the user's (local) avatar was last updated """ avatarUpdatedAt: Time @@ -4866,7 +4867,7 @@ input CreateUserInput { organizationIDs: [ID!] webauthnIDs: [ID!] fileIDs: [ID!] - fileID: ID + avatarFileID: ID eventIDs: [ID!] actionPlanIDs: [ID!] subcontrolIDs: [ID!] @@ -14187,6 +14188,14 @@ type Organization implements Node { """ avatarRemoteURL: String """ + The organizations's local avatar file id, takes precedence over the avatar remote URL + """ + avatarLocalFileID: ID + """ + The time the user's (local) avatar was last updated + """ + avatarUpdatedAt: Time + """ Whether the organization has a dedicated database """ dedicatedDb: Boolean! @@ -14272,6 +14281,7 @@ type Organization implements Node { events: [Event!] secrets: [Hush!] files: [File!] + avatarFile: File entities: [Entity!] entityTypes: [EntityType!] contacts: [Contact!] @@ -14353,6 +14363,14 @@ type OrganizationHistory implements Node { """ avatarRemoteURL: String """ + The organizations's local avatar file id, takes precedence over the avatar remote URL + """ + avatarLocalFileID: String + """ + The time the user's (local) avatar was last updated + """ + avatarUpdatedAt: Time + """ Whether the organization has a dedicated database """ dedicatedDb: Boolean! @@ -14624,6 +14642,37 @@ input OrganizationHistoryWhereInput { avatarRemoteURLNotNil: Boolean avatarRemoteURLEqualFold: String avatarRemoteURLContainsFold: String + """ + avatar_local_file_id field predicates + """ + avatarLocalFileID: String + avatarLocalFileIDNEQ: String + avatarLocalFileIDIn: [String!] + avatarLocalFileIDNotIn: [String!] + avatarLocalFileIDGT: String + avatarLocalFileIDGTE: String + avatarLocalFileIDLT: String + avatarLocalFileIDLTE: String + avatarLocalFileIDContains: String + avatarLocalFileIDHasPrefix: String + avatarLocalFileIDHasSuffix: String + avatarLocalFileIDIsNil: Boolean + avatarLocalFileIDNotNil: Boolean + avatarLocalFileIDEqualFold: String + avatarLocalFileIDContainsFold: String + """ + avatar_updated_at field predicates + """ + avatarUpdatedAt: Time + avatarUpdatedAtNEQ: Time + avatarUpdatedAtIn: [Time!] + avatarUpdatedAtNotIn: [Time!] + avatarUpdatedAtGT: Time + avatarUpdatedAtGTE: Time + avatarUpdatedAtLT: Time + avatarUpdatedAtLTE: Time + avatarUpdatedAtIsNil: Boolean + avatarUpdatedAtNotNil: Boolean } """ Ordering options for Organization connections @@ -15490,6 +15539,37 @@ input OrganizationWhereInput { avatarRemoteURLEqualFold: String avatarRemoteURLContainsFold: String """ + avatar_local_file_id field predicates + """ + avatarLocalFileID: ID + avatarLocalFileIDNEQ: ID + avatarLocalFileIDIn: [ID!] + avatarLocalFileIDNotIn: [ID!] + avatarLocalFileIDGT: ID + avatarLocalFileIDGTE: ID + avatarLocalFileIDLT: ID + avatarLocalFileIDLTE: ID + avatarLocalFileIDContains: ID + avatarLocalFileIDHasPrefix: ID + avatarLocalFileIDHasSuffix: ID + avatarLocalFileIDIsNil: Boolean + avatarLocalFileIDNotNil: Boolean + avatarLocalFileIDEqualFold: ID + avatarLocalFileIDContainsFold: ID + """ + avatar_updated_at field predicates + """ + avatarUpdatedAt: Time + avatarUpdatedAtNEQ: Time + avatarUpdatedAtIn: [Time!] + avatarUpdatedAtNotIn: [Time!] + avatarUpdatedAtGT: Time + avatarUpdatedAtGTE: Time + avatarUpdatedAtLT: Time + avatarUpdatedAtLTE: Time + avatarUpdatedAtIsNil: Boolean + avatarUpdatedAtNotNil: Boolean + """ control_creators edge predicates """ hasControlCreators: Boolean @@ -15615,6 +15695,11 @@ input OrganizationWhereInput { hasFiles: Boolean hasFilesWith: [FileWhereInput!] """ + avatar_file edge predicates + """ + hasAvatarFile: Boolean + hasAvatarFileWith: [FileWhereInput!] + """ entities edge predicates """ hasEntities: Boolean @@ -25302,6 +25387,11 @@ input UpdateOrganizationInput { """ avatarRemoteURL: String clearAvatarRemoteURL: Boolean + """ + The time the user's (local) avatar was last updated + """ + avatarUpdatedAt: Time + clearAvatarUpdatedAt: Boolean addControlCreatorIDs: [ID!] removeControlCreatorIDs: [ID!] clearControlCreators: Boolean @@ -25370,6 +25460,8 @@ input UpdateOrganizationInput { addFileIDs: [ID!] removeFileIDs: [ID!] clearFiles: Boolean + avatarFileID: ID + clearAvatarFile: Boolean addEntityIDs: [ID!] removeEntityIDs: [ID!] clearEntities: Boolean @@ -26131,11 +26223,6 @@ input UpdateUserInput { avatarRemoteURL: String clearAvatarRemoteURL: Boolean """ - The user's local avatar file - """ - avatarLocalFile: String - clearAvatarLocalFile: Boolean - """ The time the user's (local) avatar was last updated """ avatarUpdatedAt: Time @@ -26189,8 +26276,8 @@ input UpdateUserInput { addFileIDs: [ID!] removeFileIDs: [ID!] clearFiles: Boolean - fileID: ID - clearFile: Boolean + avatarFileID: ID + clearAvatarFile: Boolean addEventIDs: [ID!] removeEventIDs: [ID!] clearEvents: Boolean @@ -26285,11 +26372,7 @@ type User implements Node { """ avatarRemoteURL: String """ - The user's local avatar file - """ - avatarLocalFile: String - """ - The user's local avatar file id + The user's local avatar file id, takes precedence over the avatar remote URL """ avatarLocalFileID: ID """ @@ -26318,7 +26401,7 @@ type User implements Node { groups: [Group!] organizations: [Organization!] files: [File!] - file: File + avatarFile: File events: [Event!] actionPlans: [ActionPlan!] subcontrols: [Subcontrol!] @@ -26395,11 +26478,7 @@ type UserHistory implements Node { """ avatarRemoteURL: String """ - The user's local avatar file - """ - avatarLocalFile: String - """ - The user's local avatar file id + The user's local avatar file id, takes precedence over the avatar remote URL """ avatarLocalFileID: String """ @@ -26736,24 +26815,6 @@ input UserHistoryWhereInput { avatarRemoteURLEqualFold: String avatarRemoteURLContainsFold: String """ - avatar_local_file field predicates - """ - avatarLocalFile: String - avatarLocalFileNEQ: String - avatarLocalFileIn: [String!] - avatarLocalFileNotIn: [String!] - avatarLocalFileGT: String - avatarLocalFileGTE: String - avatarLocalFileLT: String - avatarLocalFileLTE: String - avatarLocalFileContains: String - avatarLocalFileHasPrefix: String - avatarLocalFileHasSuffix: String - avatarLocalFileIsNil: Boolean - avatarLocalFileNotNil: Boolean - avatarLocalFileEqualFold: String - avatarLocalFileContainsFold: String - """ avatar_local_file_id field predicates """ avatarLocalFileID: String @@ -27674,24 +27735,6 @@ input UserWhereInput { avatarRemoteURLEqualFold: String avatarRemoteURLContainsFold: String """ - avatar_local_file field predicates - """ - avatarLocalFile: String - avatarLocalFileNEQ: String - avatarLocalFileIn: [String!] - avatarLocalFileNotIn: [String!] - avatarLocalFileGT: String - avatarLocalFileGTE: String - avatarLocalFileLT: String - avatarLocalFileLTE: String - avatarLocalFileContains: String - avatarLocalFileHasPrefix: String - avatarLocalFileHasSuffix: String - avatarLocalFileIsNil: Boolean - avatarLocalFileNotNil: Boolean - avatarLocalFileEqualFold: String - avatarLocalFileContainsFold: String - """ avatar_local_file_id field predicates """ avatarLocalFileID: ID @@ -27800,10 +27843,10 @@ input UserWhereInput { hasFiles: Boolean hasFilesWith: [FileWhereInput!] """ - file edge predicates + avatar_file edge predicates """ - hasFile: Boolean - hasFileWith: [FileWhereInput!] + hasAvatarFile: Boolean + hasAvatarFileWith: [FileWhereInput!] """ events edge predicates """ diff --git a/internal/graphapi/schema/fileextended.graphql b/internal/graphapi/schema/fileextended.graphql new file mode 100644 index 00000000..fcc3ba92 --- /dev/null +++ b/internal/graphapi/schema/fileextended.graphql @@ -0,0 +1,3 @@ +extend type File { + presignedURL: String +} \ No newline at end of file diff --git a/internal/graphapi/schema/organization.graphql b/internal/graphapi/schema/organization.graphql index aa137e74..4ef03619 100644 --- a/internal/graphapi/schema/organization.graphql +++ b/internal/graphapi/schema/organization.graphql @@ -19,6 +19,7 @@ extend type Mutation{ values of the organization """ input: CreateOrganizationInput! + avatarFile: Upload ): OrganizationCreatePayload! """ Create multiple new organizations @@ -50,6 +51,7 @@ extend type Mutation{ New values for the organization """ input: UpdateOrganizationInput! + avatarFile: Upload ): OrganizationUpdatePayload! """ Delete an existing organization diff --git a/internal/graphapi/search.go b/internal/graphapi/search.go index 6fc10161..d29c14f3 100644 --- a/internal/graphapi/search.go +++ b/internal/graphapi/search.go @@ -656,10 +656,11 @@ func adminSearchOrganizations(ctx context.Context, query string) ([]*generated.O likeQuery := "%" + query + "%" s.Where(sql.ExprP("(tags)::text LIKE $2", likeQuery)) // search by Tags }, - organization.DeletedByContainsFold(query), // search by DeletedBy - organization.NameContainsFold(query), // search by Name - organization.DisplayNameContainsFold(query), // search by DisplayName - organization.AvatarRemoteURLContainsFold(query), // search by AvatarRemoteURL + organization.DeletedByContainsFold(query), // search by DeletedBy + organization.NameContainsFold(query), // search by Name + organization.DisplayNameContainsFold(query), // search by DisplayName + organization.AvatarRemoteURLContainsFold(query), // search by AvatarRemoteURL + organization.AvatarLocalFileIDContainsFold(query), // search by AvatarLocalFileID ), ).All(ctx) } @@ -1112,7 +1113,6 @@ func adminSearchUsers(ctx context.Context, query string) ([]*generated.User, err user.LastNameContainsFold(query), // search by LastName user.DisplayNameContainsFold(query), // search by DisplayName user.AvatarRemoteURLContainsFold(query), // search by AvatarRemoteURL - user.AvatarLocalFileContainsFold(query), // search by AvatarLocalFile user.AvatarLocalFileIDContainsFold(query), // search by AvatarLocalFileID user.SubContainsFold(query), // search by Sub ), diff --git a/internal/graphapi/tools_test.go b/internal/graphapi/tools_test.go index 18825c15..d287fae5 100644 --- a/internal/graphapi/tools_test.go +++ b/internal/graphapi/tools_test.go @@ -187,7 +187,6 @@ func expectUpload(t *testing.T, mockStore objects.Storage, expectedUploads []gra ms.EXPECT().Upload(mock.Anything, mock.Anything, mock.Anything).Return(&objects.UploadedFileMetadata{ Size: upload.Size, }, nil).Times(1) - ms.EXPECT().GetPresignedURL(mock.Anything, mock.Anything, mock.Anything).Return("https://presigned.url/my-file", nil).Times(1) } } diff --git a/internal/graphapi/user_test.go b/internal/graphapi/user_test.go index 973b83f9..24a629ae 100644 --- a/internal/graphapi/user_test.go +++ b/internal/graphapi/user_test.go @@ -333,6 +333,7 @@ func (suite *GraphTestSuite) TestMutationUpdateUser() { if tc.avatarFile != nil { assert.NotNil(t, updatedUser.AvatarLocalFileID) + assert.NotNil(t, updatedUser.AvatarFile.PresignedURL) } }) } diff --git a/internal/httpserve/route/files.go b/internal/httpserve/route/files.go new file mode 100644 index 00000000..b2afe7f8 --- /dev/null +++ b/internal/httpserve/route/files.go @@ -0,0 +1,42 @@ +package route + +import ( + "net/http" + "os" + "path/filepath" + "strings" + + echo "github.com/theopenlane/echox" +) + +// registerUploadsHandler serves up static files from the upload directory +// this is used for development without saving files to S3 +// it is *ONLY* registered when the disk mode object storage is used +func registerUploadsHandler(router *Router) (err error) { + path := "/files/:name" + method := http.MethodGet + name := "files" + + route := echo.Route{ + Name: name, + Method: method, + Path: path, + // this route is not protected with auth middleware + // it is only used for development + Middlewares: mw, + Handler: func(c echo.Context) error { + fileSystem := os.DirFS(router.LocalFilePath) + + p := c.PathParam("name") + name := filepath.ToSlash(filepath.Clean(strings.TrimPrefix(p, "/"))) + + return c.FileFS(name, fileSystem) + }, + } + + if err := router.AddEchoOnlyRoute(path, method, route); err != nil { + return err + } + + return nil +} diff --git a/internal/httpserve/route/router.go b/internal/httpserve/route/router.go index 7f680bb0..f2e47754 100644 --- a/internal/httpserve/route/router.go +++ b/internal/httpserve/route/router.go @@ -22,10 +22,11 @@ var ( // Router is a struct that holds the echo router, the OpenAPI schema, and the handler - it's a way to group these components together type Router struct { - Echo *echo.Echo - OAS *openapi3.T - Handler *handlers.Handler - StartConfig *echo.StartConfig + Echo *echo.Echo + OAS *openapi3.T + Handler *handlers.Handler + StartConfig *echo.StartConfig + LocalFilePath string } type RouterOption func(*Router) @@ -44,6 +45,13 @@ func WithEcho(e *echo.Echo) RouterOption { } } +// WithLocalFiles is a RouterOption that allows the local files to be set on the router +func WithLocalFiles(lf string) RouterOption { + return func(r *Router) { + r.LocalFilePath = lf + } +} + // WithOpenAPI is a RouterOption that allows the OpenAPI schema to be set on the router func WithOpenAPI(oas *openapi3.T) RouterOption { return func(r *Router) { @@ -204,6 +212,10 @@ func RegisterRoutes(router *Router) error { registerWebhookHandler, } + if router.LocalFilePath != "" { + routeHandlers = append(routeHandlers, registerUploadsHandler) + } + for _, route := range routeHandlers { if err := route.(func(*Router) error)(router); err != nil { return err diff --git a/internal/httpserve/server/server.go b/internal/httpserve/server/server.go index bf57c3d3..fcba26c7 100644 --- a/internal/httpserve/server/server.go +++ b/internal/httpserve/server/server.go @@ -9,6 +9,7 @@ import ( "github.com/theopenlane/core/internal/httpserve/config" "github.com/theopenlane/core/internal/httpserve/route" echodebug "github.com/theopenlane/core/pkg/middleware/debug" + "github.com/theopenlane/core/pkg/objects/storage" ) type Server struct { @@ -76,6 +77,12 @@ func (s *Server) StartEchoServer(ctx context.Context) error { srv.Handler = &s.config.Handler + // Set the local file path if the object storage provider is disk + // this allows us to serve up the files during testing + if s.config.Settings.ObjectStorage.Provider == storage.ProviderDisk { + srv.LocalFilePath = s.config.Settings.ObjectStorage.DefaultBucket + } + // Add base routes to the server if err := route.RegisterRoutes(srv); err != nil { return err diff --git a/internal/httpserve/serveropts/option.go b/internal/httpserve/serveropts/option.go index c39db679..98316c17 100644 --- a/internal/httpserve/serveropts/option.go +++ b/internal/httpserve/serveropts/option.go @@ -401,7 +401,7 @@ func WithObjectStorage() ServerOption { ) switch settings.Provider { - case "s3": + case storage.ProviderS3: opts := storage.NewS3Options( storage.WithRegion(s.Config.Settings.ObjectStorage.Region), storage.WithBucket(s.Config.Settings.ObjectStorage.DefaultBucket), @@ -423,8 +423,11 @@ func WithObjectStorage() ServerOption { log.Panic().Msg("default bucket not found") } default: + s.Config.Settings.ObjectStorage.Provider = storage.ProviderDisk + opts := storage.NewDiskOptions( storage.WithLocalBucket(s.Config.Settings.ObjectStorage.DefaultBucket), + storage.WithLocalURL(s.Config.Settings.ObjectStorage.LocalURL), ) store, err = storage.NewDiskStorage(opts) diff --git a/internal/middleware/objects/middleware.go b/internal/middleware/objects/middleware.go index 6e1f4464..1cb2e680 100644 --- a/internal/middleware/objects/middleware.go +++ b/internal/middleware/objects/middleware.go @@ -4,7 +4,6 @@ import ( "context" "path/filepath" "slices" - "time" "github.com/rs/zerolog/log" @@ -77,14 +76,6 @@ func Upload(ctx context.Context, u *objects.Objects, files []objects.FileUpload) fileData.FolderDestination = metadata.FolderDestination fileData.StorageKey = metadata.Key - // generate a presigned URL that is valid for 15 minutes - fileData.PresignedURL, err = u.Storage.GetPresignedURL(ctx, uploadedFileName, 60*time.Minute) // nolint:mnd - if err != nil { - log.Error().Err(err).Str("file", f.Filename).Msg("failed to get presigned URL") - - return nil, err - } - // allow the update, permissions are not yet set to allow the update allowCtx := privacy.DecisionContext(ctx, privacy.Allow) @@ -104,7 +95,6 @@ func Upload(ctx context.Context, u *objects.Objects, files []objects.FileUpload) Str("id", fileData.FolderDestination). Str("mime_type", fileData.MimeType). Str("size", objects.FormatFileSize(fileData.Size)). - Str("presigned_url", fileData.PresignedURL). Msg("file uploaded") uploadedFiles = append(uploadedFiles, fileData) diff --git a/jsonschema/api-docs.md b/jsonschema/api-docs.md index b69aa219..9bfbbb73 100644 --- a/jsonschema/api-docs.md +++ b/jsonschema/api-docs.md @@ -633,6 +633,7 @@ Config defines the configuration settings for the default rate limiter |**secretKey**|`string`||| |**credentialsJSON**|`string`||| |**defaultBucket**|`string`||| +|**localURL**|`string`||| |[**keys**](#objectstoragekeys)|`string[]`||| **Additional Properties:** not allowed diff --git a/jsonschema/core.config.json b/jsonschema/core.config.json index 223f2c5d..643cd406 100644 --- a/jsonschema/core.config.json +++ b/jsonschema/core.config.json @@ -591,6 +591,9 @@ "defaultBucket": { "type": "string" }, + "localURL": { + "type": "string" + }, "keys": { "$ref": "#/$defs/[]string" } diff --git a/pkg/objects/config.go b/pkg/objects/config.go index b3d818bf..2e5c2555 100644 --- a/pkg/objects/config.go +++ b/pkg/objects/config.go @@ -25,6 +25,9 @@ type Config struct { // DefaultBucket is the default bucket name for the storage provider, if not set, it will use the default // this is the local path for disk storage or the bucket name for S3 DefaultBucket string `json:"defaultBucket" koanf:"defaultBucket" default:"file_uploads"` + // LocalURL is the URL to use for the "presigned" URL for the file when using local storage + // e.g for local development, this can be http://localhost:17608/files/ + LocalURL string `json:"localURL" koanf:"localURL" default:"http://localhost:17608/files/"` // Keys is a list of keys to look for in the multipart form on the REST request // if the keys are not found, the request upload will be skipped // this is not used when uploading files with gqlgen and the graphql handler diff --git a/pkg/objects/storage/disk.go b/pkg/objects/storage/disk.go index 5c198e13..1bb3ede1 100644 --- a/pkg/objects/storage/disk.go +++ b/pkg/objects/storage/disk.go @@ -14,6 +14,7 @@ import ( ) type Disk struct { + // destinationFolder is the folder where the files will be stored destinationFolder string // Scheme is the scheme of the storage backend Scheme string @@ -24,6 +25,9 @@ type Disk struct { // ensure Disk satisfies the Storage interface var _ objects.Storage = &Disk{} +// ProviderDisk is the provider for the disk storage +var ProviderDisk = "disk" + func NewDiskStorage(opts *DiskOptions) (*Disk, error) { if isStringEmpty(opts.Bucket) { return nil, ErrInvalidFolderPath @@ -92,7 +96,7 @@ func (d *Disk) Download(ctx context.Context, opts *objects.DownloadFileOptions) // GetPresignedURL is used to get a presigned URL for a file in the storage backend // TODO: Implement this method func (d *Disk) GetPresignedURL(ctx context.Context, key string, expires time.Duration) (string, error) { - return "", nil + return d.Opts.LocalURL + key, nil } // ListBuckets lists the local bucket if it exists diff --git a/pkg/objects/storage/diskoptions.go b/pkg/objects/storage/diskoptions.go index 48561f9f..f88584b9 100644 --- a/pkg/objects/storage/diskoptions.go +++ b/pkg/objects/storage/diskoptions.go @@ -5,6 +5,9 @@ type DiskOption func(*DiskOptions) type DiskOptions struct { Bucket string Key string + // LocalURL is the URL to use for the "presigned" URL for the file + // e.g for local development, this can be http://localhost:17608/files/ + LocalURL string } // WithLocalBucket is a DiskOption that sets the bucket for the disk storage which equates to a folder on the file system @@ -21,6 +24,12 @@ func WithLocalKey(key string) DiskOption { } } +func WithLocalURL(url string) DiskOption { + return func(d *DiskOptions) { + d.LocalURL = url + } +} + // NewDiskOptions returns a new DiskOptions struct func NewDiskOptions(opts ...DiskOption) *DiskOptions { o := &DiskOptions{} diff --git a/pkg/objects/storage/s3.go b/pkg/objects/storage/s3.go index 2b03b2a7..7c48b81d 100644 --- a/pkg/objects/storage/s3.go +++ b/pkg/objects/storage/s3.go @@ -22,6 +22,9 @@ import ( // ensure S3Store satisfies the Storage interface var _ objects.Storage = &S3Store{} +// ProviderS3 is the provider for the S3 storage +var ProviderS3 = "s3" + // S3Store is a store that uses S3 as the backend type S3Store struct { Client *s3.Client @@ -161,7 +164,7 @@ func (s *S3Store) Upload(ctx context.Context, r io.Reader, opts *objects.UploadF }, nil } -// Download an object from S3 and return the metadata and a reader - the reader must be closed after use and is the responsibiolity of the caller +// Download an object from S3 and return the metadata and a reader - the reader must be closed after use and is the responsibility of the caller func (s *S3Store) Download(ctx context.Context, opts *objects.DownloadFileOptions) (*objects.DownloadFileMetadata, error) { head, err := s.HeadObj(ctx, opts.FileName) if err != nil { @@ -188,7 +191,8 @@ func (s *S3Store) Download(ctx context.Context, opts *objects.DownloadFileOption }, nil } -// PresignedURL returns a URL that provides access to a file for 15 minutes +// GetPresignedURL returns a URL that provides access to a file for the set duration +// if no duration is provided, it will default to 15 minutes func (s *S3Store) GetPresignedURL(ctx context.Context, key string, expires time.Duration) (string, error) { presignURL, err := s.PresignClient.PresignGetObject(context.Background(), &s3.GetObjectInput{ Bucket: aws.String(s.Opts.Bucket), diff --git a/pkg/openlaneclient/graphclient.go b/pkg/openlaneclient/graphclient.go index c596aeb5..4f31742c 100644 --- a/pkg/openlaneclient/graphclient.go +++ b/pkg/openlaneclient/graphclient.go @@ -177,12 +177,12 @@ type OpenlaneGraphClient interface { GetNoteHistories(ctx context.Context, where *NoteHistoryWhereInput, interceptors ...clientv2.RequestInterceptor) (*GetNoteHistories, error) CreateBulkCSVOrganization(ctx context.Context, input graphql.Upload, interceptors ...clientv2.RequestInterceptor) (*CreateBulkCSVOrganization, error) CreateBulkOrganization(ctx context.Context, input []*CreateOrganizationInput, interceptors ...clientv2.RequestInterceptor) (*CreateBulkOrganization, error) - CreateOrganization(ctx context.Context, input CreateOrganizationInput, interceptors ...clientv2.RequestInterceptor) (*CreateOrganization, error) + CreateOrganization(ctx context.Context, input CreateOrganizationInput, avatarFile *graphql.Upload, interceptors ...clientv2.RequestInterceptor) (*CreateOrganization, error) DeleteOrganization(ctx context.Context, deleteOrganizationID string, interceptors ...clientv2.RequestInterceptor) (*DeleteOrganization, error) GetAllOrganizations(ctx context.Context, interceptors ...clientv2.RequestInterceptor) (*GetAllOrganizations, error) GetOrganizationByID(ctx context.Context, organizationID string, interceptors ...clientv2.RequestInterceptor) (*GetOrganizationByID, error) GetOrganizations(ctx context.Context, where *OrganizationWhereInput, interceptors ...clientv2.RequestInterceptor) (*GetOrganizations, error) - UpdateOrganization(ctx context.Context, updateOrganizationID string, input UpdateOrganizationInput, interceptors ...clientv2.RequestInterceptor) (*UpdateOrganization, error) + UpdateOrganization(ctx context.Context, updateOrganizationID string, input UpdateOrganizationInput, avatarFile *graphql.Upload, interceptors ...clientv2.RequestInterceptor) (*UpdateOrganization, error) GetAllOrganizationHistories(ctx context.Context, interceptors ...clientv2.RequestInterceptor) (*GetAllOrganizationHistories, error) GetOrganizationHistories(ctx context.Context, where *OrganizationHistoryWhereInput, interceptors ...clientv2.RequestInterceptor) (*GetOrganizationHistories, error) GetAllOrganizationSettings(ctx context.Context, interceptors ...clientv2.RequestInterceptor) (*GetAllOrganizationSettings, error) @@ -2631,14 +2631,21 @@ func (t *AdminSearch_AdminSearch_Nodes_OrgSubscriptionSearchResult) GetOrgSubscr } type AdminSearch_AdminSearch_Nodes_OrganizationSearchResult_Organizations struct { - AvatarRemoteURL *string "json:\"avatarRemoteURL,omitempty\" graphql:\"avatarRemoteURL\"" - DeletedBy *string "json:\"deletedBy,omitempty\" graphql:\"deletedBy\"" - DisplayName string "json:\"displayName\" graphql:\"displayName\"" - ID string "json:\"id\" graphql:\"id\"" - Name string "json:\"name\" graphql:\"name\"" - Tags []string "json:\"tags,omitempty\" graphql:\"tags\"" + AvatarLocalFileID *string "json:\"avatarLocalFileID,omitempty\" graphql:\"avatarLocalFileID\"" + AvatarRemoteURL *string "json:\"avatarRemoteURL,omitempty\" graphql:\"avatarRemoteURL\"" + DeletedBy *string "json:\"deletedBy,omitempty\" graphql:\"deletedBy\"" + DisplayName string "json:\"displayName\" graphql:\"displayName\"" + ID string "json:\"id\" graphql:\"id\"" + Name string "json:\"name\" graphql:\"name\"" + Tags []string "json:\"tags,omitempty\" graphql:\"tags\"" } +func (t *AdminSearch_AdminSearch_Nodes_OrganizationSearchResult_Organizations) GetAvatarLocalFileID() *string { + if t == nil { + t = &AdminSearch_AdminSearch_Nodes_OrganizationSearchResult_Organizations{} + } + return t.AvatarLocalFileID +} func (t *AdminSearch_AdminSearch_Nodes_OrganizationSearchResult_Organizations) GetAvatarRemoteURL() *string { if t == nil { t = &AdminSearch_AdminSearch_Nodes_OrganizationSearchResult_Organizations{} @@ -3567,7 +3574,6 @@ func (t *AdminSearch_AdminSearch_Nodes_TemplateSearchResult) GetTemplates() []*A } type AdminSearch_AdminSearch_Nodes_UserSearchResult_Users struct { - AvatarLocalFile *string "json:\"avatarLocalFile,omitempty\" graphql:\"avatarLocalFile\"" AvatarLocalFileID *string "json:\"avatarLocalFileID,omitempty\" graphql:\"avatarLocalFileID\"" AvatarRemoteURL *string "json:\"avatarRemoteURL,omitempty\" graphql:\"avatarRemoteURL\"" DeletedBy *string "json:\"deletedBy,omitempty\" graphql:\"deletedBy\"" @@ -3580,12 +3586,6 @@ type AdminSearch_AdminSearch_Nodes_UserSearchResult_Users struct { Tags []string "json:\"tags,omitempty\" graphql:\"tags\"" } -func (t *AdminSearch_AdminSearch_Nodes_UserSearchResult_Users) GetAvatarLocalFile() *string { - if t == nil { - t = &AdminSearch_AdminSearch_Nodes_UserSearchResult_Users{} - } - return t.AvatarLocalFile -} func (t *AdminSearch_AdminSearch_Nodes_UserSearchResult_Users) GetAvatarLocalFileID() *string { if t == nil { t = &AdminSearch_AdminSearch_Nodes_UserSearchResult_Users{} @@ -23212,6 +23212,17 @@ func (t *CreateBulkOrganization_CreateBulkOrganization) GetOrganizations() []*Cr return t.Organizations } +type CreateOrganization_CreateOrganization_Organization_AvatarFile struct { + PresignedURL *string "json:\"presignedURL,omitempty\" graphql:\"presignedURL\"" +} + +func (t *CreateOrganization_CreateOrganization_Organization_AvatarFile) GetPresignedURL() *string { + if t == nil { + t = &CreateOrganization_CreateOrganization_Organization_AvatarFile{} + } + return t.PresignedURL +} + type CreateOrganization_CreateOrganization_Organization_Setting struct { BillingAddress *models.Address "json:\"billingAddress,omitempty\" graphql:\"billingAddress\"" BillingContact *string "json:\"billingContact,omitempty\" graphql:\"billingContact\"" @@ -23380,19 +23391,40 @@ func (t *CreateOrganization_CreateOrganization_Organization_Children) GetEdges() } type CreateOrganization_CreateOrganization_Organization struct { - Children CreateOrganization_CreateOrganization_Organization_Children "json:\"children\" graphql:\"children\"" - CreatedAt *time.Time "json:\"createdAt,omitempty\" graphql:\"createdAt\"" - Description *string "json:\"description,omitempty\" graphql:\"description\"" - DisplayName string "json:\"displayName\" graphql:\"displayName\"" - ID string "json:\"id\" graphql:\"id\"" - Name string "json:\"name\" graphql:\"name\"" - Parent *CreateOrganization_CreateOrganization_Organization_Parent "json:\"parent,omitempty\" graphql:\"parent\"" - PersonalOrg *bool "json:\"personalOrg,omitempty\" graphql:\"personalOrg\"" - Setting *CreateOrganization_CreateOrganization_Organization_Setting "json:\"setting,omitempty\" graphql:\"setting\"" - Tags []string "json:\"tags,omitempty\" graphql:\"tags\"" - UpdatedAt *time.Time "json:\"updatedAt,omitempty\" graphql:\"updatedAt\"" + AvatarFile *CreateOrganization_CreateOrganization_Organization_AvatarFile "json:\"avatarFile,omitempty\" graphql:\"avatarFile\"" + AvatarLocalFileID *string "json:\"avatarLocalFileID,omitempty\" graphql:\"avatarLocalFileID\"" + AvatarRemoteURL *string "json:\"avatarRemoteURL,omitempty\" graphql:\"avatarRemoteURL\"" + Children CreateOrganization_CreateOrganization_Organization_Children "json:\"children\" graphql:\"children\"" + CreatedAt *time.Time "json:\"createdAt,omitempty\" graphql:\"createdAt\"" + Description *string "json:\"description,omitempty\" graphql:\"description\"" + DisplayName string "json:\"displayName\" graphql:\"displayName\"" + ID string "json:\"id\" graphql:\"id\"" + Name string "json:\"name\" graphql:\"name\"" + Parent *CreateOrganization_CreateOrganization_Organization_Parent "json:\"parent,omitempty\" graphql:\"parent\"" + PersonalOrg *bool "json:\"personalOrg,omitempty\" graphql:\"personalOrg\"" + Setting *CreateOrganization_CreateOrganization_Organization_Setting "json:\"setting,omitempty\" graphql:\"setting\"" + Tags []string "json:\"tags,omitempty\" graphql:\"tags\"" + UpdatedAt *time.Time "json:\"updatedAt,omitempty\" graphql:\"updatedAt\"" +} + +func (t *CreateOrganization_CreateOrganization_Organization) GetAvatarFile() *CreateOrganization_CreateOrganization_Organization_AvatarFile { + if t == nil { + t = &CreateOrganization_CreateOrganization_Organization{} + } + return t.AvatarFile +} +func (t *CreateOrganization_CreateOrganization_Organization) GetAvatarLocalFileID() *string { + if t == nil { + t = &CreateOrganization_CreateOrganization_Organization{} + } + return t.AvatarLocalFileID +} +func (t *CreateOrganization_CreateOrganization_Organization) GetAvatarRemoteURL() *string { + if t == nil { + t = &CreateOrganization_CreateOrganization_Organization{} + } + return t.AvatarRemoteURL } - func (t *CreateOrganization_CreateOrganization_Organization) GetChildren() *CreateOrganization_CreateOrganization_Organization_Children { if t == nil { t = &CreateOrganization_CreateOrganization_Organization{} @@ -24027,22 +24059,36 @@ func (t *GetOrganizationByID_Organization_Setting) GetUpdatedBy() *string { } type GetOrganizationByID_Organization struct { - Children GetOrganizationByID_Organization_Children "json:\"children\" graphql:\"children\"" - CreatedAt *time.Time "json:\"createdAt,omitempty\" graphql:\"createdAt\"" - CreatedBy *string "json:\"createdBy,omitempty\" graphql:\"createdBy\"" - Description *string "json:\"description,omitempty\" graphql:\"description\"" - DisplayName string "json:\"displayName\" graphql:\"displayName\"" - ID string "json:\"id\" graphql:\"id\"" - Members []*GetOrganizationByID_Organization_Members "json:\"members,omitempty\" graphql:\"members\"" - Name string "json:\"name\" graphql:\"name\"" - Parent *GetOrganizationByID_Organization_Parent "json:\"parent,omitempty\" graphql:\"parent\"" - PersonalOrg *bool "json:\"personalOrg,omitempty\" graphql:\"personalOrg\"" - Setting *GetOrganizationByID_Organization_Setting "json:\"setting,omitempty\" graphql:\"setting\"" - Tags []string "json:\"tags,omitempty\" graphql:\"tags\"" - UpdatedAt *time.Time "json:\"updatedAt,omitempty\" graphql:\"updatedAt\"" - UpdatedBy *string "json:\"updatedBy,omitempty\" graphql:\"updatedBy\"" + AvatarLocalFileID *string "json:\"avatarLocalFileID,omitempty\" graphql:\"avatarLocalFileID\"" + AvatarRemoteURL *string "json:\"avatarRemoteURL,omitempty\" graphql:\"avatarRemoteURL\"" + Children GetOrganizationByID_Organization_Children "json:\"children\" graphql:\"children\"" + CreatedAt *time.Time "json:\"createdAt,omitempty\" graphql:\"createdAt\"" + CreatedBy *string "json:\"createdBy,omitempty\" graphql:\"createdBy\"" + Description *string "json:\"description,omitempty\" graphql:\"description\"" + DisplayName string "json:\"displayName\" graphql:\"displayName\"" + ID string "json:\"id\" graphql:\"id\"" + Members []*GetOrganizationByID_Organization_Members "json:\"members,omitempty\" graphql:\"members\"" + Name string "json:\"name\" graphql:\"name\"" + Parent *GetOrganizationByID_Organization_Parent "json:\"parent,omitempty\" graphql:\"parent\"" + PersonalOrg *bool "json:\"personalOrg,omitempty\" graphql:\"personalOrg\"" + Setting *GetOrganizationByID_Organization_Setting "json:\"setting,omitempty\" graphql:\"setting\"" + Tags []string "json:\"tags,omitempty\" graphql:\"tags\"" + UpdatedAt *time.Time "json:\"updatedAt,omitempty\" graphql:\"updatedAt\"" + UpdatedBy *string "json:\"updatedBy,omitempty\" graphql:\"updatedBy\"" +} + +func (t *GetOrganizationByID_Organization) GetAvatarLocalFileID() *string { + if t == nil { + t = &GetOrganizationByID_Organization{} + } + return t.AvatarLocalFileID +} +func (t *GetOrganizationByID_Organization) GetAvatarRemoteURL() *string { + if t == nil { + t = &GetOrganizationByID_Organization{} + } + return t.AvatarRemoteURL } - func (t *GetOrganizationByID_Organization) GetChildren() *GetOrganizationByID_Organization_Children { if t == nil { t = &GetOrganizationByID_Organization{} @@ -24455,6 +24501,17 @@ func (t *GetOrganizations_Organizations) GetEdges() []*GetOrganizations_Organiza return t.Edges } +type UpdateOrganization_UpdateOrganization_Organization_AvatarFile struct { + PresignedURL *string "json:\"presignedURL,omitempty\" graphql:\"presignedURL\"" +} + +func (t *UpdateOrganization_UpdateOrganization_Organization_AvatarFile) GetPresignedURL() *string { + if t == nil { + t = &UpdateOrganization_UpdateOrganization_Organization_AvatarFile{} + } + return t.PresignedURL +} + type UpdateOrganization_UpdateOrganization_Organization_Members struct { ID string "json:\"id\" graphql:\"id\"" Role enums.Role "json:\"role\" graphql:\"role\"" @@ -24576,16 +24633,37 @@ func (t *UpdateOrganization_UpdateOrganization_Organization_Setting) GetUpdatedB } type UpdateOrganization_UpdateOrganization_Organization struct { - Description *string "json:\"description,omitempty\" graphql:\"description\"" - DisplayName string "json:\"displayName\" graphql:\"displayName\"" - ID string "json:\"id\" graphql:\"id\"" - Members []*UpdateOrganization_UpdateOrganization_Organization_Members "json:\"members,omitempty\" graphql:\"members\"" - Name string "json:\"name\" graphql:\"name\"" - PersonalOrg *bool "json:\"personalOrg,omitempty\" graphql:\"personalOrg\"" - Setting *UpdateOrganization_UpdateOrganization_Organization_Setting "json:\"setting,omitempty\" graphql:\"setting\"" - Tags []string "json:\"tags,omitempty\" graphql:\"tags\"" + AvatarFile *UpdateOrganization_UpdateOrganization_Organization_AvatarFile "json:\"avatarFile,omitempty\" graphql:\"avatarFile\"" + AvatarLocalFileID *string "json:\"avatarLocalFileID,omitempty\" graphql:\"avatarLocalFileID\"" + AvatarRemoteURL *string "json:\"avatarRemoteURL,omitempty\" graphql:\"avatarRemoteURL\"" + Description *string "json:\"description,omitempty\" graphql:\"description\"" + DisplayName string "json:\"displayName\" graphql:\"displayName\"" + ID string "json:\"id\" graphql:\"id\"" + Members []*UpdateOrganization_UpdateOrganization_Organization_Members "json:\"members,omitempty\" graphql:\"members\"" + Name string "json:\"name\" graphql:\"name\"" + PersonalOrg *bool "json:\"personalOrg,omitempty\" graphql:\"personalOrg\"" + Setting *UpdateOrganization_UpdateOrganization_Organization_Setting "json:\"setting,omitempty\" graphql:\"setting\"" + Tags []string "json:\"tags,omitempty\" graphql:\"tags\"" } +func (t *UpdateOrganization_UpdateOrganization_Organization) GetAvatarFile() *UpdateOrganization_UpdateOrganization_Organization_AvatarFile { + if t == nil { + t = &UpdateOrganization_UpdateOrganization_Organization{} + } + return t.AvatarFile +} +func (t *UpdateOrganization_UpdateOrganization_Organization) GetAvatarLocalFileID() *string { + if t == nil { + t = &UpdateOrganization_UpdateOrganization_Organization{} + } + return t.AvatarLocalFileID +} +func (t *UpdateOrganization_UpdateOrganization_Organization) GetAvatarRemoteURL() *string { + if t == nil { + t = &UpdateOrganization_UpdateOrganization_Organization{} + } + return t.AvatarRemoteURL +} func (t *UpdateOrganization_UpdateOrganization_Organization) GetDescription() *string { if t == nil { t = &UpdateOrganization_UpdateOrganization_Organization{} @@ -42176,6 +42254,17 @@ func (t *UpdateTFASetting_UpdateTFASetting) GetTfaSetting() *UpdateTFASetting_Up return &t.TfaSetting } +type CreateUser_CreateUser_User_AvatarFile struct { + PresignedURL *string "json:\"presignedURL,omitempty\" graphql:\"presignedURL\"" +} + +func (t *CreateUser_CreateUser_User_AvatarFile) GetPresignedURL() *string { + if t == nil { + t = &CreateUser_CreateUser_User_AvatarFile{} + } + return t.PresignedURL +} + type CreateUser_CreateUser_User_OrgMemberships struct { ID string "json:\"id\" graphql:\"id\"" OrganizationID string "json:\"organizationID\" graphql:\"organizationID\"" @@ -42320,7 +42409,7 @@ func (t *CreateUser_CreateUser_User_Setting) GetUpdatedBy() *string { type CreateUser_CreateUser_User struct { AuthProvider enums.AuthProvider "json:\"authProvider\" graphql:\"authProvider\"" - AvatarLocalFile *string "json:\"avatarLocalFile,omitempty\" graphql:\"avatarLocalFile\"" + AvatarFile *CreateUser_CreateUser_User_AvatarFile "json:\"avatarFile,omitempty\" graphql:\"avatarFile\"" AvatarLocalFileID *string "json:\"avatarLocalFileID,omitempty\" graphql:\"avatarLocalFileID\"" AvatarRemoteURL *string "json:\"avatarRemoteURL,omitempty\" graphql:\"avatarRemoteURL\"" DisplayName string "json:\"displayName\" graphql:\"displayName\"" @@ -42341,11 +42430,11 @@ func (t *CreateUser_CreateUser_User) GetAuthProvider() *enums.AuthProvider { } return &t.AuthProvider } -func (t *CreateUser_CreateUser_User) GetAvatarLocalFile() *string { +func (t *CreateUser_CreateUser_User) GetAvatarFile() *CreateUser_CreateUser_User_AvatarFile { if t == nil { t = &CreateUser_CreateUser_User{} } - return t.AvatarLocalFile + return t.AvatarFile } func (t *CreateUser_CreateUser_User) GetAvatarLocalFileID() *string { if t == nil { @@ -42442,6 +42531,17 @@ func (t *DeleteUser_DeleteUser) GetDeletedID() string { return t.DeletedID } +type GetAllUsers_Users_Edges_Node_AvatarFile struct { + PresignedURL *string "json:\"presignedURL,omitempty\" graphql:\"presignedURL\"" +} + +func (t *GetAllUsers_Users_Edges_Node_AvatarFile) GetPresignedURL() *string { + if t == nil { + t = &GetAllUsers_Users_Edges_Node_AvatarFile{} + } + return t.PresignedURL +} + type GetAllUsers_Users_Edges_Node_Setting_DefaultOrg struct { ID string "json:\"id\" graphql:\"id\"" Name string "json:\"name\" graphql:\"name\"" @@ -42549,23 +42649,23 @@ func (t *GetAllUsers_Users_Edges_Node_Setting) GetUpdatedBy() *string { } type GetAllUsers_Users_Edges_Node struct { - AuthProvider enums.AuthProvider "json:\"authProvider\" graphql:\"authProvider\"" - AvatarLocalFile *string "json:\"avatarLocalFile,omitempty\" graphql:\"avatarLocalFile\"" - AvatarLocalFileID *string "json:\"avatarLocalFileID,omitempty\" graphql:\"avatarLocalFileID\"" - AvatarRemoteURL *string "json:\"avatarRemoteURL,omitempty\" graphql:\"avatarRemoteURL\"" - CreatedAt *time.Time "json:\"createdAt,omitempty\" graphql:\"createdAt\"" - CreatedBy *string "json:\"createdBy,omitempty\" graphql:\"createdBy\"" - DisplayName string "json:\"displayName\" graphql:\"displayName\"" - Email string "json:\"email\" graphql:\"email\"" - FirstName *string "json:\"firstName,omitempty\" graphql:\"firstName\"" - ID string "json:\"id\" graphql:\"id\"" - LastName *string "json:\"lastName,omitempty\" graphql:\"lastName\"" - LastSeen *time.Time "json:\"lastSeen,omitempty\" graphql:\"lastSeen\"" - Setting GetAllUsers_Users_Edges_Node_Setting "json:\"setting\" graphql:\"setting\"" - Sub *string "json:\"sub,omitempty\" graphql:\"sub\"" - Tags []string "json:\"tags,omitempty\" graphql:\"tags\"" - UpdatedAt *time.Time "json:\"updatedAt,omitempty\" graphql:\"updatedAt\"" - UpdatedBy *string "json:\"updatedBy,omitempty\" graphql:\"updatedBy\"" + AuthProvider enums.AuthProvider "json:\"authProvider\" graphql:\"authProvider\"" + AvatarFile *GetAllUsers_Users_Edges_Node_AvatarFile "json:\"avatarFile,omitempty\" graphql:\"avatarFile\"" + AvatarLocalFileID *string "json:\"avatarLocalFileID,omitempty\" graphql:\"avatarLocalFileID\"" + AvatarRemoteURL *string "json:\"avatarRemoteURL,omitempty\" graphql:\"avatarRemoteURL\"" + CreatedAt *time.Time "json:\"createdAt,omitempty\" graphql:\"createdAt\"" + CreatedBy *string "json:\"createdBy,omitempty\" graphql:\"createdBy\"" + DisplayName string "json:\"displayName\" graphql:\"displayName\"" + Email string "json:\"email\" graphql:\"email\"" + FirstName *string "json:\"firstName,omitempty\" graphql:\"firstName\"" + ID string "json:\"id\" graphql:\"id\"" + LastName *string "json:\"lastName,omitempty\" graphql:\"lastName\"" + LastSeen *time.Time "json:\"lastSeen,omitempty\" graphql:\"lastSeen\"" + Setting GetAllUsers_Users_Edges_Node_Setting "json:\"setting\" graphql:\"setting\"" + Sub *string "json:\"sub,omitempty\" graphql:\"sub\"" + Tags []string "json:\"tags,omitempty\" graphql:\"tags\"" + UpdatedAt *time.Time "json:\"updatedAt,omitempty\" graphql:\"updatedAt\"" + UpdatedBy *string "json:\"updatedBy,omitempty\" graphql:\"updatedBy\"" } func (t *GetAllUsers_Users_Edges_Node) GetAuthProvider() *enums.AuthProvider { @@ -42574,11 +42674,11 @@ func (t *GetAllUsers_Users_Edges_Node) GetAuthProvider() *enums.AuthProvider { } return &t.AuthProvider } -func (t *GetAllUsers_Users_Edges_Node) GetAvatarLocalFile() *string { +func (t *GetAllUsers_Users_Edges_Node) GetAvatarFile() *GetAllUsers_Users_Edges_Node_AvatarFile { if t == nil { t = &GetAllUsers_Users_Edges_Node{} } - return t.AvatarLocalFile + return t.AvatarFile } func (t *GetAllUsers_Users_Edges_Node) GetAvatarLocalFileID() *string { if t == nil { @@ -42693,6 +42793,17 @@ func (t *GetAllUsers_Users) GetEdges() []*GetAllUsers_Users_Edges { return t.Edges } +type GetUserByID_User_AvatarFile struct { + PresignedURL *string "json:\"presignedURL,omitempty\" graphql:\"presignedURL\"" +} + +func (t *GetUserByID_User_AvatarFile) GetPresignedURL() *string { + if t == nil { + t = &GetUserByID_User_AvatarFile{} + } + return t.PresignedURL +} + type GetUserByID_User_Setting_DefaultOrg struct { ID string "json:\"id\" graphql:\"id\"" Name string "json:\"name\" graphql:\"name\"" @@ -42851,7 +42962,7 @@ func (t *GetUserByID_User_Organizations) GetPersonalOrg() *bool { type GetUserByID_User struct { AuthProvider enums.AuthProvider "json:\"authProvider\" graphql:\"authProvider\"" - AvatarLocalFile *string "json:\"avatarLocalFile,omitempty\" graphql:\"avatarLocalFile\"" + AvatarFile *GetUserByID_User_AvatarFile "json:\"avatarFile,omitempty\" graphql:\"avatarFile\"" AvatarLocalFileID *string "json:\"avatarLocalFileID,omitempty\" graphql:\"avatarLocalFileID\"" AvatarRemoteURL *string "json:\"avatarRemoteURL,omitempty\" graphql:\"avatarRemoteURL\"" CreatedAt *time.Time "json:\"createdAt,omitempty\" graphql:\"createdAt\"" @@ -42876,11 +42987,11 @@ func (t *GetUserByID_User) GetAuthProvider() *enums.AuthProvider { } return &t.AuthProvider } -func (t *GetUserByID_User) GetAvatarLocalFile() *string { +func (t *GetUserByID_User) GetAvatarFile() *GetUserByID_User_AvatarFile { if t == nil { t = &GetUserByID_User{} } - return t.AvatarLocalFile + return t.AvatarFile } func (t *GetUserByID_User) GetAvatarLocalFileID() *string { if t == nil { @@ -42979,6 +43090,17 @@ func (t *GetUserByID_User) GetUpdatedBy() *string { return t.UpdatedBy } +type GetUserByIDWithOrgs_User_AvatarFile struct { + PresignedURL *string "json:\"presignedURL,omitempty\" graphql:\"presignedURL\"" +} + +func (t *GetUserByIDWithOrgs_User_AvatarFile) GetPresignedURL() *string { + if t == nil { + t = &GetUserByIDWithOrgs_User_AvatarFile{} + } + return t.PresignedURL +} + type GetUserByIDWithOrgs_User_Setting_DefaultOrg struct { ID string "json:\"id\" graphql:\"id\"" Name string "json:\"name\" graphql:\"name\"" @@ -43130,7 +43252,7 @@ func (t *GetUserByIDWithOrgs_User_OrgMemberships) GetUser() *GetUserByIDWithOrgs type GetUserByIDWithOrgs_User struct { AuthProvider enums.AuthProvider "json:\"authProvider\" graphql:\"authProvider\"" - AvatarLocalFile *string "json:\"avatarLocalFile,omitempty\" graphql:\"avatarLocalFile\"" + AvatarFile *GetUserByIDWithOrgs_User_AvatarFile "json:\"avatarFile,omitempty\" graphql:\"avatarFile\"" AvatarLocalFileID *string "json:\"avatarLocalFileID,omitempty\" graphql:\"avatarLocalFileID\"" AvatarRemoteURL *string "json:\"avatarRemoteURL,omitempty\" graphql:\"avatarRemoteURL\"" CreatedAt *time.Time "json:\"createdAt,omitempty\" graphql:\"createdAt\"" @@ -43155,11 +43277,11 @@ func (t *GetUserByIDWithOrgs_User) GetAuthProvider() *enums.AuthProvider { } return &t.AuthProvider } -func (t *GetUserByIDWithOrgs_User) GetAvatarLocalFile() *string { +func (t *GetUserByIDWithOrgs_User) GetAvatarFile() *GetUserByIDWithOrgs_User_AvatarFile { if t == nil { t = &GetUserByIDWithOrgs_User{} } - return t.AvatarLocalFile + return t.AvatarFile } func (t *GetUserByIDWithOrgs_User) GetAvatarLocalFileID() *string { if t == nil { @@ -43258,6 +43380,17 @@ func (t *GetUserByIDWithOrgs_User) GetUpdatedBy() *string { return t.UpdatedBy } +type UpdateUser_UpdateUser_User_AvatarFile struct { + PresignedURL *string "json:\"presignedURL,omitempty\" graphql:\"presignedURL\"" +} + +func (t *UpdateUser_UpdateUser_User_AvatarFile) GetPresignedURL() *string { + if t == nil { + t = &UpdateUser_UpdateUser_User_AvatarFile{} + } + return t.PresignedURL +} + type UpdateUser_UpdateUser_User_GroupMemberships struct { ID string "json:\"id\" graphql:\"id\"" } @@ -43388,7 +43521,7 @@ func (t *UpdateUser_UpdateUser_User_Setting) GetUpdatedBy() *string { type UpdateUser_UpdateUser_User struct { AuthProvider enums.AuthProvider "json:\"authProvider\" graphql:\"authProvider\"" - AvatarLocalFile *string "json:\"avatarLocalFile,omitempty\" graphql:\"avatarLocalFile\"" + AvatarFile *UpdateUser_UpdateUser_User_AvatarFile "json:\"avatarFile,omitempty\" graphql:\"avatarFile\"" AvatarLocalFileID *string "json:\"avatarLocalFileID,omitempty\" graphql:\"avatarLocalFileID\"" AvatarRemoteURL *string "json:\"avatarRemoteURL,omitempty\" graphql:\"avatarRemoteURL\"" DisplayName string "json:\"displayName\" graphql:\"displayName\"" @@ -43409,11 +43542,11 @@ func (t *UpdateUser_UpdateUser_User) GetAuthProvider() *enums.AuthProvider { } return &t.AuthProvider } -func (t *UpdateUser_UpdateUser_User) GetAvatarLocalFile() *string { +func (t *UpdateUser_UpdateUser_User) GetAvatarFile() *UpdateUser_UpdateUser_User_AvatarFile { if t == nil { t = &UpdateUser_UpdateUser_User{} } - return t.AvatarLocalFile + return t.AvatarFile } func (t *UpdateUser_UpdateUser_User) GetAvatarLocalFileID() *string { if t == nil { @@ -43500,26 +43633,26 @@ func (t *UpdateUser_UpdateUser) GetUser() *UpdateUser_UpdateUser_User { } type GetAllUserHistories_UserHistories_Edges_Node struct { - AuthProvider enums.AuthProvider "json:\"authProvider\" graphql:\"authProvider\"" - AvatarLocalFile *string "json:\"avatarLocalFile,omitempty\" graphql:\"avatarLocalFile\"" - AvatarRemoteURL *string "json:\"avatarRemoteURL,omitempty\" graphql:\"avatarRemoteURL\"" - AvatarUpdatedAt *time.Time "json:\"avatarUpdatedAt,omitempty\" graphql:\"avatarUpdatedAt\"" - CreatedAt *time.Time "json:\"createdAt,omitempty\" graphql:\"createdAt\"" - CreatedBy *string "json:\"createdBy,omitempty\" graphql:\"createdBy\"" - DisplayName string "json:\"displayName\" graphql:\"displayName\"" - Email string "json:\"email\" graphql:\"email\"" - FirstName *string "json:\"firstName,omitempty\" graphql:\"firstName\"" - HistoryTime time.Time "json:\"historyTime\" graphql:\"historyTime\"" - ID string "json:\"id\" graphql:\"id\"" - LastName *string "json:\"lastName,omitempty\" graphql:\"lastName\"" - LastSeen *time.Time "json:\"lastSeen,omitempty\" graphql:\"lastSeen\"" - Operation history.OpType "json:\"operation\" graphql:\"operation\"" - Ref *string "json:\"ref,omitempty\" graphql:\"ref\"" - Role *enums.Role "json:\"role,omitempty\" graphql:\"role\"" - Sub *string "json:\"sub,omitempty\" graphql:\"sub\"" - Tags []string "json:\"tags,omitempty\" graphql:\"tags\"" - UpdatedAt *time.Time "json:\"updatedAt,omitempty\" graphql:\"updatedAt\"" - UpdatedBy *string "json:\"updatedBy,omitempty\" graphql:\"updatedBy\"" + AuthProvider enums.AuthProvider "json:\"authProvider\" graphql:\"authProvider\"" + AvatarLocalFileID *string "json:\"avatarLocalFileID,omitempty\" graphql:\"avatarLocalFileID\"" + AvatarRemoteURL *string "json:\"avatarRemoteURL,omitempty\" graphql:\"avatarRemoteURL\"" + AvatarUpdatedAt *time.Time "json:\"avatarUpdatedAt,omitempty\" graphql:\"avatarUpdatedAt\"" + CreatedAt *time.Time "json:\"createdAt,omitempty\" graphql:\"createdAt\"" + CreatedBy *string "json:\"createdBy,omitempty\" graphql:\"createdBy\"" + DisplayName string "json:\"displayName\" graphql:\"displayName\"" + Email string "json:\"email\" graphql:\"email\"" + FirstName *string "json:\"firstName,omitempty\" graphql:\"firstName\"" + HistoryTime time.Time "json:\"historyTime\" graphql:\"historyTime\"" + ID string "json:\"id\" graphql:\"id\"" + LastName *string "json:\"lastName,omitempty\" graphql:\"lastName\"" + LastSeen *time.Time "json:\"lastSeen,omitempty\" graphql:\"lastSeen\"" + Operation history.OpType "json:\"operation\" graphql:\"operation\"" + Ref *string "json:\"ref,omitempty\" graphql:\"ref\"" + Role *enums.Role "json:\"role,omitempty\" graphql:\"role\"" + Sub *string "json:\"sub,omitempty\" graphql:\"sub\"" + Tags []string "json:\"tags,omitempty\" graphql:\"tags\"" + UpdatedAt *time.Time "json:\"updatedAt,omitempty\" graphql:\"updatedAt\"" + UpdatedBy *string "json:\"updatedBy,omitempty\" graphql:\"updatedBy\"" } func (t *GetAllUserHistories_UserHistories_Edges_Node) GetAuthProvider() *enums.AuthProvider { @@ -43528,11 +43661,11 @@ func (t *GetAllUserHistories_UserHistories_Edges_Node) GetAuthProvider() *enums. } return &t.AuthProvider } -func (t *GetAllUserHistories_UserHistories_Edges_Node) GetAvatarLocalFile() *string { +func (t *GetAllUserHistories_UserHistories_Edges_Node) GetAvatarLocalFileID() *string { if t == nil { t = &GetAllUserHistories_UserHistories_Edges_Node{} } - return t.AvatarLocalFile + return t.AvatarLocalFileID } func (t *GetAllUserHistories_UserHistories_Edges_Node) GetAvatarRemoteURL() *string { if t == nil { @@ -43666,26 +43799,26 @@ func (t *GetAllUserHistories_UserHistories) GetEdges() []*GetAllUserHistories_Us } type GetUserHistories_UserHistories_Edges_Node struct { - AuthProvider enums.AuthProvider "json:\"authProvider\" graphql:\"authProvider\"" - AvatarLocalFile *string "json:\"avatarLocalFile,omitempty\" graphql:\"avatarLocalFile\"" - AvatarRemoteURL *string "json:\"avatarRemoteURL,omitempty\" graphql:\"avatarRemoteURL\"" - AvatarUpdatedAt *time.Time "json:\"avatarUpdatedAt,omitempty\" graphql:\"avatarUpdatedAt\"" - CreatedAt *time.Time "json:\"createdAt,omitempty\" graphql:\"createdAt\"" - CreatedBy *string "json:\"createdBy,omitempty\" graphql:\"createdBy\"" - DisplayName string "json:\"displayName\" graphql:\"displayName\"" - Email string "json:\"email\" graphql:\"email\"" - FirstName *string "json:\"firstName,omitempty\" graphql:\"firstName\"" - HistoryTime time.Time "json:\"historyTime\" graphql:\"historyTime\"" - ID string "json:\"id\" graphql:\"id\"" - LastName *string "json:\"lastName,omitempty\" graphql:\"lastName\"" - LastSeen *time.Time "json:\"lastSeen,omitempty\" graphql:\"lastSeen\"" - Operation history.OpType "json:\"operation\" graphql:\"operation\"" - Ref *string "json:\"ref,omitempty\" graphql:\"ref\"" - Role *enums.Role "json:\"role,omitempty\" graphql:\"role\"" - Sub *string "json:\"sub,omitempty\" graphql:\"sub\"" - Tags []string "json:\"tags,omitempty\" graphql:\"tags\"" - UpdatedAt *time.Time "json:\"updatedAt,omitempty\" graphql:\"updatedAt\"" - UpdatedBy *string "json:\"updatedBy,omitempty\" graphql:\"updatedBy\"" + AuthProvider enums.AuthProvider "json:\"authProvider\" graphql:\"authProvider\"" + AvatarLocalFileID *string "json:\"avatarLocalFileID,omitempty\" graphql:\"avatarLocalFileID\"" + AvatarRemoteURL *string "json:\"avatarRemoteURL,omitempty\" graphql:\"avatarRemoteURL\"" + AvatarUpdatedAt *time.Time "json:\"avatarUpdatedAt,omitempty\" graphql:\"avatarUpdatedAt\"" + CreatedAt *time.Time "json:\"createdAt,omitempty\" graphql:\"createdAt\"" + CreatedBy *string "json:\"createdBy,omitempty\" graphql:\"createdBy\"" + DisplayName string "json:\"displayName\" graphql:\"displayName\"" + Email string "json:\"email\" graphql:\"email\"" + FirstName *string "json:\"firstName,omitempty\" graphql:\"firstName\"" + HistoryTime time.Time "json:\"historyTime\" graphql:\"historyTime\"" + ID string "json:\"id\" graphql:\"id\"" + LastName *string "json:\"lastName,omitempty\" graphql:\"lastName\"" + LastSeen *time.Time "json:\"lastSeen,omitempty\" graphql:\"lastSeen\"" + Operation history.OpType "json:\"operation\" graphql:\"operation\"" + Ref *string "json:\"ref,omitempty\" graphql:\"ref\"" + Role *enums.Role "json:\"role,omitempty\" graphql:\"role\"" + Sub *string "json:\"sub,omitempty\" graphql:\"sub\"" + Tags []string "json:\"tags,omitempty\" graphql:\"tags\"" + UpdatedAt *time.Time "json:\"updatedAt,omitempty\" graphql:\"updatedAt\"" + UpdatedBy *string "json:\"updatedBy,omitempty\" graphql:\"updatedBy\"" } func (t *GetUserHistories_UserHistories_Edges_Node) GetAuthProvider() *enums.AuthProvider { @@ -43694,11 +43827,11 @@ func (t *GetUserHistories_UserHistories_Edges_Node) GetAuthProvider() *enums.Aut } return &t.AuthProvider } -func (t *GetUserHistories_UserHistories_Edges_Node) GetAvatarLocalFile() *string { +func (t *GetUserHistories_UserHistories_Edges_Node) GetAvatarLocalFileID() *string { if t == nil { t = &GetUserHistories_UserHistories_Edges_Node{} } - return t.AvatarLocalFile + return t.AvatarLocalFileID } func (t *GetUserHistories_UserHistories_Edges_Node) GetAvatarRemoteURL() *string { if t == nil { @@ -48689,6 +48822,7 @@ const AdminSearchDocument = `query AdminSearch ($query: String!) { name displayName avatarRemoteURL + avatarLocalFileID } } ... on OrganizationSettingSearchResult { @@ -48847,7 +48981,6 @@ const AdminSearchDocument = `query AdminSearch ($query: String!) { lastName displayName avatarRemoteURL - avatarLocalFile avatarLocalFileID sub } @@ -55156,8 +55289,8 @@ func (c *Client) CreateBulkOrganization(ctx context.Context, input []*CreateOrga return &res, nil } -const CreateOrganizationDocument = `mutation CreateOrganization ($input: CreateOrganizationInput!) { - createOrganization(input: $input) { +const CreateOrganizationDocument = `mutation CreateOrganization ($input: CreateOrganizationInput!, $avatarFile: Upload) { + createOrganization(input: $input, avatarFile: $avatarFile) { organization { id name @@ -55165,6 +55298,11 @@ const CreateOrganizationDocument = `mutation CreateOrganization ($input: CreateO description personalOrg tags + avatarRemoteURL + avatarLocalFileID + avatarFile { + presignedURL + } createdAt updatedAt setting { @@ -55201,9 +55339,10 @@ const CreateOrganizationDocument = `mutation CreateOrganization ($input: CreateO } ` -func (c *Client) CreateOrganization(ctx context.Context, input CreateOrganizationInput, interceptors ...clientv2.RequestInterceptor) (*CreateOrganization, error) { +func (c *Client) CreateOrganization(ctx context.Context, input CreateOrganizationInput, avatarFile *graphql.Upload, interceptors ...clientv2.RequestInterceptor) (*CreateOrganization, error) { vars := map[string]any{ - "input": input, + "input": input, + "avatarFile": avatarFile, } var res CreateOrganization @@ -55321,6 +55460,8 @@ const GetOrganizationByIDDocument = `query GetOrganizationByID ($organizationId: description personalOrg tags + avatarRemoteURL + avatarLocalFileID parent { id name @@ -55457,14 +55598,19 @@ func (c *Client) GetOrganizations(ctx context.Context, where *OrganizationWhereI return &res, nil } -const UpdateOrganizationDocument = `mutation UpdateOrganization ($updateOrganizationId: ID!, $input: UpdateOrganizationInput!) { - updateOrganization(id: $updateOrganizationId, input: $input) { +const UpdateOrganizationDocument = `mutation UpdateOrganization ($updateOrganizationId: ID!, $input: UpdateOrganizationInput!, $avatarFile: Upload) { + updateOrganization(id: $updateOrganizationId, input: $input, avatarFile: $avatarFile) { organization { id name displayName description personalOrg + avatarLocalFileID + avatarRemoteURL + avatarFile { + presignedURL + } tags members { id @@ -55491,10 +55637,11 @@ const UpdateOrganizationDocument = `mutation UpdateOrganization ($updateOrganiza } ` -func (c *Client) UpdateOrganization(ctx context.Context, updateOrganizationID string, input UpdateOrganizationInput, interceptors ...clientv2.RequestInterceptor) (*UpdateOrganization, error) { +func (c *Client) UpdateOrganization(ctx context.Context, updateOrganizationID string, input UpdateOrganizationInput, avatarFile *graphql.Upload, interceptors ...clientv2.RequestInterceptor) (*UpdateOrganization, error) { vars := map[string]any{ "updateOrganizationId": updateOrganizationID, "input": input, + "avatarFile": avatarFile, } var res UpdateOrganization @@ -60992,9 +61139,11 @@ const CreateUserDocument = `mutation CreateUser ($input: CreateUserInput!, $avat createUser(input: $input, avatarFile: $avatarFile) { user { authProvider - avatarLocalFile avatarRemoteURL avatarLocalFileID + avatarFile { + presignedURL + } displayName email firstName @@ -61079,9 +61228,11 @@ const GetAllUsersDocument = `query GetAllUsers { edges { node { authProvider - avatarLocalFile avatarRemoteURL avatarLocalFileID + avatarFile { + presignedURL + } displayName email firstName @@ -61135,9 +61286,11 @@ func (c *Client) GetAllUsers(ctx context.Context, interceptors ...clientv2.Reque const GetUserByIDDocument = `query GetUserByID ($userId: ID!) { user(id: $userId) { authProvider - avatarLocalFile avatarRemoteURL avatarLocalFileID + avatarFile { + presignedURL + } displayName email firstName @@ -61200,9 +61353,11 @@ func (c *Client) GetUserByID(ctx context.Context, userID string, interceptors .. const GetUserByIDWithOrgsDocument = `query GetUserByIDWithOrgs ($userId: ID!) { user(id: $userId) { authProvider - avatarLocalFile avatarRemoteURL avatarLocalFileID + avatarFile { + presignedURL + } displayName email firstName @@ -61265,9 +61420,11 @@ const UpdateUserDocument = `mutation UpdateUser ($updateUserId: ID!, $input: Upd updateUser(id: $updateUserId, input: $input, avatarFile: $avatarFile) { user { authProvider - avatarLocalFile avatarRemoteURL avatarLocalFileID + avatarFile { + presignedURL + } displayName email firstName @@ -61327,7 +61484,7 @@ const GetAllUserHistoriesDocument = `query GetAllUserHistories { edges { node { authProvider - avatarLocalFile + avatarLocalFileID avatarRemoteURL avatarUpdatedAt createdAt @@ -61372,7 +61529,7 @@ const GetUserHistoriesDocument = `query GetUserHistories ($where: UserHistoryWhe edges { node { authProvider - avatarLocalFile + avatarLocalFileID avatarRemoteURL avatarUpdatedAt createdAt diff --git a/pkg/openlaneclient/models.go b/pkg/openlaneclient/models.go index c942ed76..8521f0f2 100644 --- a/pkg/openlaneclient/models.go +++ b/pkg/openlaneclient/models.go @@ -3528,6 +3528,8 @@ type CreateOrganizationInput struct { PersonalOrg *bool `json:"personalOrg,omitempty"` // URL of the user's remote avatar AvatarRemoteURL *string `json:"avatarRemoteURL,omitempty"` + // The time the user's (local) avatar was last updated + AvatarUpdatedAt *time.Time `json:"avatarUpdatedAt,omitempty"` // Whether the organization has a dedicated database DedicatedDb *bool `json:"dedicatedDb,omitempty"` ControlCreatorIDs []string `json:"controlCreatorIDs,omitempty"` @@ -3554,6 +3556,7 @@ type CreateOrganizationInput struct { EventIDs []string `json:"eventIDs,omitempty"` SecretIDs []string `json:"secretIDs,omitempty"` FileIDs []string `json:"fileIDs,omitempty"` + AvatarFileID *string `json:"avatarFileID,omitempty"` EntityIDs []string `json:"entityIDs,omitempty"` EntityTypeIDs []string `json:"entityTypeIDs,omitempty"` ContactIDs []string `json:"contactIDs,omitempty"` @@ -3896,8 +3899,6 @@ type CreateUserInput struct { DisplayName string `json:"displayName"` // URL of the user's remote avatar AvatarRemoteURL *string `json:"avatarRemoteURL,omitempty"` - // The user's local avatar file - AvatarLocalFile *string `json:"avatarLocalFile,omitempty"` // The time the user's (local) avatar was last updated AvatarUpdatedAt *time.Time `json:"avatarUpdatedAt,omitempty"` // the time the user was last seen @@ -3919,7 +3920,7 @@ type CreateUserInput struct { OrganizationIDs []string `json:"organizationIDs,omitempty"` WebauthnIDs []string `json:"webauthnIDs,omitempty"` FileIDs []string `json:"fileIDs,omitempty"` - FileID *string `json:"fileID,omitempty"` + AvatarFileID *string `json:"avatarFileID,omitempty"` EventIDs []string `json:"eventIDs,omitempty"` ActionPlanIDs []string `json:"actionPlanIDs,omitempty"` SubcontrolIDs []string `json:"subcontrolIDs,omitempty"` @@ -5800,6 +5801,7 @@ type File struct { DocumentData []*DocumentData `json:"documentData,omitempty"` Events []*Event `json:"events,omitempty"` Program []*Program `json:"program,omitempty"` + PresignedURL *string `json:"presignedURL,omitempty"` } func (File) IsNode() {} @@ -11597,6 +11599,10 @@ type Organization struct { PersonalOrg *bool `json:"personalOrg,omitempty"` // URL of the user's remote avatar AvatarRemoteURL *string `json:"avatarRemoteURL,omitempty"` + // The organizations's local avatar file id, takes precedence over the avatar remote URL + AvatarLocalFileID *string `json:"avatarLocalFileID,omitempty"` + // The time the user's (local) avatar was last updated + AvatarUpdatedAt *time.Time `json:"avatarUpdatedAt,omitempty"` // Whether the organization has a dedicated database DedicatedDb bool `json:"dedicatedDb"` // groups that are allowed to create controls @@ -11633,6 +11639,7 @@ type Organization struct { Events []*Event `json:"events,omitempty"` Secrets []*Hush `json:"secrets,omitempty"` Files []*File `json:"files,omitempty"` + AvatarFile *File `json:"avatarFile,omitempty"` Entities []*Entity `json:"entities,omitempty"` EntityTypes []*EntityType `json:"entityTypes,omitempty"` Contacts []*Contact `json:"contacts,omitempty"` @@ -11710,6 +11717,10 @@ type OrganizationHistory struct { PersonalOrg *bool `json:"personalOrg,omitempty"` // URL of the user's remote avatar AvatarRemoteURL *string `json:"avatarRemoteURL,omitempty"` + // The organizations's local avatar file id, takes precedence over the avatar remote URL + AvatarLocalFileID *string `json:"avatarLocalFileID,omitempty"` + // The time the user's (local) avatar was last updated + AvatarUpdatedAt *time.Time `json:"avatarUpdatedAt,omitempty"` // Whether the organization has a dedicated database DedicatedDb bool `json:"dedicatedDb"` } @@ -11921,6 +11932,33 @@ type OrganizationHistoryWhereInput struct { AvatarRemoteURLNotNil *bool `json:"avatarRemoteURLNotNil,omitempty"` AvatarRemoteURLEqualFold *string `json:"avatarRemoteURLEqualFold,omitempty"` AvatarRemoteURLContainsFold *string `json:"avatarRemoteURLContainsFold,omitempty"` + // avatar_local_file_id field predicates + AvatarLocalFileID *string `json:"avatarLocalFileID,omitempty"` + AvatarLocalFileIdneq *string `json:"avatarLocalFileIDNEQ,omitempty"` + AvatarLocalFileIDIn []string `json:"avatarLocalFileIDIn,omitempty"` + AvatarLocalFileIDNotIn []string `json:"avatarLocalFileIDNotIn,omitempty"` + AvatarLocalFileIdgt *string `json:"avatarLocalFileIDGT,omitempty"` + AvatarLocalFileIdgte *string `json:"avatarLocalFileIDGTE,omitempty"` + AvatarLocalFileIdlt *string `json:"avatarLocalFileIDLT,omitempty"` + AvatarLocalFileIdlte *string `json:"avatarLocalFileIDLTE,omitempty"` + AvatarLocalFileIDContains *string `json:"avatarLocalFileIDContains,omitempty"` + AvatarLocalFileIDHasPrefix *string `json:"avatarLocalFileIDHasPrefix,omitempty"` + AvatarLocalFileIDHasSuffix *string `json:"avatarLocalFileIDHasSuffix,omitempty"` + AvatarLocalFileIDIsNil *bool `json:"avatarLocalFileIDIsNil,omitempty"` + AvatarLocalFileIDNotNil *bool `json:"avatarLocalFileIDNotNil,omitempty"` + AvatarLocalFileIDEqualFold *string `json:"avatarLocalFileIDEqualFold,omitempty"` + AvatarLocalFileIDContainsFold *string `json:"avatarLocalFileIDContainsFold,omitempty"` + // avatar_updated_at field predicates + AvatarUpdatedAt *time.Time `json:"avatarUpdatedAt,omitempty"` + AvatarUpdatedAtNeq *time.Time `json:"avatarUpdatedAtNEQ,omitempty"` + AvatarUpdatedAtIn []*time.Time `json:"avatarUpdatedAtIn,omitempty"` + AvatarUpdatedAtNotIn []*time.Time `json:"avatarUpdatedAtNotIn,omitempty"` + AvatarUpdatedAtGt *time.Time `json:"avatarUpdatedAtGT,omitempty"` + AvatarUpdatedAtGte *time.Time `json:"avatarUpdatedAtGTE,omitempty"` + AvatarUpdatedAtLt *time.Time `json:"avatarUpdatedAtLT,omitempty"` + AvatarUpdatedAtLte *time.Time `json:"avatarUpdatedAtLTE,omitempty"` + AvatarUpdatedAtIsNil *bool `json:"avatarUpdatedAtIsNil,omitempty"` + AvatarUpdatedAtNotNil *bool `json:"avatarUpdatedAtNotNil,omitempty"` } // Ordering options for Organization connections @@ -12643,6 +12681,33 @@ type OrganizationWhereInput struct { AvatarRemoteURLNotNil *bool `json:"avatarRemoteURLNotNil,omitempty"` AvatarRemoteURLEqualFold *string `json:"avatarRemoteURLEqualFold,omitempty"` AvatarRemoteURLContainsFold *string `json:"avatarRemoteURLContainsFold,omitempty"` + // avatar_local_file_id field predicates + AvatarLocalFileID *string `json:"avatarLocalFileID,omitempty"` + AvatarLocalFileIdneq *string `json:"avatarLocalFileIDNEQ,omitempty"` + AvatarLocalFileIDIn []string `json:"avatarLocalFileIDIn,omitempty"` + AvatarLocalFileIDNotIn []string `json:"avatarLocalFileIDNotIn,omitempty"` + AvatarLocalFileIdgt *string `json:"avatarLocalFileIDGT,omitempty"` + AvatarLocalFileIdgte *string `json:"avatarLocalFileIDGTE,omitempty"` + AvatarLocalFileIdlt *string `json:"avatarLocalFileIDLT,omitempty"` + AvatarLocalFileIdlte *string `json:"avatarLocalFileIDLTE,omitempty"` + AvatarLocalFileIDContains *string `json:"avatarLocalFileIDContains,omitempty"` + AvatarLocalFileIDHasPrefix *string `json:"avatarLocalFileIDHasPrefix,omitempty"` + AvatarLocalFileIDHasSuffix *string `json:"avatarLocalFileIDHasSuffix,omitempty"` + AvatarLocalFileIDIsNil *bool `json:"avatarLocalFileIDIsNil,omitempty"` + AvatarLocalFileIDNotNil *bool `json:"avatarLocalFileIDNotNil,omitempty"` + AvatarLocalFileIDEqualFold *string `json:"avatarLocalFileIDEqualFold,omitempty"` + AvatarLocalFileIDContainsFold *string `json:"avatarLocalFileIDContainsFold,omitempty"` + // avatar_updated_at field predicates + AvatarUpdatedAt *time.Time `json:"avatarUpdatedAt,omitempty"` + AvatarUpdatedAtNeq *time.Time `json:"avatarUpdatedAtNEQ,omitempty"` + AvatarUpdatedAtIn []*time.Time `json:"avatarUpdatedAtIn,omitempty"` + AvatarUpdatedAtNotIn []*time.Time `json:"avatarUpdatedAtNotIn,omitempty"` + AvatarUpdatedAtGt *time.Time `json:"avatarUpdatedAtGT,omitempty"` + AvatarUpdatedAtGte *time.Time `json:"avatarUpdatedAtGTE,omitempty"` + AvatarUpdatedAtLt *time.Time `json:"avatarUpdatedAtLT,omitempty"` + AvatarUpdatedAtLte *time.Time `json:"avatarUpdatedAtLTE,omitempty"` + AvatarUpdatedAtIsNil *bool `json:"avatarUpdatedAtIsNil,omitempty"` + AvatarUpdatedAtNotNil *bool `json:"avatarUpdatedAtNotNil,omitempty"` // control_creators edge predicates HasControlCreators *bool `json:"hasControlCreators,omitempty"` HasControlCreatorsWith []*GroupWhereInput `json:"hasControlCreatorsWith,omitempty"` @@ -12718,6 +12783,9 @@ type OrganizationWhereInput struct { // files edge predicates HasFiles *bool `json:"hasFiles,omitempty"` HasFilesWith []*FileWhereInput `json:"hasFilesWith,omitempty"` + // avatar_file edge predicates + HasAvatarFile *bool `json:"hasAvatarFile,omitempty"` + HasAvatarFileWith []*FileWhereInput `json:"hasAvatarFileWith,omitempty"` // entities edge predicates HasEntities *bool `json:"hasEntities,omitempty"` HasEntitiesWith []*EntityWhereInput `json:"hasEntitiesWith,omitempty"` @@ -19155,8 +19223,11 @@ type UpdateOrganizationInput struct { Description *string `json:"description,omitempty"` ClearDescription *bool `json:"clearDescription,omitempty"` // URL of the user's remote avatar - AvatarRemoteURL *string `json:"avatarRemoteURL,omitempty"` - ClearAvatarRemoteURL *bool `json:"clearAvatarRemoteURL,omitempty"` + AvatarRemoteURL *string `json:"avatarRemoteURL,omitempty"` + ClearAvatarRemoteURL *bool `json:"clearAvatarRemoteURL,omitempty"` + // The time the user's (local) avatar was last updated + AvatarUpdatedAt *time.Time `json:"avatarUpdatedAt,omitempty"` + ClearAvatarUpdatedAt *bool `json:"clearAvatarUpdatedAt,omitempty"` AddControlCreatorIDs []string `json:"addControlCreatorIDs,omitempty"` RemoveControlCreatorIDs []string `json:"removeControlCreatorIDs,omitempty"` ClearControlCreators *bool `json:"clearControlCreators,omitempty"` @@ -19225,6 +19296,8 @@ type UpdateOrganizationInput struct { AddFileIDs []string `json:"addFileIDs,omitempty"` RemoveFileIDs []string `json:"removeFileIDs,omitempty"` ClearFiles *bool `json:"clearFiles,omitempty"` + AvatarFileID *string `json:"avatarFileID,omitempty"` + ClearAvatarFile *bool `json:"clearAvatarFile,omitempty"` AddEntityIDs []string `json:"addEntityIDs,omitempty"` RemoveEntityIDs []string `json:"removeEntityIDs,omitempty"` ClearEntities *bool `json:"clearEntities,omitempty"` @@ -19793,9 +19866,6 @@ type UpdateUserInput struct { // URL of the user's remote avatar AvatarRemoteURL *string `json:"avatarRemoteURL,omitempty"` ClearAvatarRemoteURL *bool `json:"clearAvatarRemoteURL,omitempty"` - // The user's local avatar file - AvatarLocalFile *string `json:"avatarLocalFile,omitempty"` - ClearAvatarLocalFile *bool `json:"clearAvatarLocalFile,omitempty"` // The time the user's (local) avatar was last updated AvatarUpdatedAt *time.Time `json:"avatarUpdatedAt,omitempty"` ClearAvatarUpdatedAt *bool `json:"clearAvatarUpdatedAt,omitempty"` @@ -19838,8 +19908,8 @@ type UpdateUserInput struct { AddFileIDs []string `json:"addFileIDs,omitempty"` RemoveFileIDs []string `json:"removeFileIDs,omitempty"` ClearFiles *bool `json:"clearFiles,omitempty"` - FileID *string `json:"fileID,omitempty"` - ClearFile *bool `json:"clearFile,omitempty"` + AvatarFileID *string `json:"avatarFileID,omitempty"` + ClearAvatarFile *bool `json:"clearAvatarFile,omitempty"` AddEventIDs []string `json:"addEventIDs,omitempty"` RemoveEventIDs []string `json:"removeEventIDs,omitempty"` ClearEvents *bool `json:"clearEvents,omitempty"` @@ -19911,9 +19981,7 @@ type User struct { DisplayName string `json:"displayName"` // URL of the user's remote avatar AvatarRemoteURL *string `json:"avatarRemoteURL,omitempty"` - // The user's local avatar file - AvatarLocalFile *string `json:"avatarLocalFile,omitempty"` - // The user's local avatar file id + // The user's local avatar file id, takes precedence over the avatar remote URL AvatarLocalFileID *string `json:"avatarLocalFileID,omitempty"` // The time the user's (local) avatar was last updated AvatarUpdatedAt *time.Time `json:"avatarUpdatedAt,omitempty"` @@ -19931,7 +19999,7 @@ type User struct { Groups []*Group `json:"groups,omitempty"` Organizations []*Organization `json:"organizations,omitempty"` Files []*File `json:"files,omitempty"` - File *File `json:"file,omitempty"` + AvatarFile *File `json:"avatarFile,omitempty"` Events []*Event `json:"events,omitempty"` ActionPlans []*ActionPlan `json:"actionPlans,omitempty"` Subcontrols []*Subcontrol `json:"subcontrols,omitempty"` @@ -20001,9 +20069,7 @@ type UserHistory struct { DisplayName string `json:"displayName"` // URL of the user's remote avatar AvatarRemoteURL *string `json:"avatarRemoteURL,omitempty"` - // The user's local avatar file - AvatarLocalFile *string `json:"avatarLocalFile,omitempty"` - // The user's local avatar file id + // The user's local avatar file id, takes precedence over the avatar remote URL AvatarLocalFileID *string `json:"avatarLocalFileID,omitempty"` // The time the user's (local) avatar was last updated AvatarUpdatedAt *time.Time `json:"avatarUpdatedAt,omitempty"` @@ -20249,22 +20315,6 @@ type UserHistoryWhereInput struct { AvatarRemoteURLNotNil *bool `json:"avatarRemoteURLNotNil,omitempty"` AvatarRemoteURLEqualFold *string `json:"avatarRemoteURLEqualFold,omitempty"` AvatarRemoteURLContainsFold *string `json:"avatarRemoteURLContainsFold,omitempty"` - // avatar_local_file field predicates - AvatarLocalFile *string `json:"avatarLocalFile,omitempty"` - AvatarLocalFileNeq *string `json:"avatarLocalFileNEQ,omitempty"` - AvatarLocalFileIn []string `json:"avatarLocalFileIn,omitempty"` - AvatarLocalFileNotIn []string `json:"avatarLocalFileNotIn,omitempty"` - AvatarLocalFileGt *string `json:"avatarLocalFileGT,omitempty"` - AvatarLocalFileGte *string `json:"avatarLocalFileGTE,omitempty"` - AvatarLocalFileLt *string `json:"avatarLocalFileLT,omitempty"` - AvatarLocalFileLte *string `json:"avatarLocalFileLTE,omitempty"` - AvatarLocalFileContains *string `json:"avatarLocalFileContains,omitempty"` - AvatarLocalFileHasPrefix *string `json:"avatarLocalFileHasPrefix,omitempty"` - AvatarLocalFileHasSuffix *string `json:"avatarLocalFileHasSuffix,omitempty"` - AvatarLocalFileIsNil *bool `json:"avatarLocalFileIsNil,omitempty"` - AvatarLocalFileNotNil *bool `json:"avatarLocalFileNotNil,omitempty"` - AvatarLocalFileEqualFold *string `json:"avatarLocalFileEqualFold,omitempty"` - AvatarLocalFileContainsFold *string `json:"avatarLocalFileContainsFold,omitempty"` // avatar_local_file_id field predicates AvatarLocalFileID *string `json:"avatarLocalFileID,omitempty"` AvatarLocalFileIdneq *string `json:"avatarLocalFileIDNEQ,omitempty"` @@ -21009,22 +21059,6 @@ type UserWhereInput struct { AvatarRemoteURLNotNil *bool `json:"avatarRemoteURLNotNil,omitempty"` AvatarRemoteURLEqualFold *string `json:"avatarRemoteURLEqualFold,omitempty"` AvatarRemoteURLContainsFold *string `json:"avatarRemoteURLContainsFold,omitempty"` - // avatar_local_file field predicates - AvatarLocalFile *string `json:"avatarLocalFile,omitempty"` - AvatarLocalFileNeq *string `json:"avatarLocalFileNEQ,omitempty"` - AvatarLocalFileIn []string `json:"avatarLocalFileIn,omitempty"` - AvatarLocalFileNotIn []string `json:"avatarLocalFileNotIn,omitempty"` - AvatarLocalFileGt *string `json:"avatarLocalFileGT,omitempty"` - AvatarLocalFileGte *string `json:"avatarLocalFileGTE,omitempty"` - AvatarLocalFileLt *string `json:"avatarLocalFileLT,omitempty"` - AvatarLocalFileLte *string `json:"avatarLocalFileLTE,omitempty"` - AvatarLocalFileContains *string `json:"avatarLocalFileContains,omitempty"` - AvatarLocalFileHasPrefix *string `json:"avatarLocalFileHasPrefix,omitempty"` - AvatarLocalFileHasSuffix *string `json:"avatarLocalFileHasSuffix,omitempty"` - AvatarLocalFileIsNil *bool `json:"avatarLocalFileIsNil,omitempty"` - AvatarLocalFileNotNil *bool `json:"avatarLocalFileNotNil,omitempty"` - AvatarLocalFileEqualFold *string `json:"avatarLocalFileEqualFold,omitempty"` - AvatarLocalFileContainsFold *string `json:"avatarLocalFileContainsFold,omitempty"` // avatar_local_file_id field predicates AvatarLocalFileID *string `json:"avatarLocalFileID,omitempty"` AvatarLocalFileIdneq *string `json:"avatarLocalFileIDNEQ,omitempty"` @@ -21109,9 +21143,9 @@ type UserWhereInput struct { // files edge predicates HasFiles *bool `json:"hasFiles,omitempty"` HasFilesWith []*FileWhereInput `json:"hasFilesWith,omitempty"` - // file edge predicates - HasFile *bool `json:"hasFile,omitempty"` - HasFileWith []*FileWhereInput `json:"hasFileWith,omitempty"` + // avatar_file edge predicates + HasAvatarFile *bool `json:"hasAvatarFile,omitempty"` + HasAvatarFileWith []*FileWhereInput `json:"hasAvatarFileWith,omitempty"` // events edge predicates HasEvents *bool `json:"hasEvents,omitempty"` HasEventsWith []*EventWhereInput `json:"hasEventsWith,omitempty"`