Voile.Schema.Master (Voile v0.1.31)

Copy Markdown View Source

The Master context.

Summary

Functions

Returns an %Ecto.Changeset{} for tracking creator changes.

Returns an %Ecto.Changeset{} for tracking frequency changes.

Returns an %Ecto.Changeset{} for tracking locations changes.

Returns an %Ecto.Changeset{} for tracking member_type changes.

Returns an %Ecto.Changeset{} for tracking places changes.

Returns an %Ecto.Changeset{} for tracking publishers changes.

Returns an %Ecto.Changeset{} for tracking topic changes.

Creates a creator.

Creates a frequency.

Creates a locations.

Creates a member_type.

Creates a places.

Creates a publishers.

Creates a topic.

Deletes a creator.

Deletes a frequency.

Deletes a locations.

Deletes a member_type.

Deletes a places.

Deletes a publishers.

Deletes a topic.

Gets a single creator.

Gets a single frequency.

Gets a single locations.

Gets a single member_type.

Gets a single member_type by slug.

Gets or creates a creator by attributes (typically creator_name). Uses upsert with on_conflict to handle race conditions.

Gets a single places.

Gets a single publishers.

Gets a single topic.

Returns the list of locations with filtering options.

Returns the list of mst_creator.

Return the list of mst_creator with the given filter.

Return the list of mst_creator with pagination.

Returns the list of mst_frequency.

Returns the list of mst_frequency with pagination.

Returns the list of mst_locations.

Returns the list of mst_locations with pagination.

Returns the list of mst_member_types.

Returns the list of mst_places.

Returns the list of mst_places with pagination.

Returns the list of mst_publishers.

Returns the list of mst_publisher with pagination

Returns the list of mst_topics.

Returns the list of mst_topics with pagination.

Search creators by name using a case-insensitive partial match.

Search creators but return only minimal fields (id, creator_name, affiliation) to reduce data transfer.

Updates a creator.

Updates a frequency.

Updates a locations.

Updates a places.

Updates a publishers.

Updates a topic.

Functions

change_creator(creator, attrs \\ %{})

Returns an %Ecto.Changeset{} for tracking creator changes.

Examples

iex> change_creator(creator)
%Ecto.Changeset{data: %Creator{}}

change_frequency(frequency, attrs \\ %{})

Returns an %Ecto.Changeset{} for tracking frequency changes.

Examples

iex> change_frequency(frequency)
%Ecto.Changeset{data: %Frequency{}}

change_locations(location, attrs \\ %{})

Returns an %Ecto.Changeset{} for tracking locations changes.

Examples

iex> change_locations(locations)
%Ecto.Changeset{data: %Locations{}}

change_member_type(member_type, attrs \\ %{})

Returns an %Ecto.Changeset{} for tracking member_type changes.

Examples

iex> change_member_type(member_type)
%Ecto.Changeset{data: %MemberType{}}

change_places(places, attrs \\ %{})

Returns an %Ecto.Changeset{} for tracking places changes.

Examples

iex> change_places(places)
%Ecto.Changeset{data: %Places{}}

change_publishers(publishers, attrs \\ %{})

Returns an %Ecto.Changeset{} for tracking publishers changes.

Examples

iex> change_publishers(publishers)
%Ecto.Changeset{data: %Publishers{}}

change_topic(topic, attrs \\ %{})

Returns an %Ecto.Changeset{} for tracking topic changes.

Examples

iex> change_topic(topic)
%Ecto.Changeset{data: %Topic{}}

create_creator(attrs \\ %{})

Creates a creator.

Examples

iex> create_creator(%{creator_name: "John Doe"})
{:ok, %Creator{}}

create_frequency(attrs \\ %{})

Creates a frequency.

Examples

iex> create_frequency(%{field: value})
{:ok, %Frequency{}}

iex> create_frequency(%{field: bad_value})
{:error, %Ecto.Changeset{}}

create_locations(attrs \\ %{})

Creates a locations.

Examples

iex> create_locations(%{field: value})
{:ok, %Locations{}}

iex> create_locations(%{field: bad_value})
{:error, %Ecto.Changeset{}}

create_member_type(attrs \\ %{})

Creates a member_type.

Examples

iex> create_member_type(%{field: value})
{:ok, %MemberType{}}

iex> create_member_type(%{field: bad_value})
{:error, %Ecto.Changeset{}}

create_places(attrs \\ %{})

Creates a places.

Examples

iex> create_places(%{field: value})
{:ok, %Places{}}

iex> create_places(%{field: bad_value})
{:error, %Ecto.Changeset{}}

create_publishers(attrs \\ %{})

Creates a publishers.

Examples

iex> create_publishers(%{field: value})
{:ok, %Publishers{}}

iex> create_publishers(%{field: bad_value})
{:error, %Ecto.Changeset{}}

create_topic(attrs \\ %{})

Creates a topic.

Examples

iex> create_topic(%{field: value})
{:ok, %Topic{}}

iex> create_topic(%{field: bad_value})
{:error, %Ecto.Changeset{}}

delete_creator(creator)

Deletes a creator.

Examples

iex> delete_creator(creator)
{:ok, %Creator{}}

iex> delete_creator(creator)
{:error, %Ecto.Changeset{}}

delete_frequency(frequency)

Deletes a frequency.

Examples

iex> delete_frequency(frequency)
{:ok, %Frequency{}}

iex> delete_frequency(frequency)
{:error, %Ecto.Changeset{}}

delete_locations(location)

Deletes a locations.

Examples

iex> delete_locations(locations)
{:ok, %Locations{}}

iex> delete_locations(locations)
{:error, %Ecto.Changeset{}}

delete_member_type(member_type)

Deletes a member_type.

Examples

iex> delete_member_type(member_type)
{:ok, %MemberType{}}

iex> delete_member_type(member_type)
{:error, %Ecto.Changeset{}}

delete_places(places)

Deletes a places.

Examples

iex> delete_places(places)
{:ok, %Places{}}

iex> delete_places(places)
{:error, %Ecto.Changeset{}}

delete_publishers(publishers)

Deletes a publishers.

Examples

iex> delete_publishers(publishers)
{:ok, %Publishers{}}

iex> delete_publishers(publishers)
{:error, %Ecto.Changeset{}}

delete_topic(topic)

Deletes a topic.

Examples

iex> delete_topic(topic)
{:ok, %Topic{}}

iex> delete_topic(topic)
{:error, %Ecto.Changeset{}}

get_creator!(id)

Gets a single creator.

Raises Ecto.NoResultsError if the Creator does not exist.

Examples

iex> get_creator!(123)
%Creator{}

iex> get_creator!(456)
** (Ecto.NoResultsError)

get_frequency!(id)

Gets a single frequency.

Raises Ecto.NoResultsError if the Frequency does not exist.

Examples

iex> get_frequency!(123)
%Frequency{}

iex> get_frequency!(456)
** (Ecto.NoResultsError)

get_locations!(id)

Gets a single locations.

Raises Ecto.NoResultsError if the Locations does not exist.

Examples

iex> get_locations!(123)
%Locations{}

iex> get_locations!(456)
** (Ecto.NoResultsError)

get_member_type!(id)

Gets a single member_type.

Raises Ecto.NoResultsError if the Member type does not exist.

Examples

iex> get_member_type!(123)
%MemberType{}

iex> get_member_type!(456)
** (Ecto.NoResultsError)

get_member_type_by_slug(slug)

Gets a single member_type by slug.

Returns nil if the Member type does not exist.

Examples

iex> get_member_type_by_slug("verified_member")
%MemberType{}

iex> get_member_type_by_slug("nonexistent")
nil

get_or_create_creator(attrs \\ %{})

Gets or creates a creator by attributes (typically creator_name). Uses upsert with on_conflict to handle race conditions.

Examples

iex> get_or_create_creator(%{creator_name: "John Doe"})
{:ok, %Creator{}}

get_places!(id)

Gets a single places.

Raises Ecto.NoResultsError if the Places does not exist.

Examples

iex> get_places!(123)
%Places{}

iex> get_places!(456)
** (Ecto.NoResultsError)

get_publishers!(id)

Gets a single publishers.

Raises Ecto.NoResultsError if the Publishers does not exist.

Examples

iex> get_publishers!(123)
%Publishers{}

iex> get_publishers!(456)
** (Ecto.NoResultsError)

get_topic!(id)

Gets a single topic.

Raises Ecto.NoResultsError if the Topic does not exist.

Examples

iex> get_topic!(123)
%Topic{}

iex> get_topic!(456)
** (Ecto.NoResultsError)

list_locations(opts \\ [])

Returns the list of locations with filtering options.

Options

  • :node_id - Filter by node_id
  • :is_active - Filter by active status
  • :preload - List of associations to preload

Examples

iex> list_locations(node_id: 1)
[%Location{}, ...]

iex> list_locations(node_id: 1, is_active: true)
[%Location{}, ...]

list_mst_creator()

Returns the list of mst_creator.

Examples

iex> list_mst_creator()
[%Creator{}, ...]

list_mst_creator(filter)

Return the list of mst_creator with the given filter.

Examples

iex> list_mst_creator(%{field: value})
[%Creator{}, ...]

list_mst_creator_paginated(page \\ 1, per_page \\ 10)

Return the list of mst_creator with pagination.

list_mst_frequency()

Returns the list of mst_frequency.

Examples

iex> list_mst_frequency()
[%Frequency{}, ...]

list_mst_frequency_paginated(page \\ 1, per_page \\ 10)

Returns the list of mst_frequency with pagination.

Examples

iex> list_mst_frequency_paginated(1, 10)
{[%Frequency{}], 3}

list_mst_locations()

Returns the list of mst_locations.

Examples

iex> list_mst_locations()
[%Locations{}, ...]

list_mst_locations_paginated(page \\ 1, per_page \\ 10)

Returns the list of mst_locations with pagination.

list_mst_member_types()

Returns the list of mst_member_types.

Examples

iex> list_mst_member_types()
[%MemberType{}, ...]

list_mst_member_types_paginated(page \\ 1, per_page \\ 10)

list_mst_places()

Returns the list of mst_places.

Examples

iex> list_mst_places()
[%Places{}, ...]

list_mst_places_paginated(page \\ 1, per_page \\ 10)

Returns the list of mst_places with pagination.

list_mst_publishers()

Returns the list of mst_publishers.

Examples

iex> list_mst_publishers()
[%Publishers{}, ...]

list_mst_publishers_paginated(page \\ 1, per_page \\ 10)

Returns the list of mst_publisher with pagination

list_mst_topics()

Returns the list of mst_topics.

Examples

iex> list_mst_topics()
[%Topic{}, ...]

list_mst_topics_paginated(page \\ 1, per_page \\ 10)

Returns the list of mst_topics with pagination.

search_mst_creator(query, limit \\ 10)

Search creators by name using a case-insensitive partial match.

Returns a list limited by limit.

search_mst_creator_names(query, limit \\ 10, offset \\ 0)

Search creators but return only minimal fields (id, creator_name, affiliation) to reduce data transfer.

update_creator(creator, attrs)

Updates a creator.

Examples

iex> update_creator(creator, %{field: new_value})
{:ok, %Creator{}}

iex> update_creator(creator, %{field: bad_value})
{:error, %Ecto.Changeset{}}

update_frequency(frequency, attrs)

Updates a frequency.

Examples

iex> update_frequency(frequency, %{field: new_value})
{:ok, %Frequency{}}

iex> update_frequency(frequency, %{field: bad_value})
{:error, %Ecto.Changeset{}}

update_locations(location, attrs)

Updates a locations.

Examples

iex> update_locations(locations, %{field: new_value})
{:ok, %Locations{}}

iex> update_locations(locations, %{field: bad_value})
{:error, %Ecto.Changeset{}}

update_member_type(member_type, attrs)

Updates a member_type.

Examples

iex> update_member_type(member_type, %{field: new_value})
{:ok, %MemberType{}}

iex> update_member_type(member_type, %{field: bad_value})
{:error, %Ecto.Changeset{}}

update_places(places, attrs)

Updates a places.

Examples

iex> update_places(places, %{field: new_value})
{:ok, %Places{}}

iex> update_places(places, %{field: bad_value})
{:error, %Ecto.Changeset{}}

update_publishers(publishers, attrs)

Updates a publishers.

Examples

iex> update_publishers(publishers, %{field: new_value})
{:ok, %Publishers{}}

iex> update_publishers(publishers, %{field: bad_value})
{:error, %Ecto.Changeset{}}

update_topic(topic, attrs)

Updates a topic.

Examples

iex> update_topic(topic, %{field: new_value})
{:ok, %Topic{}}

iex> update_topic(topic, %{field: bad_value})
{:error, %Ecto.Changeset{}}