MishkaBlog.Dev.Generator (Mishka Blog v0.0.1)

Copy Markdown View Source

Generator for MishkaBlog resources.

  • Test functions (no prefix): simple, deterministic — used by factory and tests.
  • Dev functions (dev_ prefix): realistic, rich data — used by dev seeds.

Summary

Functions

A realistic English blog post whose lifecycle fields agree with its status: published posts carry a published_at in the last 18 months, drafts carry neither date, and scheduled posts carry only a scheduled_publish_at 31-45 days out. :archived is deliberately absent from the status pool — that label is a separate axis from the archived_at soft delete and is written explicitly by the seeds, never drawn at random.

A realistic comment. Moderation status is weighted the way a live queue looks — mostly approved with a thin tail of pending, spam and flagged rows — and pinning stays rare so the pinned marker keeps its meaning.

A plausible browser user agent, used by the seeds when writing post-view rows.

Functions

auto_posting(opts \\ [], tenant \\ nil)

blog_post(opts \\ [], tenant \\ nil)

blogger(opts \\ [], tenant \\ nil)

blogger_follower(opts \\ [], actor \\ nil)

collection(opts \\ [], tenant \\ nil)

comment(opts \\ [], tenant \\ nil)

comment_vote(opts \\ [], actor \\ nil)

dev_auto_posting(opts \\ [], tenant \\ nil)

dev_blog_post(opts \\ [], tenant \\ nil)

A realistic English blog post whose lifecycle fields agree with its status: published posts carry a published_at in the last 18 months, drafts carry neither date, and scheduled posts carry only a scheduled_publish_at 31-45 days out. :archived is deliberately absent from the status pool — that label is a separate axis from the archived_at soft delete and is written explicitly by the seeds, never drawn at random.

A COVER IS PASSED IN, never invented here. This drew one from two hardcoded paths under /images/, which exist in the host application and in no other project, so the same generator wrote a working cover in one repository and a 404 in the next. The seeds hand over a path from the site's own media library — see MishkaBlog.Dev.Seeds — and nil is the common case a post list still has to look right without.

dev_blogger(opts \\ [], tenant \\ nil)

dev_collection(opts \\ [], tenant \\ nil)

dev_comment(opts \\ [], tenant \\ nil)

A realistic comment. Moderation status is weighted the way a live queue looks — mostly approved with a thin tail of pending, spam and flagged rows — and pinning stays rare so the pinned marker keeps its meaning.

dev_tag(opts \\ [], tenant \\ nil)

dev_team(opts \\ [], tenant \\ nil)

generate(generator)

See Ash.Generator.generate/1.

generate_many(generator, count)

See Ash.Generator.generate_many/2.

post_blogger(opts \\ [])

post_bookmark(opts \\ [], actor \\ nil)

post_collection(opts \\ [])

post_rating(opts \\ [], actor \\ nil)

post_tag(opts \\ [])

post_view(opts \\ [])

tag(opts \\ [], tenant \\ nil)

team(opts \\ [], tenant \\ nil)

team_follower(opts \\ [], actor \\ nil)

team_member(opts \\ [])

team_permission(opts \\ [])

user_agent()

A plausible browser user agent, used by the seeds when writing post-view rows.