Skip to contents

Creates a new artist record with all required database tables initialized. This function performs a transactional insert into both artist_index and artist_stats tables, ensuring data consistency.

Usage

add_artist(
  artist_name,
  pronouns = NULL,
  bio = NULL,
  email = NULL,
  phone = NULL,
  birthday = NULL,
  city = NULL,
  state = NULL,
  zipcode = NULL,
  url_ig = NULL,
  url_tiktok = NULL,
  url_x = NULL,
  url_youtube = NULL,
  url_reddit = NULL,
  url_site = NULL,
  avatar_url = NULL,
  is_verified = FALSE,
  cn = NULL,
  override_uuid = NULL,
  create_paths = FALSE,
  is_test = FALSE
)

Arguments

artist_name

Character. Full display name of the artist (required).

pronouns

Character. Artist's pronouns (e.g., "she/her", "they/them"). Default: NULL.

bio

Character. Artist biography text. Default: NULL.

email

Character. Contact email address. Default: NULL.

phone

Character. Contact phone number. Default: NULL.

birthday

Date or character. Artist's birthday. Default: NULL.

city

Character. City of residence. Default: NULL.

state

Character. State/province of residence. Default: NULL.

zipcode

Character. Postal/ZIP code. Default: NULL.

url_ig

Character. Instagram profile URL. Default: NULL.

url_tiktok

Character. TikTok profile URL. Default: NULL.

url_x

Character. X (Twitter) profile URL. Default: NULL.

url_youtube

Character. YouTube channel URL. Default: NULL.

url_reddit

Character. Reddit profile URL. Default: NULL.

url_site

Character. Personal website URL. Default: NULL.

avatar_url

Character. URL to artist avatar image. Default: NULL.

is_verified

Logical. Whether artist is verified. Default: FALSE.

cn

Database connection. If NULL, creates a connection via artcore::dbc() and closes it on exit. Pass an existing connection to batch multiple queries efficiently.

override_uuid

Character. Force a specific UUID instead of generating one. Used for testing or data migration. Default: NULL.

create_paths

Logical. Whether to create CDN directory structure. Default: FALSE.

is_test

Logical. If TRUE, generates a test UUID prefix. Default: FALSE.

Value

Character string containing the artist UUID.

Details

The function performs the following operations in a single transaction:

  1. Generates a unique artist UUID (or uses override_uuid if provided)

  2. Creates a URL-friendly slug from the artist name

  3. Optionally creates CDN directory structure for assets

  4. Inserts a record into app.artist_index with profile data

  5. Inserts a record into app.artist_stats with zeroed counters

CDN Directories

When create_paths = TRUE, the following directories are created:

  • art-public/thumbnails/{artist_uuid} - Public avatar/thumbnails

  • art-vault/uploads/{artist_uuid} - Private artwork uploads

  • art-data/processed/{artist_uuid} - Processed artwork data

TODO

Integrate with artist onboarding pipeline when ready (2024-12)

Examples

if (FALSE) { # \dontrun{
# Basic artist creation
artist <- add_artist(
  artist_name = "Jane Doe",
  email = "jane@example.com",
  bio = "Digital artist specializing in abstract landscapes"
)

# Full artist creation with CDN paths
artist <- add_artist(
  artist_name = "John Smith",
  pronouns = "he/him",
  bio = "Traditional oil painter",
  email = "john@example.com",
  city = "New York",
  state = "NY",
  url_ig = "https://instagram.com/johnsmith",
  url_site = "https://johnsmith.art",
  create_paths = TRUE
)

# Test artist with specific UUID
artist <- add_artist(
  artist_name = "Test Artist",
  override_uuid = "test-0000-0000-0000-000000000001",
  is_test = TRUE
)
} # }