View Source Lightning.Projects.ProjectOauthClient (Lightning v2.10.4)

Manages the relationship between OAuth clients and projects, acting as a join table. This module defines the schema and validations needed for creating and managing associations between OauthClient and Project. It ensures that an OAuth client can be associated with a project, facilitating the management of access permissions and settings specific to a project.

Schema Information

The schema represents the bridge between projects and OAuth clients with the following fields:

  • :id: The unique identifier for the association, automatically generated.
  • :oauth_client_id: Foreign key to link with the OAuth client.
  • :project_id: Foreign key to link with the project.

This module also includes a virtual field :delete to mark an association for deletion, aiding in operations that require soft deletion patterns or special handling before actually removing an association.

Usage

The primary function of this module is to create and manage changesets for adding or removing OAuth clients from projects, ensuring data integrity and enforcing business rules such as uniqueness of the association.

Summary

Functions

Creates or updates changesets for a ProjectOauthClient entity based on the given attributes. Validates required fields and applies a unique constraint to ensure an OAuth client can be associated with a project only once.

Types

@type t() :: %Lightning.Projects.ProjectOauthClient{
  __meta__: Ecto.Schema.Metadata.t(),
  delete: term(),
  id: Ecto.UUID.t() | nil,
  inserted_at: term(),
  oauth_client:
    Lightning.Credentials.OauthClient.t() | Ecto.Association.NotLoaded.t() | nil,
  oauth_client_id: term(),
  project:
    Lightning.Projects.Project.t() | Ecto.Association.NotLoaded.t() | nil,
  project_id: term(),
  updated_at: term()
}

Functions

Link to this function

changeset(project_oauth_client, attrs)

View Source

Creates or updates changesets for a ProjectOauthClient entity based on the given attributes. Validates required fields and applies a unique constraint to ensure an OAuth client can be associated with a project only once.

This changeset is used for adding new or updating existing associations between an OAuth client and a project.