Schema for user-created post groups (Pinterest-style boards).
Users create groups/collections to organize their posts by theme, project, or topic. Groups are user-specific - each user has their own set of groups.
Fields
user_uuid- Owner of the groupname- Group name (e.g., "Travel Photos", "Work Projects")slug- URL-safe slug (e.g., "travel-photos")description- Optional group descriptioncover_image_uuid- Optional cover image (reference to file)post_count- Denormalized counter (updated via context)is_public- Whether group is visible to othersposition- Manual ordering of user's groups
Examples
# Public travel group
%PostGroup{
uuid: "018e3c4a-9f6b-7890-abcd-ef1234567890",
user_uuid: "018e3c4a-1234-5678-abcd-ef1234567890",
name: "Travel Adventures",
slug: "travel-adventures",
description: "My favorite travel moments",
cover_image_uuid: "018e3c4a-1234-5678-abcd-ef1234567890",
post_count: 23,
is_public: true,
position: 1
}
# Private work group
%PostGroup{
user_uuid: "018e3c4a-5678-1234-abcd-ef1234567890",
name: "Client Projects",
slug: "client-projects",
description: nil,
cover_image_uuid: nil,
post_count: 0,
is_public: false,
position: 2
}
Summary
Functions
Changeset for creating or updating a group.
Check if group is public.
Check if user owns the group.
Types
@type t() :: %PhoenixKit.Modules.Posts.PostGroup{ __meta__: term(), cover_image: PhoenixKit.Modules.Storage.File.t() | Ecto.Association.NotLoaded.t() | nil, cover_image_uuid: UUIDv7.t() | nil, description: String.t() | nil, inserted_at: DateTime.t() | nil, is_public: boolean(), name: String.t(), position: integer(), post_count: integer(), posts: [PhoenixKit.Modules.Posts.Post.t()] | Ecto.Association.NotLoaded.t(), slug: String.t(), updated_at: DateTime.t() | nil, user: PhoenixKit.Users.Auth.User.t() | Ecto.Association.NotLoaded.t(), user_uuid: UUIDv7.t() | nil, uuid: UUIDv7.t() | nil }
Functions
Changeset for creating or updating a group.
Required Fields
user_uuid- Owner of the groupname- Group nameslug- URL-safe slug (auto-generated from name if not provided)
Validation Rules
- Name must not be empty (max 100 chars)
- Slug must be unique per user
- Slug auto-generated from name if not provided
- Position must be >= 0
- Post count cannot be negative
Check if group is public.
Check if user owns the group.