Skip to contents

[Experimental]

Creates or updates artist preference settings in the database. Uses PostgreSQL UPSERT (INSERT ... ON CONFLICT DO UPDATE) for atomic operation.

Usage

upsert_artist_preferences(
  artist,
  default_wip_collection_visibility = NULL,
  default_draft_artwork_visibility = NULL,
  extended_settings = NULL,
  cn = NULL
)

Arguments

artist

Character. Artist UUID (format: "746bxxxx-xxxx-xxxx-xxxxxxxxxxxx"). Validated with artcore::validate_uuid() where applicable.

default_wip_collection_visibility

Character. Default visibility for work-in-progress collections. Must be 'visible' or 'hidden'. Default: NULL.

default_draft_artwork_visibility

Character. Default visibility for draft artworks. Must be 'visible' or 'hidden'. Default: NULL.

extended_settings

List. Additional settings stored as JSONB. Default: NULL.

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.

Value

Logical. TRUE on success, FALSE on failure.

Details

This function manages settings in the settings.artist_preferences table. It performs an atomic upsert operation - inserting a new record if the artist doesn't have preferences, or updating existing preferences if they do.

Database Table

Operates on settings.artist_preferences with columns:

artist_uuid

Primary key, references app.artist_index

default_wip_collection_visibility

'visible' or 'hidden'

default_draft_artwork_visibility

'visible' or 'hidden'

extended_settings

JSONB for additional settings

updated_at

Timestamp of last update