diff --git a/AGENTS.md b/AGENTS.md index b6442ca..225f677 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -22,6 +22,7 @@ Packages: - `CmsQBitConfig`, `CmsFeature`, `CmsTables` (logical names and table definitions), `CmsRuntime`, `CmsSchemaCheck` (startup check), `CmsStartupMode`. - `core/model`: CORE entities. Their `TABLE_NAME` and possible-value source names are logical; the builder adds the prefix. +- `media/model`, `blog/model`, `projects/model`, `photos/model`: the content features' entities and their value-list enums (same rule). A value list is registered in `CmsTables.VALUE_LISTS` and named on the field by its logical name. - `metadata`: `CmsTableBuilder` (tables, possible values, joins, child lists, associations, permission rules), `CmsAppBuilder` and `CmsAreas` (apps and homes). - `home`: `CmsHomeRenderer` and `CmsHtml` (one renderer for every home; reads run with `PermissionEnforcement.ENFORCE`). - `security`: `CmsRole`, `CmsSecurity`, `CmsOpenReadsPermissionChecker`. diff --git a/CHANGELOG.md b/CHANGELOG.md index 77c5944..05348e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,17 @@ All notable changes to this project are documented here. The format follows Keep - The CMS app with one home per area (Sites, Pages, Navigation). The homes show only real data read as the user and are readable at any width. - Permissions: per-table rules, `CmsRole` bundles, `CmsSecurity.applySessionPermissions`, and `openReads`. - Startup schema check (`startupMode` `FAIL_FAST`, `DEGRADED`, `SKIP`). +- The content features `MEDIA`, `BLOG`, `PROJECTS` and `PHOTOS`, as standard QQQ tables with the kof22 fields: media and media types; blogs, blog types, authors, blog tags, blog posts, their tags, their media and related versions; project categories, projects and project updates; album folders, photo albums, photos, photo tags and their links. Each table has a possible-value source, child lists on its parents' records, associations (`blog.tags`, `blog_post.tags`, `blog_post.media`, `project.updates`, `photo_album.photos`, `photo.tags`), per-table permission rules and field audit when the host has QQQ audit tables. +- Four more areas in the CMS app, each with its own home: Media, Blogs, Projects and Photos. +- Value lists as possible-value sources named with the table prefix: `media_rendition_format`, `media_cache_class`, `content_channel`, `content_format`, `content_version_status` and `project_status`. +- File previews on the fields that hold an image's or a file's address, and help text on the media type settings (`CmsTableDefinition` `imagePreview`, `filePreview`, `help`). +- A field whose possible-value source is one of these value lists takes only the values of its list: `CmsValueListCheck` puts an error on a record that an insert or an edit gives another value (QQQ offers such a list in a form but accepts any value in a write), and the changelog guards the same columns with check constraints. +- The qbit ships its own help (`help/qbit-cms.yaml`, 643 entries): every app, home, table, section, field, child list and value list, written for the default names and registered by the producer when the host uses them (`HelpBundles.register`; a host with other prefixes writes its own). A host no longer writes help for CMS tables. `CmsHelpTest` holds it to the core's coverage gate and to every section. +- The homes set their text in `rem` (labels 0.875rem, never 13px), so it follows the reader's text size and a host's minimum. +- Features depend on each other without being welded together: a feature that is off produces nothing, and a field, a child list or a foreign key that links two features exists only when both are on. +- Not in this version: file upload, storage and renditions (a media record points at a file by its address, and the image address fields of content are plain fields), the publishing processes, the content stream, the Site API, and the lookup filter that limits a project's category to its own site. ### Schema changes - `1.0.0` baseline: a prefix-parameterized Liquibase changelog (`qbit-cms/db/changelog/qbit-cms.changelog.yaml`, logical path `qbit-cms/changelog`). It creates the CORE tables with the kof22 column types, adds their foreign keys and indexes, and seeds generic reference data. Feature sections are gated by `cms.features`, and a name collision halts the install. Reference DDL is in `docs/ddl/postgres.sql`. +- `1.0.0` content tables, appended to the same changelog: `1.0.0-create-` for the eighteen tables of `MEDIA`, `BLOG`, `PROJECTS` and `PHOTOS`, `1.0.0-constraints-` for each feature's foreign keys and indexes, `1.0.0-constraints-blog-projects` and `1.0.0-constraints-photos-projects` for the links between two features, and `1.0.0-seed-media_type` and `1.0.0-seed-blog_type` for generic reference data. Each is gated by `cms.features` and by the features it needs. `1.0.0-guard-existing-content-tables` halts the install when a table with one of these names already exists; it runs once, not on every run. +- **Changed, on purpose, in a released changeset:** `1.0.0-guard-existing-tables` no longer has `runAlways`. It rewrote its `DATABASECHANGELOG` row on every migration, so a second migration was never a no-op and a rollback by count began with it; a host whose migrations must be repeatable could not include this changelog and had to copy the tables instead. It now runs once, before the tables are created, and carries `validCheckSum: ANY` so an install that already ran it migrates on unchanged (`CmsInstallTest.testRerunIsNoop` covers both). A table that appears later under a qbit name still stops the install, at its `createTable`. Check constraints as in kof22: the value-list columns of `media_type`, `blog_post_version` and `project` (the project status check is new), `media_type.max_file_size_mb` above zero and the focal point of a project's image between 0 and 100. `project_category.section` is optional (kof22 requires it); latitude and longitude columns are `DOUBLE PRECISION` as in kof22. A host that already runs `CORE` gets the content tables at its next migration run unless its `cms.features` leaves them out. diff --git a/CLAUDE.md b/CLAUDE.md index cb26803..ef560f1 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -22,6 +22,7 @@ Packages: - `CmsQBitConfig`, `CmsFeature`, `CmsTables` (logical names and table definitions), `CmsRuntime`, `CmsSchemaCheck` (startup check), `CmsStartupMode`. - `core/model`: CORE entities. Their `TABLE_NAME` and possible-value source names are logical; the builder adds the prefix. +- `media/model`, `blog/model`, `projects/model`, `photos/model`: the content features' entities and their value-list enums (same rule). A value list is registered in `CmsTables.VALUE_LISTS` and named on the field by its logical name. - `metadata`: `CmsTableBuilder` (tables, possible values, joins, child lists, associations, permission rules), `CmsAppBuilder` and `CmsAreas` (apps and homes). - `home`: `CmsHomeRenderer` and `CmsHtml` (one renderer for every home; reads run with `PermissionEnforcement.ENFORCE`). - `security`: `CmsRole`, `CmsSecurity`, `CmsOpenReadsPermissionChecker`. diff --git a/README.md b/README.md index 309d5e7..eff3b7f 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ > QQQ QBit: a headless CMS (sites, pages, menus, blog, media, projects, photos and publishing) as standard QQQ tables. -**Status:** design approved in [QRun-IO/qqq#1083](https://github.com/QRun-IO/qqq/pull/1083) (see [docs/DESIGN.md](docs/DESIGN.md)). The CORE feature is implemented; MEDIA, BLOG, PROJECTS, PHOTOS, PUBLISHING and STREAM are next. Nothing is published yet. +**Status:** design approved in [QRun-IO/qqq#1083](https://github.com/QRun-IO/qqq/pull/1083) (see [docs/DESIGN.md](docs/DESIGN.md)). CORE, MEDIA, BLOG, PROJECTS and PHOTOS are implemented as tables with their admin screens. File upload, storage and renditions, the publishing processes, the content stream and the Site API are not built yet; PUBLISHING and STREAM are next. The CMS is extracted from the kof22 website, which runs it in production. Its data lives in ordinary QQQ tables in your own database, secured by QQQ permissions. It brings an admin app with one home per area, and a schema you run with your own Liquibase. @@ -24,11 +24,11 @@ The CMS is extracted from the kof22 website, which runs it in production. Its da ```yaml databaseChangeLog: - property: { name: cms.tablePrefix, value: cms_ } # must equal CmsQBitConfig.tableNamePrefix - - property: { name: cms.features, value: CORE } # the features you install + - property: { name: cms.features, value: "CORE,MEDIA,BLOG" } # the features you install (default: all) - include: { file: qbit-cms/db/changelog/qbit-cms.changelog.yaml } ``` - The changelog never touches a table it did not create. If a table with one of its names already exists, it halts with a message telling you to choose another prefix. It seeds only generic reference data (redirect, page and section types); set `cms.seedReferenceData` to `false` to skip that. + The changelog is safe to include in a migration that must be repeatable: a second run changes nothing, the migration history included. The changelog never touches a table it did not create. If a table with one of its names already exists, it halts with a message telling you to choose another prefix. It seeds only generic reference data (redirect, page, section, media and blog types); set `cms.seedReferenceData` to `false` to skip that. 3. **Produce the qbit** after your backends (and the parent app, if any) are on the instance: ```java @@ -65,9 +65,15 @@ A namespace (`withNamespace("siteTwo")`) fills in all three prefixes for a secon | Feature | Tables | Status | |---|---|---| | `CORE` | site, domain, redirect, redirect type, page, page type, page section, page section type, snippet, menu, menu item | available | -| `MEDIA` | media, media type, storage SPI (`qbit-object-storage` for S3) | next | -| `BLOG` | blog, blog type, post, tags, authors, post media, versions | next | -| `PROJECTS`, `PHOTOS`, `PUBLISHING`, `STREAM`, `DATA_HEALTH_RULES` | see the design | planned | +| `MEDIA` | media, media type | available: a media record points at a file by its address; upload, storage and renditions are not built yet | +| `BLOG` (needs `MEDIA`) | blog, blog type, author, blog tag, blog post, blog post tag, blog post media, related version | available | +| `PROJECTS` (needs `MEDIA`) | project category, project, project update | available | +| `PHOTOS` (needs `MEDIA`) | album folder, photo album, photo, photo tag, photo tag link | available | +| `PUBLISHING`, `STREAM`, `DATA_HEALTH_RULES` | see the design | planned | + +A feature that is off produces no tables, and its changesets are skipped until a later migration run names it in `cms.features`. Every content feature needs `CORE`, and blogs, projects and photos need `MEDIA`; a feature whose needs are not named installs nothing. What links two features (a related version of a project, a photo album of a project) keeps its column either way and gets its lookup, its list on the parent record and its foreign key only when both features are on. + +Fixed lists (rendition format, cache class, content channel, content format, version status, project status) are possible-value sources named with the table prefix, for example `cms_project_status`. A write with a value that is not on the list is refused with an error on the record, and the database has a check constraint on the same column. ## The admin @@ -76,9 +82,19 @@ The qbit adds one app (`CMS`) with a home, and one sub-app per area, each with i - **Sites:** sites (domains are a list on each site) and redirects; Settings has redirect types. - **Pages:** pages (sections and child pages are lists on each page) and snippets; Settings has page types and page section types. - **Navigation:** menus (items are a list on each menu). +- **Media:** the media library; Settings has media types (upload rules, renditions, required text, cache and storage settings). +- **Blogs:** blog posts (tags, media and related versions are lists on each post), blogs (their tags are a list on each blog) and authors; Settings has blog types. +- **Projects:** projects (updates, photo albums and related versions are lists on each project) and project categories. +- **Photos:** photo albums (photos are a list on each album), album folders and photo tags. + +Fields that hold an image's or a file's address show it as a preview (QQQ's file preview). The nav shows only main tables and reference data; child tables are edited on their parents' records. Each home shows only real data read as the current user: counts, drafts, inactive rows and recently changed records, readable at any width in light and dark mode. The qbit never sets the instance's home app. +## Help + +The qbit ships its own help for every app, home, table, section, field, child list and value list (`help/qbit-cms.yaml`). The producer registers it when you use the default names (`cms_`, `cms`); a host that has the QQQ help tables then shows it with nothing to write. With your own prefixes, write your own bundle from it. Bulk screens that QQQ generates per table are the host's, as for any table. + ## Permissions Every CMS table has QQQ permission rules. The table permissions are `
.read`, `.insert`, `.edit` and `.delete` (for example `cms_page.edit`). The qbit-wide permissions are `cms.admin` and `cms.publish`. diff --git a/docs/ddl/postgres.sql b/docs/ddl/postgres.sql index b88b71f..bfc8f18 100644 --- a/docs/ddl/postgres.sql +++ b/docs/ddl/postgres.sql @@ -4,6 +4,202 @@ +CREATE TABLE public.cms_author ( + id bigint NOT NULL, + name character varying(40) NOT NULL, + short_name character varying(20) NOT NULL, + description character varying(255), + slug character varying(40) NOT NULL, + email character varying(255), + profile_media_id bigint, + profile_image_url character varying(500), + website character varying(255), + social_links text, + is_active boolean, + display_order integer, + create_date timestamp without time zone NOT NULL, + modify_date timestamp without time zone NOT NULL +); + +ALTER TABLE public.cms_author ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.cms_author_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + +CREATE TABLE public.cms_blog ( + id bigint NOT NULL, + short_name character varying(20) NOT NULL, + name character varying(40) NOT NULL, + description character varying(255), + slug character varying(40) NOT NULL, + blog_type_id bigint NOT NULL, + meta_title character varying(255), + meta_description character varying(500), + meta_keywords character varying(255), + site_id bigint NOT NULL, + create_date timestamp without time zone NOT NULL, + modify_date timestamp without time zone NOT NULL +); + +ALTER TABLE public.cms_blog ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.cms_blog_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + +CREATE TABLE public.cms_blog_post ( + id bigint NOT NULL, + name character varying(40) NOT NULL, + short_name character varying(20) NOT NULL, + description character varying(255), + title character varying(100), + slug character varying(100) NOT NULL, + content text NOT NULL, + author_id bigint NOT NULL, + blog_id bigint NOT NULL, + is_published boolean, + publish_date timestamp without time zone, + featured_media_id bigint, + featured_image character varying(255), + meta_title character varying(255), + meta_description character varying(500), + meta_keywords character varying(255), + read_time integer, + view_count bigint, + is_featured boolean NOT NULL, + excerpt text, + create_date timestamp without time zone NOT NULL, + modify_date timestamp without time zone NOT NULL +); + +ALTER TABLE public.cms_blog_post ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.cms_blog_post_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + +CREATE TABLE public.cms_blog_post_media ( + id bigint NOT NULL, + blog_post_id bigint NOT NULL, + media_id bigint NOT NULL, + sort_order integer NOT NULL, + alt_text character varying(1000), + caption character varying(2000), + url character varying(1000) NOT NULL, + thumbnail_url character varying(1000), + width integer, + height integer, + create_date timestamp without time zone NOT NULL, + modify_date timestamp without time zone NOT NULL +); + +ALTER TABLE public.cms_blog_post_media ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.cms_blog_post_media_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + +CREATE TABLE public.cms_blog_post_tag_int ( + id bigint NOT NULL, + blog_post_id bigint NOT NULL, + blog_tag_id bigint NOT NULL, + create_date timestamp without time zone NOT NULL, + modify_date timestamp without time zone NOT NULL +); + +ALTER TABLE public.cms_blog_post_tag_int ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.cms_blog_post_tag_int_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + +CREATE TABLE public.cms_blog_post_version ( + id bigint NOT NULL, + blog_post_id bigint, + project_id bigint, + project_update_id bigint, + name character varying(100) NOT NULL, + variant_key character varying(100) NOT NULL, + channel character varying(40) NOT NULL, + title character varying(200), + content text NOT NULL, + content_format character varying(20) NOT NULL, + status character varying(20) NOT NULL, + source_digest character varying(64), + source_commit character varying(64), + published_url character varying(2000), + published_date timestamp without time zone, + create_date timestamp without time zone NOT NULL, + modify_date timestamp without time zone NOT NULL, + CONSTRAINT ck_cms_blog_post_version_channel CHECK (((channel)::text = ANY ((ARRAY['WEBSITE'::character varying, 'LINKEDIN'::character varying, 'MEDIUM'::character varying, 'FACEBOOK'::character varying, 'OTHER'::character varying])::text[]))), + CONSTRAINT ck_cms_blog_post_version_content_format CHECK (((content_format)::text = ANY ((ARRAY['MARKDOWN'::character varying, 'PLAIN_TEXT'::character varying])::text[]))), + CONSTRAINT ck_cms_blog_post_version_status CHECK (((status)::text = ANY ((ARRAY['DRAFT'::character varying, 'READY'::character varying, 'PUBLISHED'::character varying, 'ARCHIVED'::character varying])::text[]))) +); + +ALTER TABLE public.cms_blog_post_version ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.cms_blog_post_version_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + +CREATE TABLE public.cms_blog_tag ( + id bigint NOT NULL, + name character varying(40) NOT NULL, + slug character varying(40) NOT NULL, + description character varying(255), + blog_id bigint NOT NULL, + create_date timestamp without time zone NOT NULL, + modify_date timestamp without time zone NOT NULL +); + +ALTER TABLE public.cms_blog_tag ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.cms_blog_tag_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + +CREATE TABLE public.cms_blog_type ( + id bigint NOT NULL, + name character varying(100) NOT NULL, + code character varying(50) NOT NULL, + description character varying(255), + is_active boolean NOT NULL, + sort_order integer NOT NULL, + create_date timestamp without time zone NOT NULL, + modify_date timestamp without time zone NOT NULL +); + +ALTER TABLE public.cms_blog_type ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.cms_blog_type_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + CREATE TABLE public.cms_domain ( id bigint NOT NULL, name character varying(40) NOT NULL, @@ -25,6 +221,91 @@ ALTER TABLE public.cms_domain ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTI CACHE 1 ); +CREATE TABLE public.cms_media ( + id bigint NOT NULL, + name character varying(200) NOT NULL, + slug character varying(100), + description character varying(500), + alt_text character varying(1000), + caption character varying(2000), + credit character varying(500), + license character varying(500), + media_type_id bigint NOT NULL, + file_name character varying(255), + file_extension character varying(20), + mime_type character varying(100), + file_size bigint, + width integer, + height integer, + duration integer, + checksum character varying(64), + is_active boolean NOT NULL, + public_url character varying(500), + storage_key character varying(500), + thumbnail_url character varying(500), + gallery_url character varying(500), + slideshow_url character varying(500), + site_id bigint NOT NULL, + create_date timestamp without time zone NOT NULL, + modify_date timestamp without time zone NOT NULL +); + +ALTER TABLE public.cms_media ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.cms_media_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + +CREATE TABLE public.cms_media_type ( + id bigint NOT NULL, + name character varying(100) NOT NULL, + code character varying(50) NOT NULL, + description character varying(500), + is_active boolean NOT NULL, + sort_order integer NOT NULL, + allowed_mime_types character varying(1000), + allowed_extensions character varying(500), + max_file_size_mb integer, + thumbnail_enabled boolean NOT NULL, + thumbnail_width integer, + thumbnail_format character varying(10) NOT NULL, + thumbnail_quality integer, + gallery_enabled boolean NOT NULL, + gallery_width integer, + gallery_format character varying(10) NOT NULL, + gallery_quality integer, + slideshow_enabled boolean NOT NULL, + slideshow_width integer, + slideshow_format character varying(10) NOT NULL, + slideshow_quality integer, + strip_metadata boolean NOT NULL, + require_alt_text boolean NOT NULL, + require_caption boolean NOT NULL, + default_credit character varying(500), + default_license character varying(500), + cache_class character varying(20) NOT NULL, + storage_prefix character varying(100) NOT NULL, + create_date timestamp without time zone NOT NULL, + modify_date timestamp without time zone NOT NULL, + CONSTRAINT ck_cms_media_type_cache_class CHECK (((cache_class)::text = ANY ((ARRAY['IMMUTABLE'::character varying, 'MUTABLE'::character varying])::text[]))), + CONSTRAINT ck_cms_media_type_gallery_format CHECK (((gallery_format)::text = ANY ((ARRAY['JPEG'::character varying, 'PNG'::character varying, 'WEBP'::character varying])::text[]))), + CONSTRAINT ck_cms_media_type_max_file_size_mb CHECK (((max_file_size_mb IS NULL) OR (max_file_size_mb > 0))), + CONSTRAINT ck_cms_media_type_slideshow_format CHECK (((slideshow_format)::text = ANY ((ARRAY['JPEG'::character varying, 'PNG'::character varying, 'WEBP'::character varying])::text[]))), + CONSTRAINT ck_cms_media_type_thumbnail_format CHECK (((thumbnail_format)::text = ANY ((ARRAY['JPEG'::character varying, 'PNG'::character varying, 'WEBP'::character varying])::text[]))) +); + +ALTER TABLE public.cms_media_type ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.cms_media_type_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + CREATE TABLE public.cms_menu ( id bigint NOT NULL, name character varying(100) NOT NULL, @@ -164,6 +445,246 @@ ALTER TABLE public.cms_page_type ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDE CACHE 1 ); +CREATE TABLE public.cms_photo ( + id bigint NOT NULL, + photo_album_id bigint NOT NULL, + media_id bigint, + title character varying(200) NOT NULL, + slug character varying(100) NOT NULL, + caption character varying(500), + description character varying(1000), + score integer, + is_favorite boolean NOT NULL, + is_album_cover boolean NOT NULL, + sort_order integer NOT NULL, + is_published boolean NOT NULL, + publish_date timestamp without time zone, + original_url character varying(500), + gallery_url character varying(500), + slideshow_url character varying(500), + thumbnail_url character varying(500), + original_filename character varying(255), + storage_key character varying(500), + mime_type character varying(100), + file_size bigint, + width integer, + height integer, + exif_date_taken timestamp without time zone, + exif_camera_make character varying(100), + exif_camera_model character varying(100), + exif_lens_model character varying(200), + exif_focal_length character varying(20), + exif_aperture character varying(20), + exif_shutter_speed character varying(20), + exif_iso integer, + exif_white_balance character varying(50), + exif_flash character varying(50), + exif_gps_latitude double precision, + exif_gps_longitude double precision, + create_date timestamp without time zone NOT NULL, + modify_date timestamp without time zone NOT NULL +); + +CREATE TABLE public.cms_photo_album ( + id bigint NOT NULL, + site_id bigint NOT NULL, + photo_album_folder_id bigint, + project_id bigint, + project_update_id bigint, + name character varying(100) NOT NULL, + short_name character varying(40) NOT NULL, + slug character varying(100) NOT NULL, + title character varying(200), + description character varying(1000), + cover_photo_id bigint, + cover_image_url character varying(500), + is_published boolean NOT NULL, + publish_date timestamp without time zone, + sort_order integer NOT NULL, + location character varying(200), + location_latitude double precision, + location_longitude double precision, + album_date timestamp without time zone, + album_end_date timestamp without time zone, + primary_camera character varying(100), + primary_lens character varying(100), + weather character varying(100), + meta_title character varying(255), + meta_description character varying(500), + create_date timestamp without time zone NOT NULL, + modify_date timestamp without time zone NOT NULL +); + +CREATE TABLE public.cms_photo_album_folder ( + id bigint NOT NULL, + site_id bigint NOT NULL, + parent_id bigint, + name character varying(100) NOT NULL, + slug character varying(100) NOT NULL, + description character varying(500), + folder_image_url character varying(500), + is_published boolean NOT NULL, + sort_order integer NOT NULL, + meta_title character varying(255), + meta_description character varying(500), + create_date timestamp without time zone NOT NULL, + modify_date timestamp without time zone NOT NULL +); + +ALTER TABLE public.cms_photo_album_folder ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.cms_photo_album_folder_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + +ALTER TABLE public.cms_photo_album ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.cms_photo_album_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + +ALTER TABLE public.cms_photo ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.cms_photo_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + +CREATE TABLE public.cms_photo_tag ( + id bigint NOT NULL, + name character varying(100) NOT NULL, + slug character varying(100) NOT NULL, + description character varying(255), + create_date timestamp without time zone NOT NULL, + modify_date timestamp without time zone NOT NULL +); + +ALTER TABLE public.cms_photo_tag ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.cms_photo_tag_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + +CREATE TABLE public.cms_photo_tag_int ( + id bigint NOT NULL, + photo_id bigint NOT NULL, + photo_tag_id bigint NOT NULL, + create_date timestamp without time zone NOT NULL, + modify_date timestamp without time zone NOT NULL +); + +ALTER TABLE public.cms_photo_tag_int ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.cms_photo_tag_int_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + +CREATE TABLE public.cms_project ( + id bigint NOT NULL, + name character varying(100) NOT NULL, + short_name character varying(20) NOT NULL, + slug character varying(100) NOT NULL, + title character varying(200) NOT NULL, + description text, + content text, + project_status character varying(20) NOT NULL, + github_url character varying(255), + live_url character varying(255), + featured_media_id bigint, + featured_image character varying(255), + image_alt character varying(500), + image_caption character varying(1000), + image_focal_x integer, + image_focal_y integer, + start_date timestamp without time zone, + end_date timestamp without time zone, + is_featured boolean NOT NULL, + sort_order integer NOT NULL, + site_id bigint NOT NULL, + category_id bigint NOT NULL, + is_published boolean NOT NULL, + publish_date timestamp without time zone, + create_date timestamp without time zone NOT NULL, + modify_date timestamp without time zone NOT NULL, + CONSTRAINT ck_cms_project_image_focal_x CHECK (((image_focal_x >= 0) AND (image_focal_x <= 100))), + CONSTRAINT ck_cms_project_image_focal_y CHECK (((image_focal_y >= 0) AND (image_focal_y <= 100))), + CONSTRAINT ck_cms_project_project_status CHECK (((project_status)::text = ANY ((ARRAY['PLANNED'::character varying, 'IN_PROGRESS'::character varying, 'ACTIVE'::character varying, 'ARCHIVED'::character varying])::text[]))) +); + +CREATE TABLE public.cms_project_category ( + id bigint NOT NULL, + site_id bigint NOT NULL, + name character varying(100) NOT NULL, + title character varying(200) NOT NULL, + slug character varying(100) NOT NULL, + section character varying(20), + description character varying(1000), + featured_media_id bigint, + featured_image character varying(500), + sort_order integer NOT NULL, + is_published boolean NOT NULL, + create_date timestamp without time zone NOT NULL, + modify_date timestamp without time zone NOT NULL +); + +ALTER TABLE public.cms_project_category ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.cms_project_category_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + +ALTER TABLE public.cms_project ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.cms_project_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + +CREATE TABLE public.cms_project_update ( + id bigint NOT NULL, + project_id bigint NOT NULL, + slug character varying(100) NOT NULL, + title character varying(200) NOT NULL, + excerpt character varying(1000), + content text NOT NULL, + update_date timestamp without time zone NOT NULL, + is_published boolean NOT NULL, + publish_date timestamp without time zone, + sort_order integer NOT NULL, + featured_media_id bigint, + featured_image character varying(500), + create_date timestamp without time zone NOT NULL, + modify_date timestamp without time zone NOT NULL +); + +ALTER TABLE public.cms_project_update ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( + SEQUENCE NAME public.cms_project_update_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1 +); + CREATE TABLE public.cms_redirect ( id bigint NOT NULL, name character varying(100) NOT NULL, @@ -253,9 +774,39 @@ ALTER TABLE public.cms_snippet ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENT CACHE 1 ); +ALTER TABLE ONLY public.cms_author + ADD CONSTRAINT pk_cms_author PRIMARY KEY (id); + +ALTER TABLE ONLY public.cms_blog + ADD CONSTRAINT pk_cms_blog PRIMARY KEY (id); + +ALTER TABLE ONLY public.cms_blog_post + ADD CONSTRAINT pk_cms_blog_post PRIMARY KEY (id); + +ALTER TABLE ONLY public.cms_blog_post_media + ADD CONSTRAINT pk_cms_blog_post_media PRIMARY KEY (id); + +ALTER TABLE ONLY public.cms_blog_post_tag_int + ADD CONSTRAINT pk_cms_blog_post_tag_int PRIMARY KEY (id); + +ALTER TABLE ONLY public.cms_blog_post_version + ADD CONSTRAINT pk_cms_blog_post_version PRIMARY KEY (id); + +ALTER TABLE ONLY public.cms_blog_tag + ADD CONSTRAINT pk_cms_blog_tag PRIMARY KEY (id); + +ALTER TABLE ONLY public.cms_blog_type + ADD CONSTRAINT pk_cms_blog_type PRIMARY KEY (id); + ALTER TABLE ONLY public.cms_domain ADD CONSTRAINT pk_cms_domain PRIMARY KEY (id); +ALTER TABLE ONLY public.cms_media + ADD CONSTRAINT pk_cms_media PRIMARY KEY (id); + +ALTER TABLE ONLY public.cms_media_type + ADD CONSTRAINT pk_cms_media_type PRIMARY KEY (id); + ALTER TABLE ONLY public.cms_menu ADD CONSTRAINT pk_cms_menu PRIMARY KEY (id); @@ -274,6 +825,30 @@ ALTER TABLE ONLY public.cms_page_section_type ALTER TABLE ONLY public.cms_page_type ADD CONSTRAINT pk_cms_page_type PRIMARY KEY (id); +ALTER TABLE ONLY public.cms_photo + ADD CONSTRAINT pk_cms_photo PRIMARY KEY (id); + +ALTER TABLE ONLY public.cms_photo_album + ADD CONSTRAINT pk_cms_photo_album PRIMARY KEY (id); + +ALTER TABLE ONLY public.cms_photo_album_folder + ADD CONSTRAINT pk_cms_photo_album_folder PRIMARY KEY (id); + +ALTER TABLE ONLY public.cms_photo_tag + ADD CONSTRAINT pk_cms_photo_tag PRIMARY KEY (id); + +ALTER TABLE ONLY public.cms_photo_tag_int + ADD CONSTRAINT pk_cms_photo_tag_int PRIMARY KEY (id); + +ALTER TABLE ONLY public.cms_project + ADD CONSTRAINT pk_cms_project PRIMARY KEY (id); + +ALTER TABLE ONLY public.cms_project_category + ADD CONSTRAINT pk_cms_project_category PRIMARY KEY (id); + +ALTER TABLE ONLY public.cms_project_update + ADD CONSTRAINT pk_cms_project_update PRIMARY KEY (id); + ALTER TABLE ONLY public.cms_redirect ADD CONSTRAINT pk_cms_redirect PRIMARY KEY (id); @@ -286,6 +861,57 @@ ALTER TABLE ONLY public.cms_site ALTER TABLE ONLY public.cms_snippet ADD CONSTRAINT pk_cms_snippet PRIMARY KEY (id); +ALTER TABLE ONLY public.cms_author + ADD CONSTRAINT uq_cms_author_name UNIQUE (name); + +ALTER TABLE ONLY public.cms_author + ADD CONSTRAINT uq_cms_author_slug UNIQUE (slug); + +ALTER TABLE ONLY public.cms_blog + ADD CONSTRAINT uq_cms_blog_name UNIQUE (name); + +ALTER TABLE ONLY public.cms_blog_post_media + ADD CONSTRAINT uq_cms_blog_post_media_blog_post_id_media_id UNIQUE (blog_post_id, media_id); + +ALTER TABLE ONLY public.cms_blog_post + ADD CONSTRAINT uq_cms_blog_post_name_blog_id UNIQUE (name, blog_id); + +ALTER TABLE ONLY public.cms_blog_post + ADD CONSTRAINT uq_cms_blog_post_short_name_blog_id UNIQUE (short_name, blog_id); + +ALTER TABLE ONLY public.cms_blog_post + ADD CONSTRAINT uq_cms_blog_post_slug_blog_id UNIQUE (slug, blog_id); + +ALTER TABLE ONLY public.cms_blog_post_tag_int + ADD CONSTRAINT uq_cms_blog_post_tag_int_blog_post_id_blog_tag_id UNIQUE (blog_post_id, blog_tag_id); + +ALTER TABLE ONLY public.cms_blog_post_version + ADD CONSTRAINT uq_cms_blog_post_version_blog_post_id_variant_key UNIQUE (blog_post_id, variant_key); + +ALTER TABLE ONLY public.cms_blog_post_version + ADD CONSTRAINT uq_cms_blog_post_version_project_id_variant_key UNIQUE (project_id, variant_key); + +ALTER TABLE ONLY public.cms_blog_post_version + ADD CONSTRAINT uq_cms_blog_post_version_project_update_id_variant_key UNIQUE (project_update_id, variant_key); + +ALTER TABLE ONLY public.cms_blog + ADD CONSTRAINT uq_cms_blog_short_name UNIQUE (short_name); + +ALTER TABLE ONLY public.cms_blog + ADD CONSTRAINT uq_cms_blog_slug_site_id UNIQUE (slug, site_id); + +ALTER TABLE ONLY public.cms_blog_tag + ADD CONSTRAINT uq_cms_blog_tag_name_blog_id UNIQUE (name, blog_id); + +ALTER TABLE ONLY public.cms_blog_tag + ADD CONSTRAINT uq_cms_blog_tag_slug_blog_id UNIQUE (slug, blog_id); + +ALTER TABLE ONLY public.cms_blog_type + ADD CONSTRAINT uq_cms_blog_type_code UNIQUE (code); + +ALTER TABLE ONLY public.cms_blog_type + ADD CONSTRAINT uq_cms_blog_type_name UNIQUE (name); + ALTER TABLE ONLY public.cms_domain ADD CONSTRAINT uq_cms_domain_fqdn UNIQUE (fqdn); @@ -295,6 +921,9 @@ ALTER TABLE ONLY public.cms_domain ALTER TABLE ONLY public.cms_domain ADD CONSTRAINT uq_cms_domain_short_name UNIQUE (short_name); +ALTER TABLE ONLY public.cms_media_type + ADD CONSTRAINT uq_cms_media_type_code UNIQUE (code); + ALTER TABLE ONLY public.cms_menu ADD CONSTRAINT uq_cms_menu_slug_site_id UNIQUE (slug, site_id); @@ -316,6 +945,36 @@ ALTER TABLE ONLY public.cms_page_type ALTER TABLE ONLY public.cms_page_type ADD CONSTRAINT uq_cms_page_type_name UNIQUE (name); +ALTER TABLE ONLY public.cms_photo_album_folder + ADD CONSTRAINT uq_cms_photo_album_folder_slug_site_id UNIQUE (slug, site_id); + +ALTER TABLE ONLY public.cms_photo_album + ADD CONSTRAINT uq_cms_photo_album_short_name_site_id UNIQUE (short_name, site_id); + +ALTER TABLE ONLY public.cms_photo_album + ADD CONSTRAINT uq_cms_photo_album_slug_site_id UNIQUE (slug, site_id); + +ALTER TABLE ONLY public.cms_photo + ADD CONSTRAINT uq_cms_photo_slug_photo_album_id UNIQUE (slug, photo_album_id); + +ALTER TABLE ONLY public.cms_photo_tag_int + ADD CONSTRAINT uq_cms_photo_tag_int_photo_id_photo_tag_id UNIQUE (photo_id, photo_tag_id); + +ALTER TABLE ONLY public.cms_photo_tag + ADD CONSTRAINT uq_cms_photo_tag_name UNIQUE (name); + +ALTER TABLE ONLY public.cms_photo_tag + ADD CONSTRAINT uq_cms_photo_tag_slug UNIQUE (slug); + +ALTER TABLE ONLY public.cms_project_category + ADD CONSTRAINT uq_cms_project_category_slug_site_id UNIQUE (slug, site_id); + +ALTER TABLE ONLY public.cms_project + ADD CONSTRAINT uq_cms_project_slug_site_id UNIQUE (slug, site_id); + +ALTER TABLE ONLY public.cms_project_update + ADD CONSTRAINT uq_cms_project_update_slug_project_id UNIQUE (slug, project_id); + ALTER TABLE ONLY public.cms_redirect_type ADD CONSTRAINT uq_cms_redirect_type_code UNIQUE (code); @@ -325,17 +984,97 @@ ALTER TABLE ONLY public.cms_site ALTER TABLE ONLY public.cms_snippet ADD CONSTRAINT uq_cms_snippet_short_name_site_id UNIQUE (short_name, site_id); +CREATE INDEX idx_cms_blog_post_author_id ON public.cms_blog_post USING btree (author_id); + +CREATE INDEX idx_cms_blog_post_blog_id_is_published ON public.cms_blog_post USING btree (blog_id, is_published); + +CREATE INDEX idx_cms_blog_post_media_blog_post_id_sort_order ON public.cms_blog_post_media USING btree (blog_post_id, sort_order); + +CREATE INDEX idx_cms_blog_post_tag_int_blog_tag_id ON public.cms_blog_post_tag_int USING btree (blog_tag_id); + +CREATE INDEX idx_cms_blog_post_version_blog_post_id_channel ON public.cms_blog_post_version USING btree (blog_post_id, channel); + +CREATE INDEX idx_cms_media_media_type_id ON public.cms_media USING btree (media_type_id); + +CREATE INDEX idx_cms_media_site_id_name ON public.cms_media USING btree (site_id, name); + CREATE INDEX idx_cms_menu_item_menu_id ON public.cms_menu_item USING btree (menu_id); CREATE INDEX idx_cms_page_section_page_id ON public.cms_page_section USING btree (page_id); CREATE INDEX idx_cms_page_site_id_is_published ON public.cms_page USING btree (site_id, is_published); +CREATE INDEX idx_cms_photo_album_folder_parent_id ON public.cms_photo_album_folder USING btree (parent_id); + +CREATE INDEX idx_cms_photo_album_is_published ON public.cms_photo_album USING btree (is_published); + +CREATE INDEX idx_cms_photo_album_photo_album_folder_id ON public.cms_photo_album USING btree (photo_album_folder_id); + +CREATE INDEX idx_cms_photo_album_project_id ON public.cms_photo_album USING btree (project_id); + +CREATE INDEX idx_cms_photo_album_project_update_id ON public.cms_photo_album USING btree (project_update_id); + +CREATE INDEX idx_cms_photo_photo_album_id_sort_order ON public.cms_photo USING btree (photo_album_id, sort_order); + +CREATE INDEX idx_cms_photo_tag_int_photo_tag_id ON public.cms_photo_tag_int USING btree (photo_tag_id); + +CREATE INDEX idx_cms_project_category_id_is_published_sort_order ON public.cms_project USING btree (category_id, is_published, sort_order); + +CREATE INDEX idx_cms_project_update_project_id_is_published_update_date ON public.cms_project_update USING btree (project_id, is_published, update_date); + CREATE INDEX idx_cms_redirect_site_id_source_path ON public.cms_redirect USING btree (site_id, source_path); +ALTER TABLE ONLY public.cms_author + ADD CONSTRAINT fk_cms_author_profile_media_id FOREIGN KEY (profile_media_id) REFERENCES public.cms_media(id); + +ALTER TABLE ONLY public.cms_blog + ADD CONSTRAINT fk_cms_blog_blog_type_id FOREIGN KEY (blog_type_id) REFERENCES public.cms_blog_type(id); + +ALTER TABLE ONLY public.cms_blog_post + ADD CONSTRAINT fk_cms_blog_post_author_id FOREIGN KEY (author_id) REFERENCES public.cms_author(id); + +ALTER TABLE ONLY public.cms_blog_post + ADD CONSTRAINT fk_cms_blog_post_blog_id FOREIGN KEY (blog_id) REFERENCES public.cms_blog(id); + +ALTER TABLE ONLY public.cms_blog_post + ADD CONSTRAINT fk_cms_blog_post_featured_media_id FOREIGN KEY (featured_media_id) REFERENCES public.cms_media(id); + +ALTER TABLE ONLY public.cms_blog_post_media + ADD CONSTRAINT fk_cms_blog_post_media_blog_post_id FOREIGN KEY (blog_post_id) REFERENCES public.cms_blog_post(id); + +ALTER TABLE ONLY public.cms_blog_post_media + ADD CONSTRAINT fk_cms_blog_post_media_media_id FOREIGN KEY (media_id) REFERENCES public.cms_media(id); + +ALTER TABLE ONLY public.cms_blog_post_tag_int + ADD CONSTRAINT fk_cms_blog_post_tag_int_blog_post_id FOREIGN KEY (blog_post_id) REFERENCES public.cms_blog_post(id); + +ALTER TABLE ONLY public.cms_blog_post_tag_int + ADD CONSTRAINT fk_cms_blog_post_tag_int_blog_tag_id FOREIGN KEY (blog_tag_id) REFERENCES public.cms_blog_tag(id); + +ALTER TABLE ONLY public.cms_blog_post_version + ADD CONSTRAINT fk_cms_blog_post_version_blog_post_id FOREIGN KEY (blog_post_id) REFERENCES public.cms_blog_post(id); + +ALTER TABLE ONLY public.cms_blog_post_version + ADD CONSTRAINT fk_cms_blog_post_version_project_id FOREIGN KEY (project_id) REFERENCES public.cms_project(id); + +ALTER TABLE ONLY public.cms_blog_post_version + ADD CONSTRAINT fk_cms_blog_post_version_project_update_id FOREIGN KEY (project_update_id) REFERENCES public.cms_project_update(id); + +ALTER TABLE ONLY public.cms_blog + ADD CONSTRAINT fk_cms_blog_site_id FOREIGN KEY (site_id) REFERENCES public.cms_site(id); + +ALTER TABLE ONLY public.cms_blog_tag + ADD CONSTRAINT fk_cms_blog_tag_blog_id FOREIGN KEY (blog_id) REFERENCES public.cms_blog(id); + ALTER TABLE ONLY public.cms_domain ADD CONSTRAINT fk_cms_domain_site_id FOREIGN KEY (site_id) REFERENCES public.cms_site(id); +ALTER TABLE ONLY public.cms_media + ADD CONSTRAINT fk_cms_media_media_type_id FOREIGN KEY (media_type_id) REFERENCES public.cms_media_type(id); + +ALTER TABLE ONLY public.cms_media + ADD CONSTRAINT fk_cms_media_site_id FOREIGN KEY (site_id) REFERENCES public.cms_site(id); + ALTER TABLE ONLY public.cms_menu_item ADD CONSTRAINT fk_cms_menu_item_menu_id FOREIGN KEY (menu_id) REFERENCES public.cms_menu(id); @@ -360,6 +1099,60 @@ ALTER TABLE ONLY public.cms_page_section ALTER TABLE ONLY public.cms_page ADD CONSTRAINT fk_cms_page_site_id FOREIGN KEY (site_id) REFERENCES public.cms_site(id); +ALTER TABLE ONLY public.cms_photo_album + ADD CONSTRAINT fk_cms_photo_album_cover_photo_id FOREIGN KEY (cover_photo_id) REFERENCES public.cms_photo(id); + +ALTER TABLE ONLY public.cms_photo_album_folder + ADD CONSTRAINT fk_cms_photo_album_folder_parent_id FOREIGN KEY (parent_id) REFERENCES public.cms_photo_album_folder(id); + +ALTER TABLE ONLY public.cms_photo_album_folder + ADD CONSTRAINT fk_cms_photo_album_folder_site_id FOREIGN KEY (site_id) REFERENCES public.cms_site(id); + +ALTER TABLE ONLY public.cms_photo_album + ADD CONSTRAINT fk_cms_photo_album_photo_album_folder_id FOREIGN KEY (photo_album_folder_id) REFERENCES public.cms_photo_album_folder(id); + +ALTER TABLE ONLY public.cms_photo_album + ADD CONSTRAINT fk_cms_photo_album_project_id FOREIGN KEY (project_id) REFERENCES public.cms_project(id); + +ALTER TABLE ONLY public.cms_photo_album + ADD CONSTRAINT fk_cms_photo_album_project_update_id FOREIGN KEY (project_update_id) REFERENCES public.cms_project_update(id); + +ALTER TABLE ONLY public.cms_photo_album + ADD CONSTRAINT fk_cms_photo_album_site_id FOREIGN KEY (site_id) REFERENCES public.cms_site(id); + +ALTER TABLE ONLY public.cms_photo + ADD CONSTRAINT fk_cms_photo_media_id FOREIGN KEY (media_id) REFERENCES public.cms_media(id); + +ALTER TABLE ONLY public.cms_photo + ADD CONSTRAINT fk_cms_photo_photo_album_id FOREIGN KEY (photo_album_id) REFERENCES public.cms_photo_album(id); + +ALTER TABLE ONLY public.cms_photo_tag_int + ADD CONSTRAINT fk_cms_photo_tag_int_photo_id FOREIGN KEY (photo_id) REFERENCES public.cms_photo(id); + +ALTER TABLE ONLY public.cms_photo_tag_int + ADD CONSTRAINT fk_cms_photo_tag_int_photo_tag_id FOREIGN KEY (photo_tag_id) REFERENCES public.cms_photo_tag(id); + +ALTER TABLE ONLY public.cms_project_category + ADD CONSTRAINT fk_cms_project_category_featured_media_id FOREIGN KEY (featured_media_id) REFERENCES public.cms_media(id); + +ALTER TABLE ONLY public.cms_project + ADD CONSTRAINT fk_cms_project_category_id FOREIGN KEY (category_id) REFERENCES public.cms_project_category(id); + +ALTER TABLE ONLY public.cms_project_category + ADD CONSTRAINT fk_cms_project_category_site_id FOREIGN KEY (site_id) REFERENCES public.cms_site(id); + +ALTER TABLE ONLY public.cms_project + ADD CONSTRAINT fk_cms_project_featured_media_id FOREIGN KEY (featured_media_id) REFERENCES public.cms_media(id); + +ALTER TABLE ONLY public.cms_project + ADD CONSTRAINT fk_cms_project_site_id FOREIGN KEY (site_id) REFERENCES public.cms_site(id); + +ALTER TABLE ONLY public.cms_project_update + ADD CONSTRAINT fk_cms_project_update_featured_media_id FOREIGN KEY (featured_media_id) REFERENCES public.cms_media(id); + +ALTER TABLE ONLY public.cms_project_update + ADD CONSTRAINT fk_cms_project_update_project_id FOREIGN KEY (project_id) REFERENCES public.cms_project(id); + ALTER TABLE ONLY public.cms_redirect ADD CONSTRAINT fk_cms_redirect_redirect_type_id FOREIGN KEY (redirect_type_id) REFERENCES public.cms_redirect_type(id); @@ -368,5 +1161,3 @@ ALTER TABLE ONLY public.cms_redirect ALTER TABLE ONLY public.cms_snippet ADD CONSTRAINT fk_cms_snippet_site_id FOREIGN KEY (site_id) REFERENCES public.cms_site(id); - - diff --git a/src/main/java/com/kingsrook/qbits/cms/CmsFeature.java b/src/main/java/com/kingsrook/qbits/cms/CmsFeature.java index 8313d2b..804d2b4 100644 --- a/src/main/java/com/kingsrook/qbits/cms/CmsFeature.java +++ b/src/main/java/com/kingsrook/qbits/cms/CmsFeature.java @@ -38,17 +38,17 @@ public enum CmsFeature /** Sites, domains, redirects, pages, page sections, snippets, menus. */ CORE(true), - /** The media library, media types and the storage SPI. */ - MEDIA(false), + /** The media library and media types: a media record points at a file by its address (no upload yet). */ + MEDIA(true), - /** Blogs, posts, tags, authors, post media and versions. */ - BLOG(false, MEDIA), + /** Blogs, posts, tags, authors, post media and related versions. */ + BLOG(true, MEDIA), /** Projects, project categories and project updates. */ - PROJECTS(false, MEDIA), + PROJECTS(true, MEDIA), /** Photo albums, folders, photos and photo tags. */ - PHOTOS(false, MEDIA), + PHOTOS(true, MEDIA), /** Publishing processes, publications and receipts. */ PUBLISHING(false), diff --git a/src/main/java/com/kingsrook/qbits/cms/CmsQBitProducer.java b/src/main/java/com/kingsrook/qbits/cms/CmsQBitProducer.java index afbf80a..30bf4af 100644 --- a/src/main/java/com/kingsrook/qbits/cms/CmsQBitProducer.java +++ b/src/main/java/com/kingsrook/qbits/cms/CmsQBitProducer.java @@ -27,6 +27,7 @@ import com.kingsrook.qqq.backend.core.logging.QLogger; import com.kingsrook.qqq.backend.core.model.metadata.MetaDataProducerMultiOutput; import com.kingsrook.qqq.backend.core.model.metadata.QInstance; import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaData; +import com.kingsrook.qqq.backend.core.model.metadata.help.bundles.HelpBundles; import com.kingsrook.qqq.backend.core.model.metadata.joins.QJoinMetaData; import com.kingsrook.qqq.backend.core.model.metadata.layout.QAppMetaData; import com.kingsrook.qqq.backend.core.model.metadata.possiblevalues.QPossibleValueSource; @@ -66,6 +67,9 @@ public class CmsQBitProducer implements QBitMetaDataProducer public static final String ARTIFACT_ID = "qbit-cms"; public static final String VERSION = "0.1.0"; + /** The qbit's own help: every app, home, table, section, field, child list and value list, under the default names. */ + public static final String HELP_BUNDLE = "help/qbit-cms.yaml"; + private CmsQBitConfig qBitConfig; private String namespace; @@ -189,6 +193,16 @@ public class CmsQBitProducer implements QBitMetaDataProducer } output.addSelfToInstance(qInstance); + ///////////////////////////////////////////////////////////////////////// + // the help is written for the default names; with them it is registered // + // (metadata only: a host without help tables is not affected, and a // + // host with its own prefixes writes its own) // + ///////////////////////////////////////////////////////////////////////// + if(CmsQBitConfig.DEFAULT_TABLE_NAME_PREFIX.equals(qBitConfig.getTableNamePrefix()) && CmsQBitConfig.DEFAULT_NAME_PREFIX.equals(qBitConfig.getNamePrefix())) + { + HelpBundles.register(qInstance, HELP_BUNDLE); + } + if(StringUtils.hasContent(qBitConfig.getParentAppName())) { qInstance.getApp(qBitConfig.getParentAppName()).withChild(qInstance.getApp(qBitConfig.getEffectiveAppName())); diff --git a/src/main/java/com/kingsrook/qbits/cms/CmsTables.java b/src/main/java/com/kingsrook/qbits/cms/CmsTables.java index 29004ae..9a709a9 100644 --- a/src/main/java/com/kingsrook/qbits/cms/CmsTables.java +++ b/src/main/java/com/kingsrook/qbits/cms/CmsTables.java @@ -18,7 +18,19 @@ package com.kingsrook.qbits.cms; import java.util.List; +import java.util.Map; import java.util.Optional; +import com.kingsrook.qbits.cms.blog.model.CmsAuthor; +import com.kingsrook.qbits.cms.blog.model.CmsBlog; +import com.kingsrook.qbits.cms.blog.model.CmsBlogPost; +import com.kingsrook.qbits.cms.blog.model.CmsBlogPostMedia; +import com.kingsrook.qbits.cms.blog.model.CmsBlogPostTag; +import com.kingsrook.qbits.cms.blog.model.CmsBlogPostVersion; +import com.kingsrook.qbits.cms.blog.model.CmsBlogTag; +import com.kingsrook.qbits.cms.blog.model.CmsBlogType; +import com.kingsrook.qbits.cms.blog.model.CmsContentChannel; +import com.kingsrook.qbits.cms.blog.model.CmsContentFormat; +import com.kingsrook.qbits.cms.blog.model.CmsContentVersionStatus; import com.kingsrook.qbits.cms.core.model.CmsDomain; import com.kingsrook.qbits.cms.core.model.CmsMenu; import com.kingsrook.qbits.cms.core.model.CmsMenuItem; @@ -30,8 +42,22 @@ import com.kingsrook.qbits.cms.core.model.CmsRedirect; import com.kingsrook.qbits.cms.core.model.CmsRedirectType; import com.kingsrook.qbits.cms.core.model.CmsSite; import com.kingsrook.qbits.cms.core.model.CmsSnippet; +import com.kingsrook.qbits.cms.media.model.CmsMedia; +import com.kingsrook.qbits.cms.media.model.CmsMediaCacheClass; +import com.kingsrook.qbits.cms.media.model.CmsMediaRenditionFormat; +import com.kingsrook.qbits.cms.media.model.CmsMediaType; import com.kingsrook.qbits.cms.metadata.CmsTableDefinition; import com.kingsrook.qbits.cms.metadata.CmsTableDefinition.Kind; +import com.kingsrook.qbits.cms.photos.model.CmsPhoto; +import com.kingsrook.qbits.cms.photos.model.CmsPhotoAlbum; +import com.kingsrook.qbits.cms.photos.model.CmsPhotoAlbumFolder; +import com.kingsrook.qbits.cms.photos.model.CmsPhotoTag; +import com.kingsrook.qbits.cms.photos.model.CmsPhotoTagLink; +import com.kingsrook.qbits.cms.projects.model.CmsProject; +import com.kingsrook.qbits.cms.projects.model.CmsProjectCategory; +import com.kingsrook.qbits.cms.projects.model.CmsProjectStatus; +import com.kingsrook.qbits.cms.projects.model.CmsProjectUpdate; +import com.kingsrook.qqq.backend.core.model.metadata.possiblevalues.PossibleValueEnum; import com.kingsrook.qqq.backend.core.model.metadata.tables.Tier; @@ -43,17 +69,36 @@ import com.kingsrook.qqq.backend.core.model.metadata.tables.Tier; *******************************************************************************/ public final class CmsTables { - public static final String SITE = CmsSite.TABLE_NAME; - public static final String DOMAIN = CmsDomain.TABLE_NAME; - public static final String REDIRECT = CmsRedirect.TABLE_NAME; - public static final String REDIRECT_TYPE = CmsRedirectType.TABLE_NAME; - public static final String PAGE = CmsPage.TABLE_NAME; - public static final String PAGE_TYPE = CmsPageType.TABLE_NAME; - public static final String PAGE_SECTION = CmsPageSection.TABLE_NAME; - public static final String PAGE_SECTION_TYPE = CmsPageSectionType.TABLE_NAME; - public static final String SNIPPET = CmsSnippet.TABLE_NAME; - public static final String MENU = CmsMenu.TABLE_NAME; - public static final String MENU_ITEM = CmsMenuItem.TABLE_NAME; + public static final String SITE = CmsSite.TABLE_NAME; + public static final String DOMAIN = CmsDomain.TABLE_NAME; + public static final String REDIRECT = CmsRedirect.TABLE_NAME; + public static final String REDIRECT_TYPE = CmsRedirectType.TABLE_NAME; + public static final String PAGE = CmsPage.TABLE_NAME; + public static final String PAGE_TYPE = CmsPageType.TABLE_NAME; + public static final String PAGE_SECTION = CmsPageSection.TABLE_NAME; + public static final String PAGE_SECTION_TYPE = CmsPageSectionType.TABLE_NAME; + public static final String SNIPPET = CmsSnippet.TABLE_NAME; + public static final String MENU = CmsMenu.TABLE_NAME; + public static final String MENU_ITEM = CmsMenuItem.TABLE_NAME; + + public static final String MEDIA_TYPE = CmsMediaType.TABLE_NAME; + public static final String MEDIA = CmsMedia.TABLE_NAME; + public static final String BLOG_TYPE = CmsBlogType.TABLE_NAME; + public static final String BLOG = CmsBlog.TABLE_NAME; + public static final String AUTHOR = CmsAuthor.TABLE_NAME; + public static final String BLOG_TAG = CmsBlogTag.TABLE_NAME; + public static final String BLOG_POST = CmsBlogPost.TABLE_NAME; + public static final String BLOG_POST_TAG_INT = CmsBlogPostTag.TABLE_NAME; + public static final String BLOG_POST_MEDIA = CmsBlogPostMedia.TABLE_NAME; + public static final String BLOG_POST_VERSION = CmsBlogPostVersion.TABLE_NAME; + public static final String PROJECT_CATEGORY = CmsProjectCategory.TABLE_NAME; + public static final String PROJECT = CmsProject.TABLE_NAME; + public static final String PROJECT_UPDATE = CmsProjectUpdate.TABLE_NAME; + public static final String PHOTO_ALBUM_FOLDER = CmsPhotoAlbumFolder.TABLE_NAME; + public static final String PHOTO_ALBUM = CmsPhotoAlbum.TABLE_NAME; + public static final String PHOTO = CmsPhoto.TABLE_NAME; + public static final String PHOTO_TAG = CmsPhotoTag.TABLE_NAME; + public static final String PHOTO_TAG_INT = CmsPhotoTagLink.TABLE_NAME; private static final List DEFINITIONS = List.of( CmsTableDefinition.builder(SITE, CmsSite.class, CmsFeature.CORE, "Site", "language", Kind.MAIN) @@ -116,8 +161,180 @@ public final class CmsTables .section("target", "Link", "open_in_new", Tier.T2, "linkUrl", "routePath", "target") .section("display", "Display", "palette", Tier.T2, "icon", "cssClasses", "description") .child(MENU_ITEM, "parentId", "Child Items", null, "displayOrder") + .build(), + CmsTableDefinition.builder(MEDIA_TYPE, CmsMediaType.class, CmsFeature.MEDIA, "Media Type", "perm_media", Kind.REFERENCE) + .section("mediaType", "Media Type", "perm_media", Tier.T1, "id", "name", "code", "description", "isActive", "sortOrder") + .section("uploadRules", "Upload Rules", "rule", Tier.T2, "allowedMimeTypes", "allowedExtensions", "maxFileSizeMb") + .section("renditions", "Renditions", "photo_size_select_large", Tier.T2, "thumbnailEnabled", "thumbnailWidth", "thumbnailFormat", "thumbnailQuality", "galleryEnabled", "galleryWidth", "galleryFormat", "galleryQuality", "slideshowEnabled", "slideshowWidth", "slideshowFormat", "slideshowQuality") + .section("privacy", "Privacy and Required Fields", "privacy_tip", Tier.T2, "stripMetadata", "requireAltText", "requireCaption", "defaultCredit", "defaultLicense") + .section("cacheStorage", "Cache and Storage", "cached", Tier.T2, "cacheClass", "storagePrefix") + .child(MEDIA, "mediaTypeId", "Media", null, "name") + .unique("code") + .help("allowedMimeTypes", "Comma-separated, e.g. image/jpeg, image/png or image/*. Blank allows any type.") + .help("allowedExtensions", "Comma-separated, without dots, e.g. jpg, png. Blank allows any extension.") + .help("maxFileSizeMb", "Largest accepted upload, in megabytes. Blank sets no limit of its own.") + .help("thumbnailWidth", "Maximum width in pixels. Blank keeps the built-in width.") + .help("galleryWidth", "Maximum width in pixels. Blank keeps the built-in width.") + .help("slideshowWidth", "Maximum width in pixels. Blank keeps the built-in width.") + .help("thumbnailQuality", "JPEG or WebP quality from 1 to 100. Blank means 85.") + .help("galleryQuality", "JPEG or WebP quality from 1 to 100. Blank means 85.") + .help("slideshowQuality", "JPEG or WebP quality from 1 to 100. Blank means 85.") + .help("stripMetadata", "Removes EXIF, GPS, XMP and IPTC data from uploaded images; orientation is applied to the pixels first.") + .help("cacheClass", "How long browsers and CDNs may keep files of this type.") + .help("storagePrefix", "The storage folder for new uploads, e.g. media.") + .build(), + CmsTableDefinition.builder(MEDIA, CmsMedia.class, CmsFeature.MEDIA, "Media", "perm_media", Kind.MAIN) + .section("media", "Media", "perm_media", Tier.T1, "id", "name", "publicUrl", "slug", "description", "mediaTypeId", "siteId", "isActive") + .section("textAndCredit", "Text and Credit", "subtitles", Tier.T2, "altText", "caption", "credit", "license") + .section("renditions", "Renditions", "photo_size_select_large", Tier.T2, "thumbnailUrl", "galleryUrl", "slideshowUrl") + .section("file", "File", "insert_drive_file", Tier.T2, "fileName", "fileExtension", "mimeType", "fileSize", "width", "height", "duration", "checksum", "storageKey") + .filePreview("publicUrl", "thumbnailUrl", "fileName", "altText", "caption") + .build(), + CmsTableDefinition.builder(BLOG_TYPE, CmsBlogType.class, CmsFeature.BLOG, "Blog Type", "rss_feed", Kind.REFERENCE) + .section("blogType", "Blog Type", "rss_feed", Tier.T1, "id", "name", "code", "isActive", "sortOrder", "description") + .unique("name").unique("code") + .build(), + CmsTableDefinition.builder(BLOG, CmsBlog.class, CmsFeature.BLOG, "Blog", "article_person", Kind.MAIN) + .recordLabel("name") + .section("blog", "Blog", "article_person", Tier.T1, "id", "name", "shortName", "slug", "blogTypeId", "siteId", "description") + .section("seo", "SEO", "travel_explore", Tier.T2, "metaTitle", "metaDescription", "metaKeywords") + .child(BLOG_POST, "blogId", "Posts", null, "title") + .child(BLOG_TAG, "blogId", "Tags", "tags", "name") + .unique("name").unique("slug", "siteId").unique("shortName") + .build(), + CmsTableDefinition.builder(AUTHOR, CmsAuthor.class, CmsFeature.BLOG, "Author", "person", Kind.MAIN) + .section("author", "Author", "person", Tier.T1, "id", "name", "shortName", "slug", "isActive", "description") + .section("links", "Links", "link", Tier.T2, "website", "email", "socialLinks") + .section("profile", "Profile", "account_circle", Tier.T2, "displayOrder", "profileMediaId", "profileImageUrl") + .child(BLOG_POST, "authorId", "Posts", null, "title") + .unique("name").unique("slug") + .text("socialLinks") + .imagePreview("profileImageUrl", "name", null) + .build(), + CmsTableDefinition.builder(BLOG_TAG, CmsBlogTag.class, CmsFeature.BLOG, "Blog Tag", "local_offer", Kind.CHILD) + .section("tag", "Tag", "local_offer", Tier.T1, "id", "name", "slug", "blogId", "description") + .child(BLOG_POST_TAG_INT, "blogTagId", "Posts", null, "id") + .unique("name", "blogId").unique("slug", "blogId") + .build(), + CmsTableDefinition.builder(BLOG_POST, CmsBlogPost.class, CmsFeature.BLOG, "Blog Post", "article", Kind.MAIN) + .recordLabel("title") + .section("blogPost", "Blog Post", "article", Tier.T1, "id", "title", "name", "shortName", "slug", "blogId", "authorId", "isPublished", "publishDate") + .section("content", "Content", "notes", Tier.T2, "content", "excerpt", "description", "readTime") + .section("featured", "Featured Image", "image", Tier.T2, "featuredMediaId", "featuredImage", "isFeatured") + .section("seo", "SEO", "travel_explore", Tier.T2, "metaTitle", "metaDescription", "metaKeywords") + .section("usage", "Usage", "query_stats", Tier.T2, "viewCount") + .child(BLOG_POST_TAG_INT, "blogPostId", "Tags", "tags", "id") + .child(BLOG_POST_MEDIA, "blogPostId", "Media", "media", "sortOrder") + .child(BLOG_POST_VERSION, "blogPostId", "Related Versions", null, "name") + .unique("name", "blogId").unique("shortName", "blogId").unique("slug", "blogId") + .text("content", "excerpt") + .imagePreview("featuredImage", "title", null) + .build(), + CmsTableDefinition.builder(BLOG_POST_TAG_INT, CmsBlogPostTag.class, CmsFeature.BLOG, "Blog Post Tag", "label", Kind.CHILD) + .recordLabel("id") + .section("blogPostTag", "Blog Post Tag", "label", Tier.T1, "id", "blogPostId", "blogTagId") + .unique("blogPostId", "blogTagId") + .build(), + CmsTableDefinition.builder(BLOG_POST_MEDIA, CmsBlogPostMedia.class, CmsFeature.BLOG, "Blog Post Media", "photo_library", Kind.CHILD) + .recordLabel("url") + .section("blogPostMedia", "Blog Post Media", "photo_library", Tier.T1, "id", "blogPostId", "mediaId", "sortOrder", "url", "thumbnailUrl") + .section("text", "Text", "subtitles", Tier.T2, "altText", "caption") + .section("size", "Size", "aspect_ratio", Tier.T2, "width", "height") + .unique("blogPostId", "mediaId") + .imagePreview("url", "altText", "caption") + .build(), + CmsTableDefinition.builder(BLOG_POST_VERSION, CmsBlogPostVersion.class, CmsFeature.BLOG, "Related Version", "content_copy", Kind.CHILD) + .section("version", "Version", "content_copy", Tier.T1, "id", "name", "variantKey", "channel", "status", "blogPostId", "projectId", "projectUpdateId") + .section("content", "Content", "notes", Tier.T2, "title", "contentFormat", "content") + .section("publication", "External Publication", "public", Tier.T2, "publishedUrl", "publishedDate") + .section("source", "Source", "history", Tier.T2, "sourceDigest", "sourceCommit") + .unique("blogPostId", "variantKey").unique("projectId", "variantKey").unique("projectUpdateId", "variantKey") + .text("content") + .build(), + CmsTableDefinition.builder(PROJECT_CATEGORY, CmsProjectCategory.class, CmsFeature.PROJECTS, "Project Category", "category", Kind.MAIN) + .recordLabel("title") + .section("projectCategory", "Project Category", "category", Tier.T1, "id", "title", "name", "slug", "siteId", "section", "sortOrder", "isPublished", "description") + .section("featured", "Featured Image", "image", Tier.T2, "featuredMediaId", "featuredImage") + .child(PROJECT, "categoryId", "Projects", null, "sortOrder") + .unique("slug", "siteId") + .imagePreview("featuredImage", "title", null) + .help("section", "A grouping code the site chooses for its categories, for example a site area. Optional.") + .build(), + CmsTableDefinition.builder(PROJECT, CmsProject.class, CmsFeature.PROJECTS, "Project", "code", Kind.MAIN) + .recordLabel("title") + .section("project", "Project", "code", Tier.T1, "id", "title", "name", "shortName", "slug", "siteId", "categoryId", "projectStatus", "isPublished", "publishDate", "isFeatured", "sortOrder") + .section("content", "Content", "notes", Tier.T2, "description", "content") + .section("links", "Links", "link", Tier.T2, "githubUrl", "liveUrl") + .section("featured", "Featured Image", "image", Tier.T2, "featuredMediaId", "featuredImage", "imageAlt", "imageCaption", "imageFocalX", "imageFocalY") + .section("projectDates", "Project Dates", "schedule", Tier.T2, "startDate", "endDate") + .child(PROJECT_UPDATE, "projectId", "Updates", "updates", "updateDate") + .child(PHOTO_ALBUM, "projectId", "Photo Albums", null, "sortOrder") + .child(BLOG_POST_VERSION, "projectId", "Related Versions", null, "name") + .unique("slug", "siteId") + .text("description", "content") + .imagePreview("featuredImage", "imageAlt", "imageCaption") + .build(), + CmsTableDefinition.builder(PROJECT_UPDATE, CmsProjectUpdate.class, CmsFeature.PROJECTS, "Project Update", "history", Kind.CHILD) + .recordLabel("title") + .section("projectUpdate", "Project Update", "history", Tier.T1, "id", "title", "slug", "projectId", "updateDate", "isPublished", "publishDate", "sortOrder") + .section("content", "Content", "notes", Tier.T2, "excerpt", "content") + .section("featured", "Featured Image", "image", Tier.T2, "featuredMediaId", "featuredImage") + .child(PHOTO_ALBUM, "projectUpdateId", "Photo Albums", null, "sortOrder") + .child(BLOG_POST_VERSION, "projectUpdateId", "Related Versions", null, "name") + .unique("slug", "projectId") + .text("content") + .imagePreview("featuredImage", "title", null) + .build(), + CmsTableDefinition.builder(PHOTO_ALBUM_FOLDER, CmsPhotoAlbumFolder.class, CmsFeature.PHOTOS, "Album Folder", "folder", Kind.MAIN) + .section("folder", "Album Folder", "folder", Tier.T1, "id", "name", "slug", "siteId", "parentId", "isPublished", "sortOrder") + .section("content", "Content", "notes", Tier.T2, "description", "folderImageUrl") + .section("seo", "SEO", "travel_explore", Tier.T2, "metaTitle", "metaDescription") + .child(PHOTO_ALBUM_FOLDER, "parentId", "Sub-Folders", null, "sortOrder") + .child(PHOTO_ALBUM, "photoAlbumFolderId", "Albums", null, "sortOrder") + .unique("slug", "siteId") + .imagePreview("folderImageUrl", "name", null) + .build(), + CmsTableDefinition.builder(PHOTO_ALBUM, CmsPhotoAlbum.class, CmsFeature.PHOTOS, "Photo Album", "photo_library", Kind.MAIN) + .section("album", "Photo Album", "photo_library", Tier.T1, "id", "name", "shortName", "slug", "siteId", "photoAlbumFolderId", "projectId", "projectUpdateId", "isPublished", "publishDate", "sortOrder") + .section("content", "Content", "notes", Tier.T2, "title", "description", "coverPhotoId", "coverImageUrl") + .section("location", "Location", "place", Tier.T2, "location", "locationLatitude", "locationLongitude") + .section("shoot", "Shoot Details", "camera", Tier.T2, "albumDate", "albumEndDate", "primaryCamera", "primaryLens", "weather") + .section("seo", "SEO", "travel_explore", Tier.T2, "metaTitle", "metaDescription") + .child(PHOTO, "photoAlbumId", "Photos", "photos", "sortOrder") + .unique("slug", "siteId").unique("shortName", "siteId") + .imagePreview("coverImageUrl", "title", null) + .build(), + CmsTableDefinition.builder(PHOTO, CmsPhoto.class, CmsFeature.PHOTOS, "Photo", "photo_camera", Kind.CHILD) + .recordLabel("title") + .section("photo", "Photo", "photo_camera", Tier.T1, "id", "title", "slug", "photoAlbumId", "mediaId", "caption", "isPublished", "publishDate", "sortOrder") + .section("content", "Content", "notes", Tier.T2, "description", "score", "isFavorite", "isAlbumCover") + .section("renditions", "Renditions", "photo_size_select_large", Tier.T2, "originalUrl", "galleryUrl", "slideshowUrl", "thumbnailUrl") + .section("file", "File", "insert_drive_file", Tier.T2, "originalFilename", "storageKey", "mimeType", "fileSize", "width", "height") + .section("exif", "Camera Data", "camera", Tier.T2, "exifDateTaken", "exifCameraMake", "exifCameraModel", "exifLensModel", "exifFocalLength", "exifAperture", "exifShutterSpeed", "exifIso", "exifWhiteBalance", "exifFlash", "exifGpsLatitude", "exifGpsLongitude") + .child(PHOTO_TAG_INT, "photoId", "Tags", "tags", "id") + .unique("slug", "photoAlbumId") + .filePreview("originalUrl", "thumbnailUrl", "originalFilename", "title", "caption") + .build(), + CmsTableDefinition.builder(PHOTO_TAG, CmsPhotoTag.class, CmsFeature.PHOTOS, "Photo Tag", "label", Kind.MAIN) + .section("tag", "Tag", "label", Tier.T1, "id", "name", "slug", "description") + .child(PHOTO_TAG_INT, "photoTagId", "Photos", null, "id") + .unique("slug").unique("name") + .build(), + CmsTableDefinition.builder(PHOTO_TAG_INT, CmsPhotoTagLink.class, CmsFeature.PHOTOS, "Photo Tag Link", "label", Kind.CHILD) + .recordLabel("id") + .section("photoTag", "Photo Tag", "label", Tier.T1, "id", "photoId", "photoTagId") + .unique("photoId", "photoTagId") .build()); + /** Value lists by logical possible-value source name (each gets the table prefix when built). */ + private static final Map[]> VALUE_LISTS = Map.of( + CmsMediaRenditionFormat.NAME, CmsMediaRenditionFormat.values(), + CmsMediaCacheClass.NAME, CmsMediaCacheClass.values(), + CmsContentChannel.NAME, CmsContentChannel.values(), + CmsContentFormat.NAME, CmsContentFormat.values(), + CmsContentVersionStatus.NAME, CmsContentVersionStatus.values(), + CmsProjectStatus.NAME, CmsProjectStatus.values()); + /******************************************************************************* @@ -156,4 +373,25 @@ public final class CmsTables { return (DEFINITIONS.stream().filter(d -> d.logicalName().equals(logicalName)).findFirst()); } + + + + /******************************************************************************* + ** The values of a value list (a possible-value source that is a fixed list, + ** such as the status of a project) by its logical name. + *******************************************************************************/ + public static Optional[]> valueList(String logicalName) + { + return (Optional.ofNullable(VALUE_LISTS.get(logicalName))); + } + + + + /******************************************************************************* + ** The logical names of the value lists, in a stable order. + *******************************************************************************/ + public static List valueListNames() + { + return (VALUE_LISTS.keySet().stream().sorted().toList()); + } } diff --git a/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsAuthor.java b/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsAuthor.java new file mode 100644 index 0000000..e4cafb8 --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsAuthor.java @@ -0,0 +1,535 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.blog.model; + + +import java.time.Instant; +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.core.model.data.QField; +import com.kingsrook.qqq.backend.core.model.data.QRecord; +import com.kingsrook.qqq.backend.core.model.data.QRecordEntity; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DynamicDefaultValueBehavior; +import com.kingsrook.qqq.backend.core.model.metadata.fields.ValueTooLongBehavior; + + +/******************************************************************************* + ** A person who writes posts. + ** + ** The physical table name is the configured prefix plus TABLE_NAME (for + ** example cms_author); possible-value source names on the fields are + ** logical and get the same prefix when the table is built. + *******************************************************************************/ +public class CmsAuthor extends QRecordEntity +{ + public static final String TABLE_NAME = "author"; + + @QField(isEditable = false, isPrimaryKey = true) + private Long id; + + @QField(isRequired = true, maxLength = 40, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String name; + + @QField(isRequired = true, maxLength = 20, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String shortName; + + @QField(maxLength = 255, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12) + private String description; + + @QField(isRequired = true, maxLength = 40, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String slug; + + @QField(maxLength = 255, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12) + private String email; + + @QField(possibleValueSourceName = "media", label = "Profile Media") + private Long profileMediaId; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12, label = "Profile Image URL") + private String profileImageUrl; + + @QField(maxLength = 255, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12) + private String website; + + @QField(gridColumns = 12) + private String socialLinks; + + @QField(defaultValue = "true") + private Boolean isActive; + + @QField + private Integer displayOrder; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.CREATE_DATE) + private Instant createDate; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.MODIFY_DATE) + private Instant modifyDate; + + + + /******************************************************************************* + ** Default constructor + *******************************************************************************/ + public CmsAuthor() + { + } + + + + /******************************************************************************* + ** Constructor that takes a QRecord + *******************************************************************************/ + public CmsAuthor(QRecord record) throws QException + { + populateFromQRecord(record); + } + + + + /******************************************************************************* + ** Getter for id + *******************************************************************************/ + public Long getId() + { + return (this.id); + } + + + + /******************************************************************************* + ** Setter for id + *******************************************************************************/ + public void setId(Long id) + { + this.id = id; + } + + + + /******************************************************************************* + ** Fluent setter for id + *******************************************************************************/ + public CmsAuthor withId(Long id) + { + this.id = id; + return (this); + } + + + + /******************************************************************************* + ** Getter for name + *******************************************************************************/ + public String getName() + { + return (this.name); + } + + + + /******************************************************************************* + ** Setter for name + *******************************************************************************/ + public void setName(String name) + { + this.name = name; + } + + + + /******************************************************************************* + ** Fluent setter for name + *******************************************************************************/ + public CmsAuthor withName(String name) + { + this.name = name; + return (this); + } + + + + /******************************************************************************* + ** Getter for shortName + *******************************************************************************/ + public String getShortName() + { + return (this.shortName); + } + + + + /******************************************************************************* + ** Setter for shortName + *******************************************************************************/ + public void setShortName(String shortName) + { + this.shortName = shortName; + } + + + + /******************************************************************************* + ** Fluent setter for shortName + *******************************************************************************/ + public CmsAuthor withShortName(String shortName) + { + this.shortName = shortName; + return (this); + } + + + + /******************************************************************************* + ** Getter for description + *******************************************************************************/ + public String getDescription() + { + return (this.description); + } + + + + /******************************************************************************* + ** Setter for description + *******************************************************************************/ + public void setDescription(String description) + { + this.description = description; + } + + + + /******************************************************************************* + ** Fluent setter for description + *******************************************************************************/ + public CmsAuthor withDescription(String description) + { + this.description = description; + return (this); + } + + + + /******************************************************************************* + ** Getter for slug + *******************************************************************************/ + public String getSlug() + { + return (this.slug); + } + + + + /******************************************************************************* + ** Setter for slug + *******************************************************************************/ + public void setSlug(String slug) + { + this.slug = slug; + } + + + + /******************************************************************************* + ** Fluent setter for slug + *******************************************************************************/ + public CmsAuthor withSlug(String slug) + { + this.slug = slug; + return (this); + } + + + + /******************************************************************************* + ** Getter for email + *******************************************************************************/ + public String getEmail() + { + return (this.email); + } + + + + /******************************************************************************* + ** Setter for email + *******************************************************************************/ + public void setEmail(String email) + { + this.email = email; + } + + + + /******************************************************************************* + ** Fluent setter for email + *******************************************************************************/ + public CmsAuthor withEmail(String email) + { + this.email = email; + return (this); + } + + + + /******************************************************************************* + ** Getter for profileMediaId + *******************************************************************************/ + public Long getProfileMediaId() + { + return (this.profileMediaId); + } + + + + /******************************************************************************* + ** Setter for profileMediaId + *******************************************************************************/ + public void setProfileMediaId(Long profileMediaId) + { + this.profileMediaId = profileMediaId; + } + + + + /******************************************************************************* + ** Fluent setter for profileMediaId + *******************************************************************************/ + public CmsAuthor withProfileMediaId(Long profileMediaId) + { + this.profileMediaId = profileMediaId; + return (this); + } + + + + /******************************************************************************* + ** Getter for profileImageUrl + *******************************************************************************/ + public String getProfileImageUrl() + { + return (this.profileImageUrl); + } + + + + /******************************************************************************* + ** Setter for profileImageUrl + *******************************************************************************/ + public void setProfileImageUrl(String profileImageUrl) + { + this.profileImageUrl = profileImageUrl; + } + + + + /******************************************************************************* + ** Fluent setter for profileImageUrl + *******************************************************************************/ + public CmsAuthor withProfileImageUrl(String profileImageUrl) + { + this.profileImageUrl = profileImageUrl; + return (this); + } + + + + /******************************************************************************* + ** Getter for website + *******************************************************************************/ + public String getWebsite() + { + return (this.website); + } + + + + /******************************************************************************* + ** Setter for website + *******************************************************************************/ + public void setWebsite(String website) + { + this.website = website; + } + + + + /******************************************************************************* + ** Fluent setter for website + *******************************************************************************/ + public CmsAuthor withWebsite(String website) + { + this.website = website; + return (this); + } + + + + /******************************************************************************* + ** Getter for socialLinks + *******************************************************************************/ + public String getSocialLinks() + { + return (this.socialLinks); + } + + + + /******************************************************************************* + ** Setter for socialLinks + *******************************************************************************/ + public void setSocialLinks(String socialLinks) + { + this.socialLinks = socialLinks; + } + + + + /******************************************************************************* + ** Fluent setter for socialLinks + *******************************************************************************/ + public CmsAuthor withSocialLinks(String socialLinks) + { + this.socialLinks = socialLinks; + return (this); + } + + + + /******************************************************************************* + ** Getter for isActive + *******************************************************************************/ + public Boolean getIsActive() + { + return (this.isActive); + } + + + + /******************************************************************************* + ** Setter for isActive + *******************************************************************************/ + public void setIsActive(Boolean isActive) + { + this.isActive = isActive; + } + + + + /******************************************************************************* + ** Fluent setter for isActive + *******************************************************************************/ + public CmsAuthor withIsActive(Boolean isActive) + { + this.isActive = isActive; + return (this); + } + + + + /******************************************************************************* + ** Getter for displayOrder + *******************************************************************************/ + public Integer getDisplayOrder() + { + return (this.displayOrder); + } + + + + /******************************************************************************* + ** Setter for displayOrder + *******************************************************************************/ + public void setDisplayOrder(Integer displayOrder) + { + this.displayOrder = displayOrder; + } + + + + /******************************************************************************* + ** Fluent setter for displayOrder + *******************************************************************************/ + public CmsAuthor withDisplayOrder(Integer displayOrder) + { + this.displayOrder = displayOrder; + return (this); + } + + + + /******************************************************************************* + ** Getter for createDate + *******************************************************************************/ + public Instant getCreateDate() + { + return (this.createDate); + } + + + + /******************************************************************************* + ** Setter for createDate + *******************************************************************************/ + public void setCreateDate(Instant createDate) + { + this.createDate = createDate; + } + + + + /******************************************************************************* + ** Fluent setter for createDate + *******************************************************************************/ + public CmsAuthor withCreateDate(Instant createDate) + { + this.createDate = createDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for modifyDate + *******************************************************************************/ + public Instant getModifyDate() + { + return (this.modifyDate); + } + + + + /******************************************************************************* + ** Setter for modifyDate + *******************************************************************************/ + public void setModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + } + + + + /******************************************************************************* + ** Fluent setter for modifyDate + *******************************************************************************/ + public CmsAuthor withModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + return (this); + } + +} diff --git a/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsBlog.java b/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsBlog.java new file mode 100644 index 0000000..1dac1d2 --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsBlog.java @@ -0,0 +1,467 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.blog.model; + + +import java.time.Instant; +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.core.model.data.QField; +import com.kingsrook.qqq.backend.core.model.data.QRecord; +import com.kingsrook.qqq.backend.core.model.data.QRecordEntity; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DynamicDefaultValueBehavior; +import com.kingsrook.qqq.backend.core.model.metadata.fields.ValueTooLongBehavior; + + +/******************************************************************************* + ** A blog of a site: a named stream of posts with its own tags. + ** + ** The physical table name is the configured prefix plus TABLE_NAME (for + ** example cms_blog); possible-value source names on the fields are + ** logical and get the same prefix when the table is built. + *******************************************************************************/ +public class CmsBlog extends QRecordEntity +{ + public static final String TABLE_NAME = "blog"; + + @QField(isEditable = false, isPrimaryKey = true) + private Long id; + + @QField(isRequired = true, maxLength = 20, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String shortName; + + @QField(isRequired = true, maxLength = 40, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String name; + + @QField(maxLength = 255, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12) + private String description; + + @QField(isRequired = true, maxLength = 40, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String slug; + + @QField(isRequired = true, possibleValueSourceName = "blog_type", label = "Blog Type") + private Long blogTypeId; + + @QField(maxLength = 255, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String metaTitle; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String metaDescription; + + @QField(maxLength = 255, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String metaKeywords; + + @QField(isRequired = true, possibleValueSourceName = "site", label = "Site") + private Long siteId; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.CREATE_DATE) + private Instant createDate; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.MODIFY_DATE) + private Instant modifyDate; + + + + /******************************************************************************* + ** Default constructor + *******************************************************************************/ + public CmsBlog() + { + } + + + + /******************************************************************************* + ** Constructor that takes a QRecord + *******************************************************************************/ + public CmsBlog(QRecord record) throws QException + { + populateFromQRecord(record); + } + + + + /******************************************************************************* + ** Getter for id + *******************************************************************************/ + public Long getId() + { + return (this.id); + } + + + + /******************************************************************************* + ** Setter for id + *******************************************************************************/ + public void setId(Long id) + { + this.id = id; + } + + + + /******************************************************************************* + ** Fluent setter for id + *******************************************************************************/ + public CmsBlog withId(Long id) + { + this.id = id; + return (this); + } + + + + /******************************************************************************* + ** Getter for shortName + *******************************************************************************/ + public String getShortName() + { + return (this.shortName); + } + + + + /******************************************************************************* + ** Setter for shortName + *******************************************************************************/ + public void setShortName(String shortName) + { + this.shortName = shortName; + } + + + + /******************************************************************************* + ** Fluent setter for shortName + *******************************************************************************/ + public CmsBlog withShortName(String shortName) + { + this.shortName = shortName; + return (this); + } + + + + /******************************************************************************* + ** Getter for name + *******************************************************************************/ + public String getName() + { + return (this.name); + } + + + + /******************************************************************************* + ** Setter for name + *******************************************************************************/ + public void setName(String name) + { + this.name = name; + } + + + + /******************************************************************************* + ** Fluent setter for name + *******************************************************************************/ + public CmsBlog withName(String name) + { + this.name = name; + return (this); + } + + + + /******************************************************************************* + ** Getter for description + *******************************************************************************/ + public String getDescription() + { + return (this.description); + } + + + + /******************************************************************************* + ** Setter for description + *******************************************************************************/ + public void setDescription(String description) + { + this.description = description; + } + + + + /******************************************************************************* + ** Fluent setter for description + *******************************************************************************/ + public CmsBlog withDescription(String description) + { + this.description = description; + return (this); + } + + + + /******************************************************************************* + ** Getter for slug + *******************************************************************************/ + public String getSlug() + { + return (this.slug); + } + + + + /******************************************************************************* + ** Setter for slug + *******************************************************************************/ + public void setSlug(String slug) + { + this.slug = slug; + } + + + + /******************************************************************************* + ** Fluent setter for slug + *******************************************************************************/ + public CmsBlog withSlug(String slug) + { + this.slug = slug; + return (this); + } + + + + /******************************************************************************* + ** Getter for blogTypeId + *******************************************************************************/ + public Long getBlogTypeId() + { + return (this.blogTypeId); + } + + + + /******************************************************************************* + ** Setter for blogTypeId + *******************************************************************************/ + public void setBlogTypeId(Long blogTypeId) + { + this.blogTypeId = blogTypeId; + } + + + + /******************************************************************************* + ** Fluent setter for blogTypeId + *******************************************************************************/ + public CmsBlog withBlogTypeId(Long blogTypeId) + { + this.blogTypeId = blogTypeId; + return (this); + } + + + + /******************************************************************************* + ** Getter for metaTitle + *******************************************************************************/ + public String getMetaTitle() + { + return (this.metaTitle); + } + + + + /******************************************************************************* + ** Setter for metaTitle + *******************************************************************************/ + public void setMetaTitle(String metaTitle) + { + this.metaTitle = metaTitle; + } + + + + /******************************************************************************* + ** Fluent setter for metaTitle + *******************************************************************************/ + public CmsBlog withMetaTitle(String metaTitle) + { + this.metaTitle = metaTitle; + return (this); + } + + + + /******************************************************************************* + ** Getter for metaDescription + *******************************************************************************/ + public String getMetaDescription() + { + return (this.metaDescription); + } + + + + /******************************************************************************* + ** Setter for metaDescription + *******************************************************************************/ + public void setMetaDescription(String metaDescription) + { + this.metaDescription = metaDescription; + } + + + + /******************************************************************************* + ** Fluent setter for metaDescription + *******************************************************************************/ + public CmsBlog withMetaDescription(String metaDescription) + { + this.metaDescription = metaDescription; + return (this); + } + + + + /******************************************************************************* + ** Getter for metaKeywords + *******************************************************************************/ + public String getMetaKeywords() + { + return (this.metaKeywords); + } + + + + /******************************************************************************* + ** Setter for metaKeywords + *******************************************************************************/ + public void setMetaKeywords(String metaKeywords) + { + this.metaKeywords = metaKeywords; + } + + + + /******************************************************************************* + ** Fluent setter for metaKeywords + *******************************************************************************/ + public CmsBlog withMetaKeywords(String metaKeywords) + { + this.metaKeywords = metaKeywords; + return (this); + } + + + + /******************************************************************************* + ** Getter for siteId + *******************************************************************************/ + public Long getSiteId() + { + return (this.siteId); + } + + + + /******************************************************************************* + ** Setter for siteId + *******************************************************************************/ + public void setSiteId(Long siteId) + { + this.siteId = siteId; + } + + + + /******************************************************************************* + ** Fluent setter for siteId + *******************************************************************************/ + public CmsBlog withSiteId(Long siteId) + { + this.siteId = siteId; + return (this); + } + + + + /******************************************************************************* + ** Getter for createDate + *******************************************************************************/ + public Instant getCreateDate() + { + return (this.createDate); + } + + + + /******************************************************************************* + ** Setter for createDate + *******************************************************************************/ + public void setCreateDate(Instant createDate) + { + this.createDate = createDate; + } + + + + /******************************************************************************* + ** Fluent setter for createDate + *******************************************************************************/ + public CmsBlog withCreateDate(Instant createDate) + { + this.createDate = createDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for modifyDate + *******************************************************************************/ + public Instant getModifyDate() + { + return (this.modifyDate); + } + + + + /******************************************************************************* + ** Setter for modifyDate + *******************************************************************************/ + public void setModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + } + + + + /******************************************************************************* + ** Fluent setter for modifyDate + *******************************************************************************/ + public CmsBlog withModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + return (this); + } + +} diff --git a/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsBlogPost.java b/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsBlogPost.java new file mode 100644 index 0000000..68aa63e --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsBlogPost.java @@ -0,0 +1,809 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.blog.model; + + +import java.time.Instant; +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.core.model.data.QField; +import com.kingsrook.qqq.backend.core.model.data.QRecord; +import com.kingsrook.qqq.backend.core.model.data.QRecordEntity; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DisplayFormat; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DynamicDefaultValueBehavior; +import com.kingsrook.qqq.backend.core.model.metadata.fields.ValueTooLongBehavior; + + +/******************************************************************************* + ** A post of a blog: its content, author, publication state and search + ** engine text. + ** + ** The physical table name is the configured prefix plus TABLE_NAME (for + ** example cms_blog_post); possible-value source names on the fields are + ** logical and get the same prefix when the table is built. + *******************************************************************************/ +public class CmsBlogPost extends QRecordEntity +{ + public static final String TABLE_NAME = "blog_post"; + + @QField(isEditable = false, isPrimaryKey = true) + private Long id; + + @QField(isRequired = true, maxLength = 40, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String name; + + @QField(isRequired = true, maxLength = 20, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String shortName; + + @QField(maxLength = 255, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12) + private String description; + + @QField(isRequired = true, maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String title; + + @QField(isRequired = true, maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String slug; + + @QField(isRequired = true, gridColumns = 12) + private String content; + + @QField(isRequired = true, possibleValueSourceName = "author", label = "Author") + private Long authorId; + + @QField(isRequired = true, possibleValueSourceName = "blog", label = "Blog") + private Long blogId; + + @QField(isRequired = true, defaultValue = "false") + private Boolean isPublished; + + @QField + private Instant publishDate; + + @QField(possibleValueSourceName = "media", label = "Featured Media") + private Long featuredMediaId; + + @QField(maxLength = 255, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12, label = "Featured Image URL") + private String featuredImage; + + @QField(maxLength = 255, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12) + private String metaTitle; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12) + private String metaDescription; + + @QField(maxLength = 255, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12) + private String metaKeywords; + + @QField(isRequired = true, defaultValue = "4", label = "Read time (minutes)") + private Integer readTime; + + @QField(isEditable = false, defaultValue = "0", displayFormat = DisplayFormat.COMMAS) + private Long viewCount; + + @QField(isRequired = true, defaultValue = "false") + private Boolean isFeatured; + + @QField(gridColumns = 12) + private String excerpt; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.CREATE_DATE) + private Instant createDate; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.MODIFY_DATE) + private Instant modifyDate; + + + + /******************************************************************************* + ** Default constructor + *******************************************************************************/ + public CmsBlogPost() + { + } + + + + /******************************************************************************* + ** Constructor that takes a QRecord + *******************************************************************************/ + public CmsBlogPost(QRecord record) throws QException + { + populateFromQRecord(record); + } + + + + /******************************************************************************* + ** Getter for id + *******************************************************************************/ + public Long getId() + { + return (this.id); + } + + + + /******************************************************************************* + ** Setter for id + *******************************************************************************/ + public void setId(Long id) + { + this.id = id; + } + + + + /******************************************************************************* + ** Fluent setter for id + *******************************************************************************/ + public CmsBlogPost withId(Long id) + { + this.id = id; + return (this); + } + + + + /******************************************************************************* + ** Getter for name + *******************************************************************************/ + public String getName() + { + return (this.name); + } + + + + /******************************************************************************* + ** Setter for name + *******************************************************************************/ + public void setName(String name) + { + this.name = name; + } + + + + /******************************************************************************* + ** Fluent setter for name + *******************************************************************************/ + public CmsBlogPost withName(String name) + { + this.name = name; + return (this); + } + + + + /******************************************************************************* + ** Getter for shortName + *******************************************************************************/ + public String getShortName() + { + return (this.shortName); + } + + + + /******************************************************************************* + ** Setter for shortName + *******************************************************************************/ + public void setShortName(String shortName) + { + this.shortName = shortName; + } + + + + /******************************************************************************* + ** Fluent setter for shortName + *******************************************************************************/ + public CmsBlogPost withShortName(String shortName) + { + this.shortName = shortName; + return (this); + } + + + + /******************************************************************************* + ** Getter for description + *******************************************************************************/ + public String getDescription() + { + return (this.description); + } + + + + /******************************************************************************* + ** Setter for description + *******************************************************************************/ + public void setDescription(String description) + { + this.description = description; + } + + + + /******************************************************************************* + ** Fluent setter for description + *******************************************************************************/ + public CmsBlogPost withDescription(String description) + { + this.description = description; + return (this); + } + + + + /******************************************************************************* + ** Getter for title + *******************************************************************************/ + public String getTitle() + { + return (this.title); + } + + + + /******************************************************************************* + ** Setter for title + *******************************************************************************/ + public void setTitle(String title) + { + this.title = title; + } + + + + /******************************************************************************* + ** Fluent setter for title + *******************************************************************************/ + public CmsBlogPost withTitle(String title) + { + this.title = title; + return (this); + } + + + + /******************************************************************************* + ** Getter for slug + *******************************************************************************/ + public String getSlug() + { + return (this.slug); + } + + + + /******************************************************************************* + ** Setter for slug + *******************************************************************************/ + public void setSlug(String slug) + { + this.slug = slug; + } + + + + /******************************************************************************* + ** Fluent setter for slug + *******************************************************************************/ + public CmsBlogPost withSlug(String slug) + { + this.slug = slug; + return (this); + } + + + + /******************************************************************************* + ** Getter for content + *******************************************************************************/ + public String getContent() + { + return (this.content); + } + + + + /******************************************************************************* + ** Setter for content + *******************************************************************************/ + public void setContent(String content) + { + this.content = content; + } + + + + /******************************************************************************* + ** Fluent setter for content + *******************************************************************************/ + public CmsBlogPost withContent(String content) + { + this.content = content; + return (this); + } + + + + /******************************************************************************* + ** Getter for authorId + *******************************************************************************/ + public Long getAuthorId() + { + return (this.authorId); + } + + + + /******************************************************************************* + ** Setter for authorId + *******************************************************************************/ + public void setAuthorId(Long authorId) + { + this.authorId = authorId; + } + + + + /******************************************************************************* + ** Fluent setter for authorId + *******************************************************************************/ + public CmsBlogPost withAuthorId(Long authorId) + { + this.authorId = authorId; + return (this); + } + + + + /******************************************************************************* + ** Getter for blogId + *******************************************************************************/ + public Long getBlogId() + { + return (this.blogId); + } + + + + /******************************************************************************* + ** Setter for blogId + *******************************************************************************/ + public void setBlogId(Long blogId) + { + this.blogId = blogId; + } + + + + /******************************************************************************* + ** Fluent setter for blogId + *******************************************************************************/ + public CmsBlogPost withBlogId(Long blogId) + { + this.blogId = blogId; + return (this); + } + + + + /******************************************************************************* + ** Getter for isPublished + *******************************************************************************/ + public Boolean getIsPublished() + { + return (this.isPublished); + } + + + + /******************************************************************************* + ** Setter for isPublished + *******************************************************************************/ + public void setIsPublished(Boolean isPublished) + { + this.isPublished = isPublished; + } + + + + /******************************************************************************* + ** Fluent setter for isPublished + *******************************************************************************/ + public CmsBlogPost withIsPublished(Boolean isPublished) + { + this.isPublished = isPublished; + return (this); + } + + + + /******************************************************************************* + ** Getter for publishDate + *******************************************************************************/ + public Instant getPublishDate() + { + return (this.publishDate); + } + + + + /******************************************************************************* + ** Setter for publishDate + *******************************************************************************/ + public void setPublishDate(Instant publishDate) + { + this.publishDate = publishDate; + } + + + + /******************************************************************************* + ** Fluent setter for publishDate + *******************************************************************************/ + public CmsBlogPost withPublishDate(Instant publishDate) + { + this.publishDate = publishDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for featuredMediaId + *******************************************************************************/ + public Long getFeaturedMediaId() + { + return (this.featuredMediaId); + } + + + + /******************************************************************************* + ** Setter for featuredMediaId + *******************************************************************************/ + public void setFeaturedMediaId(Long featuredMediaId) + { + this.featuredMediaId = featuredMediaId; + } + + + + /******************************************************************************* + ** Fluent setter for featuredMediaId + *******************************************************************************/ + public CmsBlogPost withFeaturedMediaId(Long featuredMediaId) + { + this.featuredMediaId = featuredMediaId; + return (this); + } + + + + /******************************************************************************* + ** Getter for featuredImage + *******************************************************************************/ + public String getFeaturedImage() + { + return (this.featuredImage); + } + + + + /******************************************************************************* + ** Setter for featuredImage + *******************************************************************************/ + public void setFeaturedImage(String featuredImage) + { + this.featuredImage = featuredImage; + } + + + + /******************************************************************************* + ** Fluent setter for featuredImage + *******************************************************************************/ + public CmsBlogPost withFeaturedImage(String featuredImage) + { + this.featuredImage = featuredImage; + return (this); + } + + + + /******************************************************************************* + ** Getter for metaTitle + *******************************************************************************/ + public String getMetaTitle() + { + return (this.metaTitle); + } + + + + /******************************************************************************* + ** Setter for metaTitle + *******************************************************************************/ + public void setMetaTitle(String metaTitle) + { + this.metaTitle = metaTitle; + } + + + + /******************************************************************************* + ** Fluent setter for metaTitle + *******************************************************************************/ + public CmsBlogPost withMetaTitle(String metaTitle) + { + this.metaTitle = metaTitle; + return (this); + } + + + + /******************************************************************************* + ** Getter for metaDescription + *******************************************************************************/ + public String getMetaDescription() + { + return (this.metaDescription); + } + + + + /******************************************************************************* + ** Setter for metaDescription + *******************************************************************************/ + public void setMetaDescription(String metaDescription) + { + this.metaDescription = metaDescription; + } + + + + /******************************************************************************* + ** Fluent setter for metaDescription + *******************************************************************************/ + public CmsBlogPost withMetaDescription(String metaDescription) + { + this.metaDescription = metaDescription; + return (this); + } + + + + /******************************************************************************* + ** Getter for metaKeywords + *******************************************************************************/ + public String getMetaKeywords() + { + return (this.metaKeywords); + } + + + + /******************************************************************************* + ** Setter for metaKeywords + *******************************************************************************/ + public void setMetaKeywords(String metaKeywords) + { + this.metaKeywords = metaKeywords; + } + + + + /******************************************************************************* + ** Fluent setter for metaKeywords + *******************************************************************************/ + public CmsBlogPost withMetaKeywords(String metaKeywords) + { + this.metaKeywords = metaKeywords; + return (this); + } + + + + /******************************************************************************* + ** Getter for readTime + *******************************************************************************/ + public Integer getReadTime() + { + return (this.readTime); + } + + + + /******************************************************************************* + ** Setter for readTime + *******************************************************************************/ + public void setReadTime(Integer readTime) + { + this.readTime = readTime; + } + + + + /******************************************************************************* + ** Fluent setter for readTime + *******************************************************************************/ + public CmsBlogPost withReadTime(Integer readTime) + { + this.readTime = readTime; + return (this); + } + + + + /******************************************************************************* + ** Getter for viewCount + *******************************************************************************/ + public Long getViewCount() + { + return (this.viewCount); + } + + + + /******************************************************************************* + ** Setter for viewCount + *******************************************************************************/ + public void setViewCount(Long viewCount) + { + this.viewCount = viewCount; + } + + + + /******************************************************************************* + ** Fluent setter for viewCount + *******************************************************************************/ + public CmsBlogPost withViewCount(Long viewCount) + { + this.viewCount = viewCount; + return (this); + } + + + + /******************************************************************************* + ** Getter for isFeatured + *******************************************************************************/ + public Boolean getIsFeatured() + { + return (this.isFeatured); + } + + + + /******************************************************************************* + ** Setter for isFeatured + *******************************************************************************/ + public void setIsFeatured(Boolean isFeatured) + { + this.isFeatured = isFeatured; + } + + + + /******************************************************************************* + ** Fluent setter for isFeatured + *******************************************************************************/ + public CmsBlogPost withIsFeatured(Boolean isFeatured) + { + this.isFeatured = isFeatured; + return (this); + } + + + + /******************************************************************************* + ** Getter for excerpt + *******************************************************************************/ + public String getExcerpt() + { + return (this.excerpt); + } + + + + /******************************************************************************* + ** Setter for excerpt + *******************************************************************************/ + public void setExcerpt(String excerpt) + { + this.excerpt = excerpt; + } + + + + /******************************************************************************* + ** Fluent setter for excerpt + *******************************************************************************/ + public CmsBlogPost withExcerpt(String excerpt) + { + this.excerpt = excerpt; + return (this); + } + + + + /******************************************************************************* + ** Getter for createDate + *******************************************************************************/ + public Instant getCreateDate() + { + return (this.createDate); + } + + + + /******************************************************************************* + ** Setter for createDate + *******************************************************************************/ + public void setCreateDate(Instant createDate) + { + this.createDate = createDate; + } + + + + /******************************************************************************* + ** Fluent setter for createDate + *******************************************************************************/ + public CmsBlogPost withCreateDate(Instant createDate) + { + this.createDate = createDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for modifyDate + *******************************************************************************/ + public Instant getModifyDate() + { + return (this.modifyDate); + } + + + + /******************************************************************************* + ** Setter for modifyDate + *******************************************************************************/ + public void setModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + } + + + + /******************************************************************************* + ** Fluent setter for modifyDate + *******************************************************************************/ + public CmsBlogPost withModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + return (this); + } + +} diff --git a/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsBlogPostMedia.java b/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsBlogPostMedia.java new file mode 100644 index 0000000..098a9e1 --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsBlogPostMedia.java @@ -0,0 +1,468 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.blog.model; + + +import java.time.Instant; +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.core.model.data.QField; +import com.kingsrook.qqq.backend.core.model.data.QRecord; +import com.kingsrook.qqq.backend.core.model.data.QRecordEntity; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DisplayFormat; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DynamicDefaultValueBehavior; +import com.kingsrook.qqq.backend.core.model.metadata.fields.ValueTooLongBehavior; + + +/******************************************************************************* + ** A media file attached to a post, in order, with the text shown with it. + ** + ** The physical table name is the configured prefix plus TABLE_NAME (for + ** example cms_blog_post_media); possible-value source names on the fields are + ** logical and get the same prefix when the table is built. + *******************************************************************************/ +public class CmsBlogPostMedia extends QRecordEntity +{ + public static final String TABLE_NAME = "blog_post_media"; + + @QField(isEditable = false, isPrimaryKey = true) + private Long id; + + @QField(isRequired = true, possibleValueSourceName = "blog_post", label = "Blog Post") + private Long blogPostId; + + @QField(isRequired = true, possibleValueSourceName = "media", label = "Media") + private Long mediaId; + + @QField(isRequired = true, defaultValue = "0") + private Integer sortOrder; + + @QField(maxLength = 1000, valueTooLongBehavior = ValueTooLongBehavior.ERROR, label = "Alt text") + private String altText; + + @QField(maxLength = 2000, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String caption; + + @QField(isRequired = true, maxLength = 1000, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12, label = "URL") + private String url; + + @QField(maxLength = 1000, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12, label = "Thumbnail URL") + private String thumbnailUrl; + + @QField(displayFormat = DisplayFormat.COMMAS) + private Integer width; + + @QField(displayFormat = DisplayFormat.COMMAS) + private Integer height; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.CREATE_DATE) + private Instant createDate; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.MODIFY_DATE) + private Instant modifyDate; + + + + /******************************************************************************* + ** Default constructor + *******************************************************************************/ + public CmsBlogPostMedia() + { + } + + + + /******************************************************************************* + ** Constructor that takes a QRecord + *******************************************************************************/ + public CmsBlogPostMedia(QRecord record) throws QException + { + populateFromQRecord(record); + } + + + + /******************************************************************************* + ** Getter for id + *******************************************************************************/ + public Long getId() + { + return (this.id); + } + + + + /******************************************************************************* + ** Setter for id + *******************************************************************************/ + public void setId(Long id) + { + this.id = id; + } + + + + /******************************************************************************* + ** Fluent setter for id + *******************************************************************************/ + public CmsBlogPostMedia withId(Long id) + { + this.id = id; + return (this); + } + + + + /******************************************************************************* + ** Getter for blogPostId + *******************************************************************************/ + public Long getBlogPostId() + { + return (this.blogPostId); + } + + + + /******************************************************************************* + ** Setter for blogPostId + *******************************************************************************/ + public void setBlogPostId(Long blogPostId) + { + this.blogPostId = blogPostId; + } + + + + /******************************************************************************* + ** Fluent setter for blogPostId + *******************************************************************************/ + public CmsBlogPostMedia withBlogPostId(Long blogPostId) + { + this.blogPostId = blogPostId; + return (this); + } + + + + /******************************************************************************* + ** Getter for mediaId + *******************************************************************************/ + public Long getMediaId() + { + return (this.mediaId); + } + + + + /******************************************************************************* + ** Setter for mediaId + *******************************************************************************/ + public void setMediaId(Long mediaId) + { + this.mediaId = mediaId; + } + + + + /******************************************************************************* + ** Fluent setter for mediaId + *******************************************************************************/ + public CmsBlogPostMedia withMediaId(Long mediaId) + { + this.mediaId = mediaId; + return (this); + } + + + + /******************************************************************************* + ** Getter for sortOrder + *******************************************************************************/ + public Integer getSortOrder() + { + return (this.sortOrder); + } + + + + /******************************************************************************* + ** Setter for sortOrder + *******************************************************************************/ + public void setSortOrder(Integer sortOrder) + { + this.sortOrder = sortOrder; + } + + + + /******************************************************************************* + ** Fluent setter for sortOrder + *******************************************************************************/ + public CmsBlogPostMedia withSortOrder(Integer sortOrder) + { + this.sortOrder = sortOrder; + return (this); + } + + + + /******************************************************************************* + ** Getter for altText + *******************************************************************************/ + public String getAltText() + { + return (this.altText); + } + + + + /******************************************************************************* + ** Setter for altText + *******************************************************************************/ + public void setAltText(String altText) + { + this.altText = altText; + } + + + + /******************************************************************************* + ** Fluent setter for altText + *******************************************************************************/ + public CmsBlogPostMedia withAltText(String altText) + { + this.altText = altText; + return (this); + } + + + + /******************************************************************************* + ** Getter for caption + *******************************************************************************/ + public String getCaption() + { + return (this.caption); + } + + + + /******************************************************************************* + ** Setter for caption + *******************************************************************************/ + public void setCaption(String caption) + { + this.caption = caption; + } + + + + /******************************************************************************* + ** Fluent setter for caption + *******************************************************************************/ + public CmsBlogPostMedia withCaption(String caption) + { + this.caption = caption; + return (this); + } + + + + /******************************************************************************* + ** Getter for url + *******************************************************************************/ + public String getUrl() + { + return (this.url); + } + + + + /******************************************************************************* + ** Setter for url + *******************************************************************************/ + public void setUrl(String url) + { + this.url = url; + } + + + + /******************************************************************************* + ** Fluent setter for url + *******************************************************************************/ + public CmsBlogPostMedia withUrl(String url) + { + this.url = url; + return (this); + } + + + + /******************************************************************************* + ** Getter for thumbnailUrl + *******************************************************************************/ + public String getThumbnailUrl() + { + return (this.thumbnailUrl); + } + + + + /******************************************************************************* + ** Setter for thumbnailUrl + *******************************************************************************/ + public void setThumbnailUrl(String thumbnailUrl) + { + this.thumbnailUrl = thumbnailUrl; + } + + + + /******************************************************************************* + ** Fluent setter for thumbnailUrl + *******************************************************************************/ + public CmsBlogPostMedia withThumbnailUrl(String thumbnailUrl) + { + this.thumbnailUrl = thumbnailUrl; + return (this); + } + + + + /******************************************************************************* + ** Getter for width + *******************************************************************************/ + public Integer getWidth() + { + return (this.width); + } + + + + /******************************************************************************* + ** Setter for width + *******************************************************************************/ + public void setWidth(Integer width) + { + this.width = width; + } + + + + /******************************************************************************* + ** Fluent setter for width + *******************************************************************************/ + public CmsBlogPostMedia withWidth(Integer width) + { + this.width = width; + return (this); + } + + + + /******************************************************************************* + ** Getter for height + *******************************************************************************/ + public Integer getHeight() + { + return (this.height); + } + + + + /******************************************************************************* + ** Setter for height + *******************************************************************************/ + public void setHeight(Integer height) + { + this.height = height; + } + + + + /******************************************************************************* + ** Fluent setter for height + *******************************************************************************/ + public CmsBlogPostMedia withHeight(Integer height) + { + this.height = height; + return (this); + } + + + + /******************************************************************************* + ** Getter for createDate + *******************************************************************************/ + public Instant getCreateDate() + { + return (this.createDate); + } + + + + /******************************************************************************* + ** Setter for createDate + *******************************************************************************/ + public void setCreateDate(Instant createDate) + { + this.createDate = createDate; + } + + + + /******************************************************************************* + ** Fluent setter for createDate + *******************************************************************************/ + public CmsBlogPostMedia withCreateDate(Instant createDate) + { + this.createDate = createDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for modifyDate + *******************************************************************************/ + public Instant getModifyDate() + { + return (this.modifyDate); + } + + + + /******************************************************************************* + ** Setter for modifyDate + *******************************************************************************/ + public void setModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + } + + + + /******************************************************************************* + ** Fluent setter for modifyDate + *******************************************************************************/ + public CmsBlogPostMedia withModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + return (this); + } + +} diff --git a/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsBlogPostTag.java b/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsBlogPostTag.java new file mode 100644 index 0000000..1d1c6f9 --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsBlogPostTag.java @@ -0,0 +1,228 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.blog.model; + + +import java.time.Instant; +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.core.model.data.QField; +import com.kingsrook.qqq.backend.core.model.data.QRecord; +import com.kingsrook.qqq.backend.core.model.data.QRecordEntity; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DynamicDefaultValueBehavior; + + +/******************************************************************************* + ** One tag on one post. + ** + ** The physical table name is the configured prefix plus TABLE_NAME (for + ** example cms_blog_post_tag_int); possible-value source names on the fields are + ** logical and get the same prefix when the table is built. + *******************************************************************************/ +public class CmsBlogPostTag extends QRecordEntity +{ + public static final String TABLE_NAME = "blog_post_tag_int"; + + @QField(isEditable = false, isPrimaryKey = true) + private Long id; + + @QField(isRequired = true, possibleValueSourceName = "blog_post", label = "Blog Post") + private Long blogPostId; + + @QField(isRequired = true, possibleValueSourceName = "blog_tag", label = "Blog Tag") + private Long blogTagId; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.CREATE_DATE) + private Instant createDate; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.MODIFY_DATE) + private Instant modifyDate; + + + + /******************************************************************************* + ** Default constructor + *******************************************************************************/ + public CmsBlogPostTag() + { + } + + + + /******************************************************************************* + ** Constructor that takes a QRecord + *******************************************************************************/ + public CmsBlogPostTag(QRecord record) throws QException + { + populateFromQRecord(record); + } + + + + /******************************************************************************* + ** Getter for id + *******************************************************************************/ + public Long getId() + { + return (this.id); + } + + + + /******************************************************************************* + ** Setter for id + *******************************************************************************/ + public void setId(Long id) + { + this.id = id; + } + + + + /******************************************************************************* + ** Fluent setter for id + *******************************************************************************/ + public CmsBlogPostTag withId(Long id) + { + this.id = id; + return (this); + } + + + + /******************************************************************************* + ** Getter for blogPostId + *******************************************************************************/ + public Long getBlogPostId() + { + return (this.blogPostId); + } + + + + /******************************************************************************* + ** Setter for blogPostId + *******************************************************************************/ + public void setBlogPostId(Long blogPostId) + { + this.blogPostId = blogPostId; + } + + + + /******************************************************************************* + ** Fluent setter for blogPostId + *******************************************************************************/ + public CmsBlogPostTag withBlogPostId(Long blogPostId) + { + this.blogPostId = blogPostId; + return (this); + } + + + + /******************************************************************************* + ** Getter for blogTagId + *******************************************************************************/ + public Long getBlogTagId() + { + return (this.blogTagId); + } + + + + /******************************************************************************* + ** Setter for blogTagId + *******************************************************************************/ + public void setBlogTagId(Long blogTagId) + { + this.blogTagId = blogTagId; + } + + + + /******************************************************************************* + ** Fluent setter for blogTagId + *******************************************************************************/ + public CmsBlogPostTag withBlogTagId(Long blogTagId) + { + this.blogTagId = blogTagId; + return (this); + } + + + + /******************************************************************************* + ** Getter for createDate + *******************************************************************************/ + public Instant getCreateDate() + { + return (this.createDate); + } + + + + /******************************************************************************* + ** Setter for createDate + *******************************************************************************/ + public void setCreateDate(Instant createDate) + { + this.createDate = createDate; + } + + + + /******************************************************************************* + ** Fluent setter for createDate + *******************************************************************************/ + public CmsBlogPostTag withCreateDate(Instant createDate) + { + this.createDate = createDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for modifyDate + *******************************************************************************/ + public Instant getModifyDate() + { + return (this.modifyDate); + } + + + + /******************************************************************************* + ** Setter for modifyDate + *******************************************************************************/ + public void setModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + } + + + + /******************************************************************************* + ** Fluent setter for modifyDate + *******************************************************************************/ + public CmsBlogPostTag withModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + return (this); + } + +} diff --git a/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsBlogPostVersion.java b/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsBlogPostVersion.java new file mode 100644 index 0000000..5cefcb5 --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsBlogPostVersion.java @@ -0,0 +1,639 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.blog.model; + + +import java.time.Instant; +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.core.model.data.QField; +import com.kingsrook.qqq.backend.core.model.data.QRecord; +import com.kingsrook.qqq.backend.core.model.data.QRecordEntity; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DynamicDefaultValueBehavior; +import com.kingsrook.qqq.backend.core.model.metadata.fields.ValueTooLongBehavior; + + +/******************************************************************************* + ** A version of a piece of content written for another channel (LinkedIn, + ** Medium and so on). It belongs to one post, one project or one project + ** update. + ** + ** The physical table name is the configured prefix plus TABLE_NAME (for + ** example cms_blog_post_version); possible-value source names on the fields are + ** logical and get the same prefix when the table is built. + *******************************************************************************/ +public class CmsBlogPostVersion extends QRecordEntity +{ + public static final String TABLE_NAME = "blog_post_version"; + + @QField(isEditable = false, isPrimaryKey = true) + private Long id; + + @QField(possibleValueSourceName = "blog_post", label = "Blog Post") + private Long blogPostId; + + @QField(possibleValueSourceName = "project", label = "Project") + private Long projectId; + + @QField(possibleValueSourceName = "project_update", label = "Project Update") + private Long projectUpdateId; + + @QField(isRequired = true, maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String name; + + @QField(isRequired = true, maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String variantKey; + + @QField(isRequired = true, maxLength = 40, valueTooLongBehavior = ValueTooLongBehavior.ERROR, possibleValueSourceName = "content_channel") + private String channel; + + @QField(maxLength = 200, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String title; + + @QField(isRequired = true, gridColumns = 12) + private String content; + + @QField(isRequired = true, maxLength = 20, defaultValue = "MARKDOWN", possibleValueSourceName = "content_format") + private String contentFormat; + + @QField(isRequired = true, maxLength = 20, defaultValue = "DRAFT", possibleValueSourceName = "content_version_status") + private String status; + + @QField(maxLength = 64, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String sourceDigest; + + @QField(maxLength = 64, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String sourceCommit; + + @QField(maxLength = 2000, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12, label = "Published URL") + private String publishedUrl; + + @QField + private Instant publishedDate; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.CREATE_DATE) + private Instant createDate; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.MODIFY_DATE) + private Instant modifyDate; + + + + /******************************************************************************* + ** Default constructor + *******************************************************************************/ + public CmsBlogPostVersion() + { + } + + + + /******************************************************************************* + ** Constructor that takes a QRecord + *******************************************************************************/ + public CmsBlogPostVersion(QRecord record) throws QException + { + populateFromQRecord(record); + } + + + + /******************************************************************************* + ** Getter for id + *******************************************************************************/ + public Long getId() + { + return (this.id); + } + + + + /******************************************************************************* + ** Setter for id + *******************************************************************************/ + public void setId(Long id) + { + this.id = id; + } + + + + /******************************************************************************* + ** Fluent setter for id + *******************************************************************************/ + public CmsBlogPostVersion withId(Long id) + { + this.id = id; + return (this); + } + + + + /******************************************************************************* + ** Getter for blogPostId + *******************************************************************************/ + public Long getBlogPostId() + { + return (this.blogPostId); + } + + + + /******************************************************************************* + ** Setter for blogPostId + *******************************************************************************/ + public void setBlogPostId(Long blogPostId) + { + this.blogPostId = blogPostId; + } + + + + /******************************************************************************* + ** Fluent setter for blogPostId + *******************************************************************************/ + public CmsBlogPostVersion withBlogPostId(Long blogPostId) + { + this.blogPostId = blogPostId; + return (this); + } + + + + /******************************************************************************* + ** Getter for projectId + *******************************************************************************/ + public Long getProjectId() + { + return (this.projectId); + } + + + + /******************************************************************************* + ** Setter for projectId + *******************************************************************************/ + public void setProjectId(Long projectId) + { + this.projectId = projectId; + } + + + + /******************************************************************************* + ** Fluent setter for projectId + *******************************************************************************/ + public CmsBlogPostVersion withProjectId(Long projectId) + { + this.projectId = projectId; + return (this); + } + + + + /******************************************************************************* + ** Getter for projectUpdateId + *******************************************************************************/ + public Long getProjectUpdateId() + { + return (this.projectUpdateId); + } + + + + /******************************************************************************* + ** Setter for projectUpdateId + *******************************************************************************/ + public void setProjectUpdateId(Long projectUpdateId) + { + this.projectUpdateId = projectUpdateId; + } + + + + /******************************************************************************* + ** Fluent setter for projectUpdateId + *******************************************************************************/ + public CmsBlogPostVersion withProjectUpdateId(Long projectUpdateId) + { + this.projectUpdateId = projectUpdateId; + return (this); + } + + + + /******************************************************************************* + ** Getter for name + *******************************************************************************/ + public String getName() + { + return (this.name); + } + + + + /******************************************************************************* + ** Setter for name + *******************************************************************************/ + public void setName(String name) + { + this.name = name; + } + + + + /******************************************************************************* + ** Fluent setter for name + *******************************************************************************/ + public CmsBlogPostVersion withName(String name) + { + this.name = name; + return (this); + } + + + + /******************************************************************************* + ** Getter for variantKey + *******************************************************************************/ + public String getVariantKey() + { + return (this.variantKey); + } + + + + /******************************************************************************* + ** Setter for variantKey + *******************************************************************************/ + public void setVariantKey(String variantKey) + { + this.variantKey = variantKey; + } + + + + /******************************************************************************* + ** Fluent setter for variantKey + *******************************************************************************/ + public CmsBlogPostVersion withVariantKey(String variantKey) + { + this.variantKey = variantKey; + return (this); + } + + + + /******************************************************************************* + ** Getter for channel + *******************************************************************************/ + public String getChannel() + { + return (this.channel); + } + + + + /******************************************************************************* + ** Setter for channel + *******************************************************************************/ + public void setChannel(String channel) + { + this.channel = channel; + } + + + + /******************************************************************************* + ** Fluent setter for channel + *******************************************************************************/ + public CmsBlogPostVersion withChannel(String channel) + { + this.channel = channel; + return (this); + } + + + + /******************************************************************************* + ** Getter for title + *******************************************************************************/ + public String getTitle() + { + return (this.title); + } + + + + /******************************************************************************* + ** Setter for title + *******************************************************************************/ + public void setTitle(String title) + { + this.title = title; + } + + + + /******************************************************************************* + ** Fluent setter for title + *******************************************************************************/ + public CmsBlogPostVersion withTitle(String title) + { + this.title = title; + return (this); + } + + + + /******************************************************************************* + ** Getter for content + *******************************************************************************/ + public String getContent() + { + return (this.content); + } + + + + /******************************************************************************* + ** Setter for content + *******************************************************************************/ + public void setContent(String content) + { + this.content = content; + } + + + + /******************************************************************************* + ** Fluent setter for content + *******************************************************************************/ + public CmsBlogPostVersion withContent(String content) + { + this.content = content; + return (this); + } + + + + /******************************************************************************* + ** Getter for contentFormat + *******************************************************************************/ + public String getContentFormat() + { + return (this.contentFormat); + } + + + + /******************************************************************************* + ** Setter for contentFormat + *******************************************************************************/ + public void setContentFormat(String contentFormat) + { + this.contentFormat = contentFormat; + } + + + + /******************************************************************************* + ** Fluent setter for contentFormat + *******************************************************************************/ + public CmsBlogPostVersion withContentFormat(String contentFormat) + { + this.contentFormat = contentFormat; + return (this); + } + + + + /******************************************************************************* + ** Getter for status + *******************************************************************************/ + public String getStatus() + { + return (this.status); + } + + + + /******************************************************************************* + ** Setter for status + *******************************************************************************/ + public void setStatus(String status) + { + this.status = status; + } + + + + /******************************************************************************* + ** Fluent setter for status + *******************************************************************************/ + public CmsBlogPostVersion withStatus(String status) + { + this.status = status; + return (this); + } + + + + /******************************************************************************* + ** Getter for sourceDigest + *******************************************************************************/ + public String getSourceDigest() + { + return (this.sourceDigest); + } + + + + /******************************************************************************* + ** Setter for sourceDigest + *******************************************************************************/ + public void setSourceDigest(String sourceDigest) + { + this.sourceDigest = sourceDigest; + } + + + + /******************************************************************************* + ** Fluent setter for sourceDigest + *******************************************************************************/ + public CmsBlogPostVersion withSourceDigest(String sourceDigest) + { + this.sourceDigest = sourceDigest; + return (this); + } + + + + /******************************************************************************* + ** Getter for sourceCommit + *******************************************************************************/ + public String getSourceCommit() + { + return (this.sourceCommit); + } + + + + /******************************************************************************* + ** Setter for sourceCommit + *******************************************************************************/ + public void setSourceCommit(String sourceCommit) + { + this.sourceCommit = sourceCommit; + } + + + + /******************************************************************************* + ** Fluent setter for sourceCommit + *******************************************************************************/ + public CmsBlogPostVersion withSourceCommit(String sourceCommit) + { + this.sourceCommit = sourceCommit; + return (this); + } + + + + /******************************************************************************* + ** Getter for publishedUrl + *******************************************************************************/ + public String getPublishedUrl() + { + return (this.publishedUrl); + } + + + + /******************************************************************************* + ** Setter for publishedUrl + *******************************************************************************/ + public void setPublishedUrl(String publishedUrl) + { + this.publishedUrl = publishedUrl; + } + + + + /******************************************************************************* + ** Fluent setter for publishedUrl + *******************************************************************************/ + public CmsBlogPostVersion withPublishedUrl(String publishedUrl) + { + this.publishedUrl = publishedUrl; + return (this); + } + + + + /******************************************************************************* + ** Getter for publishedDate + *******************************************************************************/ + public Instant getPublishedDate() + { + return (this.publishedDate); + } + + + + /******************************************************************************* + ** Setter for publishedDate + *******************************************************************************/ + public void setPublishedDate(Instant publishedDate) + { + this.publishedDate = publishedDate; + } + + + + /******************************************************************************* + ** Fluent setter for publishedDate + *******************************************************************************/ + public CmsBlogPostVersion withPublishedDate(Instant publishedDate) + { + this.publishedDate = publishedDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for createDate + *******************************************************************************/ + public Instant getCreateDate() + { + return (this.createDate); + } + + + + /******************************************************************************* + ** Setter for createDate + *******************************************************************************/ + public void setCreateDate(Instant createDate) + { + this.createDate = createDate; + } + + + + /******************************************************************************* + ** Fluent setter for createDate + *******************************************************************************/ + public CmsBlogPostVersion withCreateDate(Instant createDate) + { + this.createDate = createDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for modifyDate + *******************************************************************************/ + public Instant getModifyDate() + { + return (this.modifyDate); + } + + + + /******************************************************************************* + ** Setter for modifyDate + *******************************************************************************/ + public void setModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + } + + + + /******************************************************************************* + ** Fluent setter for modifyDate + *******************************************************************************/ + public CmsBlogPostVersion withModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + return (this); + } + +} diff --git a/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsBlogTag.java b/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsBlogTag.java new file mode 100644 index 0000000..c74e293 --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsBlogTag.java @@ -0,0 +1,297 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.blog.model; + + +import java.time.Instant; +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.core.model.data.QField; +import com.kingsrook.qqq.backend.core.model.data.QRecord; +import com.kingsrook.qqq.backend.core.model.data.QRecordEntity; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DynamicDefaultValueBehavior; +import com.kingsrook.qqq.backend.core.model.metadata.fields.ValueTooLongBehavior; + + +/******************************************************************************* + ** A tag of one blog; posts of that blog carry it. + ** + ** The physical table name is the configured prefix plus TABLE_NAME (for + ** example cms_blog_tag); possible-value source names on the fields are + ** logical and get the same prefix when the table is built. + *******************************************************************************/ +public class CmsBlogTag extends QRecordEntity +{ + public static final String TABLE_NAME = "blog_tag"; + + @QField(isEditable = false, isPrimaryKey = true) + private Long id; + + @QField(isRequired = true, maxLength = 40, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String name; + + @QField(isRequired = true, maxLength = 40, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String slug; + + @QField(maxLength = 255, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12) + private String description; + + @QField(isRequired = true, possibleValueSourceName = "blog", label = "Blog") + private Long blogId; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.CREATE_DATE) + private Instant createDate; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.MODIFY_DATE) + private Instant modifyDate; + + + + /******************************************************************************* + ** Default constructor + *******************************************************************************/ + public CmsBlogTag() + { + } + + + + /******************************************************************************* + ** Constructor that takes a QRecord + *******************************************************************************/ + public CmsBlogTag(QRecord record) throws QException + { + populateFromQRecord(record); + } + + + + /******************************************************************************* + ** Getter for id + *******************************************************************************/ + public Long getId() + { + return (this.id); + } + + + + /******************************************************************************* + ** Setter for id + *******************************************************************************/ + public void setId(Long id) + { + this.id = id; + } + + + + /******************************************************************************* + ** Fluent setter for id + *******************************************************************************/ + public CmsBlogTag withId(Long id) + { + this.id = id; + return (this); + } + + + + /******************************************************************************* + ** Getter for name + *******************************************************************************/ + public String getName() + { + return (this.name); + } + + + + /******************************************************************************* + ** Setter for name + *******************************************************************************/ + public void setName(String name) + { + this.name = name; + } + + + + /******************************************************************************* + ** Fluent setter for name + *******************************************************************************/ + public CmsBlogTag withName(String name) + { + this.name = name; + return (this); + } + + + + /******************************************************************************* + ** Getter for slug + *******************************************************************************/ + public String getSlug() + { + return (this.slug); + } + + + + /******************************************************************************* + ** Setter for slug + *******************************************************************************/ + public void setSlug(String slug) + { + this.slug = slug; + } + + + + /******************************************************************************* + ** Fluent setter for slug + *******************************************************************************/ + public CmsBlogTag withSlug(String slug) + { + this.slug = slug; + return (this); + } + + + + /******************************************************************************* + ** Getter for description + *******************************************************************************/ + public String getDescription() + { + return (this.description); + } + + + + /******************************************************************************* + ** Setter for description + *******************************************************************************/ + public void setDescription(String description) + { + this.description = description; + } + + + + /******************************************************************************* + ** Fluent setter for description + *******************************************************************************/ + public CmsBlogTag withDescription(String description) + { + this.description = description; + return (this); + } + + + + /******************************************************************************* + ** Getter for blogId + *******************************************************************************/ + public Long getBlogId() + { + return (this.blogId); + } + + + + /******************************************************************************* + ** Setter for blogId + *******************************************************************************/ + public void setBlogId(Long blogId) + { + this.blogId = blogId; + } + + + + /******************************************************************************* + ** Fluent setter for blogId + *******************************************************************************/ + public CmsBlogTag withBlogId(Long blogId) + { + this.blogId = blogId; + return (this); + } + + + + /******************************************************************************* + ** Getter for createDate + *******************************************************************************/ + public Instant getCreateDate() + { + return (this.createDate); + } + + + + /******************************************************************************* + ** Setter for createDate + *******************************************************************************/ + public void setCreateDate(Instant createDate) + { + this.createDate = createDate; + } + + + + /******************************************************************************* + ** Fluent setter for createDate + *******************************************************************************/ + public CmsBlogTag withCreateDate(Instant createDate) + { + this.createDate = createDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for modifyDate + *******************************************************************************/ + public Instant getModifyDate() + { + return (this.modifyDate); + } + + + + /******************************************************************************* + ** Setter for modifyDate + *******************************************************************************/ + public void setModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + } + + + + /******************************************************************************* + ** Fluent setter for modifyDate + *******************************************************************************/ + public CmsBlogTag withModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + return (this); + } + +} diff --git a/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsBlogType.java b/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsBlogType.java new file mode 100644 index 0000000..51b23b8 --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsBlogType.java @@ -0,0 +1,331 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.blog.model; + + +import java.time.Instant; +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.core.model.data.QField; +import com.kingsrook.qqq.backend.core.model.data.QRecord; +import com.kingsrook.qqq.backend.core.model.data.QRecordEntity; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DynamicDefaultValueBehavior; +import com.kingsrook.qqq.backend.core.model.metadata.fields.ValueTooLongBehavior; + + +/******************************************************************************* + ** A kind of blog. + ** + ** The physical table name is the configured prefix plus TABLE_NAME (for + ** example cms_blog_type); possible-value source names on the fields are + ** logical and get the same prefix when the table is built. + *******************************************************************************/ +public class CmsBlogType extends QRecordEntity +{ + public static final String TABLE_NAME = "blog_type"; + + @QField(isEditable = false, isPrimaryKey = true) + private Long id; + + @QField(isRequired = true, maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String name; + + @QField(isRequired = true, maxLength = 50, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String code; + + @QField(maxLength = 255, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12) + private String description; + + @QField(isRequired = true, defaultValue = "true") + private Boolean isActive; + + @QField(isRequired = true, defaultValue = "0") + private Integer sortOrder; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.CREATE_DATE) + private Instant createDate; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.MODIFY_DATE) + private Instant modifyDate; + + + + /******************************************************************************* + ** Default constructor + *******************************************************************************/ + public CmsBlogType() + { + } + + + + /******************************************************************************* + ** Constructor that takes a QRecord + *******************************************************************************/ + public CmsBlogType(QRecord record) throws QException + { + populateFromQRecord(record); + } + + + + /******************************************************************************* + ** Getter for id + *******************************************************************************/ + public Long getId() + { + return (this.id); + } + + + + /******************************************************************************* + ** Setter for id + *******************************************************************************/ + public void setId(Long id) + { + this.id = id; + } + + + + /******************************************************************************* + ** Fluent setter for id + *******************************************************************************/ + public CmsBlogType withId(Long id) + { + this.id = id; + return (this); + } + + + + /******************************************************************************* + ** Getter for name + *******************************************************************************/ + public String getName() + { + return (this.name); + } + + + + /******************************************************************************* + ** Setter for name + *******************************************************************************/ + public void setName(String name) + { + this.name = name; + } + + + + /******************************************************************************* + ** Fluent setter for name + *******************************************************************************/ + public CmsBlogType withName(String name) + { + this.name = name; + return (this); + } + + + + /******************************************************************************* + ** Getter for code + *******************************************************************************/ + public String getCode() + { + return (this.code); + } + + + + /******************************************************************************* + ** Setter for code + *******************************************************************************/ + public void setCode(String code) + { + this.code = code; + } + + + + /******************************************************************************* + ** Fluent setter for code + *******************************************************************************/ + public CmsBlogType withCode(String code) + { + this.code = code; + return (this); + } + + + + /******************************************************************************* + ** Getter for description + *******************************************************************************/ + public String getDescription() + { + return (this.description); + } + + + + /******************************************************************************* + ** Setter for description + *******************************************************************************/ + public void setDescription(String description) + { + this.description = description; + } + + + + /******************************************************************************* + ** Fluent setter for description + *******************************************************************************/ + public CmsBlogType withDescription(String description) + { + this.description = description; + return (this); + } + + + + /******************************************************************************* + ** Getter for isActive + *******************************************************************************/ + public Boolean getIsActive() + { + return (this.isActive); + } + + + + /******************************************************************************* + ** Setter for isActive + *******************************************************************************/ + public void setIsActive(Boolean isActive) + { + this.isActive = isActive; + } + + + + /******************************************************************************* + ** Fluent setter for isActive + *******************************************************************************/ + public CmsBlogType withIsActive(Boolean isActive) + { + this.isActive = isActive; + return (this); + } + + + + /******************************************************************************* + ** Getter for sortOrder + *******************************************************************************/ + public Integer getSortOrder() + { + return (this.sortOrder); + } + + + + /******************************************************************************* + ** Setter for sortOrder + *******************************************************************************/ + public void setSortOrder(Integer sortOrder) + { + this.sortOrder = sortOrder; + } + + + + /******************************************************************************* + ** Fluent setter for sortOrder + *******************************************************************************/ + public CmsBlogType withSortOrder(Integer sortOrder) + { + this.sortOrder = sortOrder; + return (this); + } + + + + /******************************************************************************* + ** Getter for createDate + *******************************************************************************/ + public Instant getCreateDate() + { + return (this.createDate); + } + + + + /******************************************************************************* + ** Setter for createDate + *******************************************************************************/ + public void setCreateDate(Instant createDate) + { + this.createDate = createDate; + } + + + + /******************************************************************************* + ** Fluent setter for createDate + *******************************************************************************/ + public CmsBlogType withCreateDate(Instant createDate) + { + this.createDate = createDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for modifyDate + *******************************************************************************/ + public Instant getModifyDate() + { + return (this.modifyDate); + } + + + + /******************************************************************************* + ** Setter for modifyDate + *******************************************************************************/ + public void setModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + } + + + + /******************************************************************************* + ** Fluent setter for modifyDate + *******************************************************************************/ + public CmsBlogType withModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + return (this); + } + +} diff --git a/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsContentChannel.java b/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsContentChannel.java new file mode 100644 index 0000000..3ec4ba7 --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsContentChannel.java @@ -0,0 +1,71 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.blog.model; + + +import com.kingsrook.qqq.backend.core.model.metadata.possiblevalues.PossibleValueEnum; + + +/******************************************************************************* + ** Where a related version of a piece of content is meant to be published. + ** Its possible-value source gets the table prefix (cms_content_channel). + *******************************************************************************/ +public enum CmsContentChannel implements PossibleValueEnum +{ + WEBSITE("Website"), + LINKEDIN("LinkedIn"), + MEDIUM("Medium"), + FACEBOOK("Facebook"), + OTHER("Other"); + + /** The logical possible-value source name (the prefix is added). */ + public static final String NAME = "content_channel"; + + private final String label; + + + + /******************************************************************************* + ** Constructor. + *******************************************************************************/ + CmsContentChannel(String label) + { + this.label = label; + } + + + + /******************************************************************************* + ** The stored value. + *******************************************************************************/ + @Override + public String getPossibleValueId() + { + return (name()); + } + + + + /******************************************************************************* + ** The label. + *******************************************************************************/ + @Override + public String getPossibleValueLabel() + { + return (label); + } +} diff --git a/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsContentFormat.java b/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsContentFormat.java new file mode 100644 index 0000000..0bd1f89 --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsContentFormat.java @@ -0,0 +1,68 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.blog.model; + + +import com.kingsrook.qqq.backend.core.model.metadata.possiblevalues.PossibleValueEnum; + + +/******************************************************************************* + ** The format of a related version's content. Its possible-value source gets + ** the table prefix (cms_content_format). + *******************************************************************************/ +public enum CmsContentFormat implements PossibleValueEnum +{ + MARKDOWN("Markdown"), + PLAIN_TEXT("Plain text"); + + /** The logical possible-value source name (the prefix is added). */ + public static final String NAME = "content_format"; + + private final String label; + + + + /******************************************************************************* + ** Constructor. + *******************************************************************************/ + CmsContentFormat(String label) + { + this.label = label; + } + + + + /******************************************************************************* + ** The stored value. + *******************************************************************************/ + @Override + public String getPossibleValueId() + { + return (name()); + } + + + + /******************************************************************************* + ** The label. + *******************************************************************************/ + @Override + public String getPossibleValueLabel() + { + return (label); + } +} diff --git a/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsContentVersionStatus.java b/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsContentVersionStatus.java new file mode 100644 index 0000000..01dc68d --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/blog/model/CmsContentVersionStatus.java @@ -0,0 +1,70 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.blog.model; + + +import com.kingsrook.qqq.backend.core.model.metadata.possiblevalues.PossibleValueEnum; + + +/******************************************************************************* + ** The state of a related version. Its possible-value source gets the table + ** prefix (cms_content_version_status). + *******************************************************************************/ +public enum CmsContentVersionStatus implements PossibleValueEnum +{ + DRAFT("Draft"), + READY("Ready"), + PUBLISHED("Published externally"), + ARCHIVED("Archived"); + + /** The logical possible-value source name (the prefix is added). */ + public static final String NAME = "content_version_status"; + + private final String label; + + + + /******************************************************************************* + ** Constructor. + *******************************************************************************/ + CmsContentVersionStatus(String label) + { + this.label = label; + } + + + + /******************************************************************************* + ** The stored value. + *******************************************************************************/ + @Override + public String getPossibleValueId() + { + return (name()); + } + + + + /******************************************************************************* + ** The label. + *******************************************************************************/ + @Override + public String getPossibleValueLabel() + { + return (label); + } +} diff --git a/src/main/java/com/kingsrook/qbits/cms/home/CmsHtml.java b/src/main/java/com/kingsrook/qbits/cms/home/CmsHtml.java index 3733470..fe062a4 100644 --- a/src/main/java/com/kingsrook/qbits/cms/home/CmsHtml.java +++ b/src/main/java/com/kingsrook/qbits/cms/home/CmsHtml.java @@ -110,7 +110,7 @@ public final class CmsHtml *******************************************************************************/ public static String muted(String html) { - return ("" + html + ""); + return ("" + html + ""); } @@ -120,7 +120,7 @@ public final class CmsHtml *******************************************************************************/ public static String heading(String text) { - return ("
" + escape(text) + "
"); + return ("
" + escape(text) + "
"); } @@ -134,13 +134,13 @@ public final class CmsHtml for(Tile tile : tiles) { html.append("
"); - html.append("
").append(escape(tile.label())).append("
"); + html.append("
").append(escape(tile.label())).append("
"); String value = tile.href() == null ? escape(tile.value()) : "" + escape(tile.value()) + ""; - html.append("
").append(value).append("
"); + html.append("
").append(value).append("
"); for(String note : tile.notes()) { - html.append("
").append(note).append("
"); + html.append("
").append(note).append("
"); } html.append("
"); } @@ -159,7 +159,7 @@ public final class CmsHtml { html.append("
  • "); html.append("").append(row.href() == null ? escape(row.title()) : link(row.href(), row.title())).append(""); - html.append("").append(escape(row.detail())).append(""); + html.append("").append(escape(row.detail())).append(""); html.append("
  • "); } return (html.append("").toString()); @@ -172,7 +172,7 @@ public final class CmsHtml *******************************************************************************/ public static String empty(String messageHtml) { - return ("
    " + messageHtml + "
    "); + return ("
    " + messageHtml + "
    "); } @@ -182,7 +182,7 @@ public final class CmsHtml *******************************************************************************/ public static String warning(String messageHtml) { - return ("
    " + messageHtml + "
    "); } } diff --git a/src/main/java/com/kingsrook/qbits/cms/media/model/CmsMedia.java b/src/main/java/com/kingsrook/qbits/cms/media/model/CmsMedia.java new file mode 100644 index 0000000..75a50be --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/media/model/CmsMedia.java @@ -0,0 +1,945 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.media.model; + + +import java.time.Instant; +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.core.model.data.QField; +import com.kingsrook.qqq.backend.core.model.data.QRecord; +import com.kingsrook.qqq.backend.core.model.data.QRecordEntity; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DisplayFormat; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DynamicDefaultValueBehavior; +import com.kingsrook.qqq.backend.core.model.metadata.fields.ValueTooLongBehavior; + + +/******************************************************************************* + ** A file in a site's media library: where it is, what it is, and the text + ** that goes with it (alternative text, caption, credit and license). + ** + ** The physical table name is the configured prefix plus TABLE_NAME (for + ** example cms_media); possible-value source names on the fields are + ** logical and get the same prefix when the table is built. + *******************************************************************************/ +public class CmsMedia extends QRecordEntity +{ + public static final String TABLE_NAME = "media"; + + @QField(isEditable = false, isPrimaryKey = true) + private Long id; + + @QField(isRequired = true, maxLength = 200, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String name; + + @QField(maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String slug; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.TRUNCATE) + private String description; + + @QField(maxLength = 1000, valueTooLongBehavior = ValueTooLongBehavior.ERROR, label = "Alt text") + private String altText; + + @QField(maxLength = 2000, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String caption; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String credit; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String license; + + @QField(isRequired = true, possibleValueSourceName = "media_type", label = "Media Type") + private Long mediaTypeId; + + @QField(isEditable = false, maxLength = 255, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String fileName; + + @QField(isEditable = false, maxLength = 20, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String fileExtension; + + @QField(maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR, label = "MIME type") + private String mimeType; + + @QField(isEditable = false, displayFormat = DisplayFormat.COMMAS) + private Long fileSize; + + @QField(isEditable = false, displayFormat = DisplayFormat.COMMAS) + private Integer width; + + @QField(isEditable = false, displayFormat = DisplayFormat.COMMAS) + private Integer height; + + @QField(isEditable = false, displayFormat = DisplayFormat.COMMAS) + private Integer duration; + + @QField(isEditable = false, maxLength = 64, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String checksum; + + @QField(isRequired = true, defaultValue = "true") + private Boolean isActive; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12, label = "Public URL") + private String publicUrl; + + @QField(isEditable = false, maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.TRUNCATE) + private String storageKey; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12, label = "Thumbnail URL") + private String thumbnailUrl; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12, label = "Gallery URL") + private String galleryUrl; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12, label = "Slideshow URL") + private String slideshowUrl; + + @QField(isRequired = true, possibleValueSourceName = "site", label = "Site") + private Long siteId; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.CREATE_DATE) + private Instant createDate; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.MODIFY_DATE) + private Instant modifyDate; + + + + /******************************************************************************* + ** Default constructor + *******************************************************************************/ + public CmsMedia() + { + } + + + + /******************************************************************************* + ** Constructor that takes a QRecord + *******************************************************************************/ + public CmsMedia(QRecord record) throws QException + { + populateFromQRecord(record); + } + + + + /******************************************************************************* + ** Getter for id + *******************************************************************************/ + public Long getId() + { + return (this.id); + } + + + + /******************************************************************************* + ** Setter for id + *******************************************************************************/ + public void setId(Long id) + { + this.id = id; + } + + + + /******************************************************************************* + ** Fluent setter for id + *******************************************************************************/ + public CmsMedia withId(Long id) + { + this.id = id; + return (this); + } + + + + /******************************************************************************* + ** Getter for name + *******************************************************************************/ + public String getName() + { + return (this.name); + } + + + + /******************************************************************************* + ** Setter for name + *******************************************************************************/ + public void setName(String name) + { + this.name = name; + } + + + + /******************************************************************************* + ** Fluent setter for name + *******************************************************************************/ + public CmsMedia withName(String name) + { + this.name = name; + return (this); + } + + + + /******************************************************************************* + ** Getter for slug + *******************************************************************************/ + public String getSlug() + { + return (this.slug); + } + + + + /******************************************************************************* + ** Setter for slug + *******************************************************************************/ + public void setSlug(String slug) + { + this.slug = slug; + } + + + + /******************************************************************************* + ** Fluent setter for slug + *******************************************************************************/ + public CmsMedia withSlug(String slug) + { + this.slug = slug; + return (this); + } + + + + /******************************************************************************* + ** Getter for description + *******************************************************************************/ + public String getDescription() + { + return (this.description); + } + + + + /******************************************************************************* + ** Setter for description + *******************************************************************************/ + public void setDescription(String description) + { + this.description = description; + } + + + + /******************************************************************************* + ** Fluent setter for description + *******************************************************************************/ + public CmsMedia withDescription(String description) + { + this.description = description; + return (this); + } + + + + /******************************************************************************* + ** Getter for altText + *******************************************************************************/ + public String getAltText() + { + return (this.altText); + } + + + + /******************************************************************************* + ** Setter for altText + *******************************************************************************/ + public void setAltText(String altText) + { + this.altText = altText; + } + + + + /******************************************************************************* + ** Fluent setter for altText + *******************************************************************************/ + public CmsMedia withAltText(String altText) + { + this.altText = altText; + return (this); + } + + + + /******************************************************************************* + ** Getter for caption + *******************************************************************************/ + public String getCaption() + { + return (this.caption); + } + + + + /******************************************************************************* + ** Setter for caption + *******************************************************************************/ + public void setCaption(String caption) + { + this.caption = caption; + } + + + + /******************************************************************************* + ** Fluent setter for caption + *******************************************************************************/ + public CmsMedia withCaption(String caption) + { + this.caption = caption; + return (this); + } + + + + /******************************************************************************* + ** Getter for credit + *******************************************************************************/ + public String getCredit() + { + return (this.credit); + } + + + + /******************************************************************************* + ** Setter for credit + *******************************************************************************/ + public void setCredit(String credit) + { + this.credit = credit; + } + + + + /******************************************************************************* + ** Fluent setter for credit + *******************************************************************************/ + public CmsMedia withCredit(String credit) + { + this.credit = credit; + return (this); + } + + + + /******************************************************************************* + ** Getter for license + *******************************************************************************/ + public String getLicense() + { + return (this.license); + } + + + + /******************************************************************************* + ** Setter for license + *******************************************************************************/ + public void setLicense(String license) + { + this.license = license; + } + + + + /******************************************************************************* + ** Fluent setter for license + *******************************************************************************/ + public CmsMedia withLicense(String license) + { + this.license = license; + return (this); + } + + + + /******************************************************************************* + ** Getter for mediaTypeId + *******************************************************************************/ + public Long getMediaTypeId() + { + return (this.mediaTypeId); + } + + + + /******************************************************************************* + ** Setter for mediaTypeId + *******************************************************************************/ + public void setMediaTypeId(Long mediaTypeId) + { + this.mediaTypeId = mediaTypeId; + } + + + + /******************************************************************************* + ** Fluent setter for mediaTypeId + *******************************************************************************/ + public CmsMedia withMediaTypeId(Long mediaTypeId) + { + this.mediaTypeId = mediaTypeId; + return (this); + } + + + + /******************************************************************************* + ** Getter for fileName + *******************************************************************************/ + public String getFileName() + { + return (this.fileName); + } + + + + /******************************************************************************* + ** Setter for fileName + *******************************************************************************/ + public void setFileName(String fileName) + { + this.fileName = fileName; + } + + + + /******************************************************************************* + ** Fluent setter for fileName + *******************************************************************************/ + public CmsMedia withFileName(String fileName) + { + this.fileName = fileName; + return (this); + } + + + + /******************************************************************************* + ** Getter for fileExtension + *******************************************************************************/ + public String getFileExtension() + { + return (this.fileExtension); + } + + + + /******************************************************************************* + ** Setter for fileExtension + *******************************************************************************/ + public void setFileExtension(String fileExtension) + { + this.fileExtension = fileExtension; + } + + + + /******************************************************************************* + ** Fluent setter for fileExtension + *******************************************************************************/ + public CmsMedia withFileExtension(String fileExtension) + { + this.fileExtension = fileExtension; + return (this); + } + + + + /******************************************************************************* + ** Getter for mimeType + *******************************************************************************/ + public String getMimeType() + { + return (this.mimeType); + } + + + + /******************************************************************************* + ** Setter for mimeType + *******************************************************************************/ + public void setMimeType(String mimeType) + { + this.mimeType = mimeType; + } + + + + /******************************************************************************* + ** Fluent setter for mimeType + *******************************************************************************/ + public CmsMedia withMimeType(String mimeType) + { + this.mimeType = mimeType; + return (this); + } + + + + /******************************************************************************* + ** Getter for fileSize + *******************************************************************************/ + public Long getFileSize() + { + return (this.fileSize); + } + + + + /******************************************************************************* + ** Setter for fileSize + *******************************************************************************/ + public void setFileSize(Long fileSize) + { + this.fileSize = fileSize; + } + + + + /******************************************************************************* + ** Fluent setter for fileSize + *******************************************************************************/ + public CmsMedia withFileSize(Long fileSize) + { + this.fileSize = fileSize; + return (this); + } + + + + /******************************************************************************* + ** Getter for width + *******************************************************************************/ + public Integer getWidth() + { + return (this.width); + } + + + + /******************************************************************************* + ** Setter for width + *******************************************************************************/ + public void setWidth(Integer width) + { + this.width = width; + } + + + + /******************************************************************************* + ** Fluent setter for width + *******************************************************************************/ + public CmsMedia withWidth(Integer width) + { + this.width = width; + return (this); + } + + + + /******************************************************************************* + ** Getter for height + *******************************************************************************/ + public Integer getHeight() + { + return (this.height); + } + + + + /******************************************************************************* + ** Setter for height + *******************************************************************************/ + public void setHeight(Integer height) + { + this.height = height; + } + + + + /******************************************************************************* + ** Fluent setter for height + *******************************************************************************/ + public CmsMedia withHeight(Integer height) + { + this.height = height; + return (this); + } + + + + /******************************************************************************* + ** Getter for duration + *******************************************************************************/ + public Integer getDuration() + { + return (this.duration); + } + + + + /******************************************************************************* + ** Setter for duration + *******************************************************************************/ + public void setDuration(Integer duration) + { + this.duration = duration; + } + + + + /******************************************************************************* + ** Fluent setter for duration + *******************************************************************************/ + public CmsMedia withDuration(Integer duration) + { + this.duration = duration; + return (this); + } + + + + /******************************************************************************* + ** Getter for checksum + *******************************************************************************/ + public String getChecksum() + { + return (this.checksum); + } + + + + /******************************************************************************* + ** Setter for checksum + *******************************************************************************/ + public void setChecksum(String checksum) + { + this.checksum = checksum; + } + + + + /******************************************************************************* + ** Fluent setter for checksum + *******************************************************************************/ + public CmsMedia withChecksum(String checksum) + { + this.checksum = checksum; + return (this); + } + + + + /******************************************************************************* + ** Getter for isActive + *******************************************************************************/ + public Boolean getIsActive() + { + return (this.isActive); + } + + + + /******************************************************************************* + ** Setter for isActive + *******************************************************************************/ + public void setIsActive(Boolean isActive) + { + this.isActive = isActive; + } + + + + /******************************************************************************* + ** Fluent setter for isActive + *******************************************************************************/ + public CmsMedia withIsActive(Boolean isActive) + { + this.isActive = isActive; + return (this); + } + + + + /******************************************************************************* + ** Getter for publicUrl + *******************************************************************************/ + public String getPublicUrl() + { + return (this.publicUrl); + } + + + + /******************************************************************************* + ** Setter for publicUrl + *******************************************************************************/ + public void setPublicUrl(String publicUrl) + { + this.publicUrl = publicUrl; + } + + + + /******************************************************************************* + ** Fluent setter for publicUrl + *******************************************************************************/ + public CmsMedia withPublicUrl(String publicUrl) + { + this.publicUrl = publicUrl; + return (this); + } + + + + /******************************************************************************* + ** Getter for storageKey + *******************************************************************************/ + public String getStorageKey() + { + return (this.storageKey); + } + + + + /******************************************************************************* + ** Setter for storageKey + *******************************************************************************/ + public void setStorageKey(String storageKey) + { + this.storageKey = storageKey; + } + + + + /******************************************************************************* + ** Fluent setter for storageKey + *******************************************************************************/ + public CmsMedia withStorageKey(String storageKey) + { + this.storageKey = storageKey; + return (this); + } + + + + /******************************************************************************* + ** Getter for thumbnailUrl + *******************************************************************************/ + public String getThumbnailUrl() + { + return (this.thumbnailUrl); + } + + + + /******************************************************************************* + ** Setter for thumbnailUrl + *******************************************************************************/ + public void setThumbnailUrl(String thumbnailUrl) + { + this.thumbnailUrl = thumbnailUrl; + } + + + + /******************************************************************************* + ** Fluent setter for thumbnailUrl + *******************************************************************************/ + public CmsMedia withThumbnailUrl(String thumbnailUrl) + { + this.thumbnailUrl = thumbnailUrl; + return (this); + } + + + + /******************************************************************************* + ** Getter for galleryUrl + *******************************************************************************/ + public String getGalleryUrl() + { + return (this.galleryUrl); + } + + + + /******************************************************************************* + ** Setter for galleryUrl + *******************************************************************************/ + public void setGalleryUrl(String galleryUrl) + { + this.galleryUrl = galleryUrl; + } + + + + /******************************************************************************* + ** Fluent setter for galleryUrl + *******************************************************************************/ + public CmsMedia withGalleryUrl(String galleryUrl) + { + this.galleryUrl = galleryUrl; + return (this); + } + + + + /******************************************************************************* + ** Getter for slideshowUrl + *******************************************************************************/ + public String getSlideshowUrl() + { + return (this.slideshowUrl); + } + + + + /******************************************************************************* + ** Setter for slideshowUrl + *******************************************************************************/ + public void setSlideshowUrl(String slideshowUrl) + { + this.slideshowUrl = slideshowUrl; + } + + + + /******************************************************************************* + ** Fluent setter for slideshowUrl + *******************************************************************************/ + public CmsMedia withSlideshowUrl(String slideshowUrl) + { + this.slideshowUrl = slideshowUrl; + return (this); + } + + + + /******************************************************************************* + ** Getter for siteId + *******************************************************************************/ + public Long getSiteId() + { + return (this.siteId); + } + + + + /******************************************************************************* + ** Setter for siteId + *******************************************************************************/ + public void setSiteId(Long siteId) + { + this.siteId = siteId; + } + + + + /******************************************************************************* + ** Fluent setter for siteId + *******************************************************************************/ + public CmsMedia withSiteId(Long siteId) + { + this.siteId = siteId; + return (this); + } + + + + /******************************************************************************* + ** Getter for createDate + *******************************************************************************/ + public Instant getCreateDate() + { + return (this.createDate); + } + + + + /******************************************************************************* + ** Setter for createDate + *******************************************************************************/ + public void setCreateDate(Instant createDate) + { + this.createDate = createDate; + } + + + + /******************************************************************************* + ** Fluent setter for createDate + *******************************************************************************/ + public CmsMedia withCreateDate(Instant createDate) + { + this.createDate = createDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for modifyDate + *******************************************************************************/ + public Instant getModifyDate() + { + return (this.modifyDate); + } + + + + /******************************************************************************* + ** Setter for modifyDate + *******************************************************************************/ + public void setModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + } + + + + /******************************************************************************* + ** Fluent setter for modifyDate + *******************************************************************************/ + public CmsMedia withModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + return (this); + } + +} diff --git a/src/main/java/com/kingsrook/qbits/cms/media/model/CmsMediaCacheClass.java b/src/main/java/com/kingsrook/qbits/cms/media/model/CmsMediaCacheClass.java new file mode 100644 index 0000000..4b04a98 --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/media/model/CmsMediaCacheClass.java @@ -0,0 +1,69 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.media.model; + + +import com.kingsrook.qqq.backend.core.model.metadata.possiblevalues.PossibleValueEnum; + + +/******************************************************************************* + ** How long browsers and CDNs may keep a media type's files. Its + ** possible-value source is named after the media tables + ** (cms_media_cache_class). + *******************************************************************************/ +public enum CmsMediaCacheClass implements PossibleValueEnum +{ + IMMUTABLE("Immutable (1 year)"), + MUTABLE("Mutable (1 day)"); + + /** The logical possible-value source name (the prefix is added). */ + public static final String NAME = "media_cache_class"; + + private final String label; + + + + /******************************************************************************* + ** Constructor. + *******************************************************************************/ + CmsMediaCacheClass(String label) + { + this.label = label; + } + + + + /******************************************************************************* + ** The stored value. + *******************************************************************************/ + @Override + public String getPossibleValueId() + { + return (name()); + } + + + + /******************************************************************************* + ** The label. + *******************************************************************************/ + @Override + public String getPossibleValueLabel() + { + return (label); + } +} diff --git a/src/main/java/com/kingsrook/qbits/cms/media/model/CmsMediaRenditionFormat.java b/src/main/java/com/kingsrook/qbits/cms/media/model/CmsMediaRenditionFormat.java new file mode 100644 index 0000000..a9325c3 --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/media/model/CmsMediaRenditionFormat.java @@ -0,0 +1,69 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.media.model; + + +import com.kingsrook.qqq.backend.core.model.metadata.possiblevalues.PossibleValueEnum; + + +/******************************************************************************* + ** The image format of a generated rendition. Its possible-value source is + ** named after the media tables (cms_media_rendition_format). + *******************************************************************************/ +public enum CmsMediaRenditionFormat implements PossibleValueEnum +{ + JPEG("JPEG"), + PNG("PNG"), + WEBP("WebP"); + + /** The logical possible-value source name (the prefix is added). */ + public static final String NAME = "media_rendition_format"; + + private final String label; + + + + /******************************************************************************* + ** Constructor. + *******************************************************************************/ + CmsMediaRenditionFormat(String label) + { + this.label = label; + } + + + + /******************************************************************************* + ** The stored value. + *******************************************************************************/ + @Override + public String getPossibleValueId() + { + return (name()); + } + + + + /******************************************************************************* + ** The label. + *******************************************************************************/ + @Override + public String getPossibleValueLabel() + { + return (label); + } +} diff --git a/src/main/java/com/kingsrook/qbits/cms/media/model/CmsMediaType.java b/src/main/java/com/kingsrook/qbits/cms/media/model/CmsMediaType.java new file mode 100644 index 0000000..6906243 --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/media/model/CmsMediaType.java @@ -0,0 +1,1081 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.media.model; + + +import java.time.Instant; +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.core.model.data.QField; +import com.kingsrook.qqq.backend.core.model.data.QRecord; +import com.kingsrook.qqq.backend.core.model.data.QRecordEntity; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DisplayFormat; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DynamicDefaultValueBehavior; +import com.kingsrook.qqq.backend.core.model.metadata.fields.ValueTooLongBehavior; + + +/******************************************************************************* + ** A kind of media file (image, video, document) with its upload rules, + ** rendition settings, required text and cache and storage settings. + ** + ** The physical table name is the configured prefix plus TABLE_NAME (for + ** example cms_media_type); possible-value source names on the fields are + ** logical and get the same prefix when the table is built. + *******************************************************************************/ +public class CmsMediaType extends QRecordEntity +{ + public static final String TABLE_NAME = "media_type"; + + @QField(isEditable = false, isPrimaryKey = true) + private Long id; + + @QField(isRequired = true, maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String name; + + @QField(isRequired = true, maxLength = 50, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String code; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.TRUNCATE) + private String description; + + @QField(isRequired = true, defaultValue = "true") + private Boolean isActive; + + @QField(isRequired = true, defaultValue = "0") + private Integer sortOrder; + + @QField(maxLength = 1000, valueTooLongBehavior = ValueTooLongBehavior.ERROR, label = "Allowed MIME types") + private String allowedMimeTypes; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR, label = "Allowed file extensions") + private String allowedExtensions; + + @QField(displayFormat = DisplayFormat.COMMAS, label = "Max file size (MB)") + private Integer maxFileSizeMb; + + @QField(isRequired = true, defaultValue = "true", label = "Generate thumbnail") + private Boolean thumbnailEnabled; + + @QField(label = "Thumbnail width (px)") + private Integer thumbnailWidth; + + @QField(isRequired = true, maxLength = 10, defaultValue = "JPEG", possibleValueSourceName = "media_rendition_format", label = "Thumbnail format") + private String thumbnailFormat; + + @QField(label = "Thumbnail quality (1-100)") + private Integer thumbnailQuality; + + @QField(isRequired = true, defaultValue = "true", label = "Generate gallery image") + private Boolean galleryEnabled; + + @QField(label = "Gallery width (px)") + private Integer galleryWidth; + + @QField(isRequired = true, maxLength = 10, defaultValue = "JPEG", possibleValueSourceName = "media_rendition_format", label = "Gallery format") + private String galleryFormat; + + @QField(label = "Gallery quality (1-100)") + private Integer galleryQuality; + + @QField(isRequired = true, defaultValue = "true", label = "Generate slideshow image") + private Boolean slideshowEnabled; + + @QField(label = "Slideshow width (px)") + private Integer slideshowWidth; + + @QField(isRequired = true, maxLength = 10, defaultValue = "JPEG", possibleValueSourceName = "media_rendition_format", label = "Slideshow format") + private String slideshowFormat; + + @QField(label = "Slideshow quality (1-100)") + private Integer slideshowQuality; + + @QField(isRequired = true, defaultValue = "false", label = "Strip EXIF / GPS on upload") + private Boolean stripMetadata; + + @QField(isRequired = true, defaultValue = "false", label = "Require alt text") + private Boolean requireAltText; + + @QField(isRequired = true, defaultValue = "false", label = "Require caption") + private Boolean requireCaption; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR, label = "Default credit") + private String defaultCredit; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR, label = "Default license") + private String defaultLicense; + + @QField(isRequired = true, maxLength = 20, defaultValue = "MUTABLE", possibleValueSourceName = "media_cache_class", label = "Cache class") + private String cacheClass; + + @QField(isRequired = true, maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR, defaultValue = "media", label = "Storage prefix") + private String storagePrefix; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.CREATE_DATE) + private Instant createDate; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.MODIFY_DATE) + private Instant modifyDate; + + + + /******************************************************************************* + ** Default constructor + *******************************************************************************/ + public CmsMediaType() + { + } + + + + /******************************************************************************* + ** Constructor that takes a QRecord + *******************************************************************************/ + public CmsMediaType(QRecord record) throws QException + { + populateFromQRecord(record); + } + + + + /******************************************************************************* + ** Getter for id + *******************************************************************************/ + public Long getId() + { + return (this.id); + } + + + + /******************************************************************************* + ** Setter for id + *******************************************************************************/ + public void setId(Long id) + { + this.id = id; + } + + + + /******************************************************************************* + ** Fluent setter for id + *******************************************************************************/ + public CmsMediaType withId(Long id) + { + this.id = id; + return (this); + } + + + + /******************************************************************************* + ** Getter for name + *******************************************************************************/ + public String getName() + { + return (this.name); + } + + + + /******************************************************************************* + ** Setter for name + *******************************************************************************/ + public void setName(String name) + { + this.name = name; + } + + + + /******************************************************************************* + ** Fluent setter for name + *******************************************************************************/ + public CmsMediaType withName(String name) + { + this.name = name; + return (this); + } + + + + /******************************************************************************* + ** Getter for code + *******************************************************************************/ + public String getCode() + { + return (this.code); + } + + + + /******************************************************************************* + ** Setter for code + *******************************************************************************/ + public void setCode(String code) + { + this.code = code; + } + + + + /******************************************************************************* + ** Fluent setter for code + *******************************************************************************/ + public CmsMediaType withCode(String code) + { + this.code = code; + return (this); + } + + + + /******************************************************************************* + ** Getter for description + *******************************************************************************/ + public String getDescription() + { + return (this.description); + } + + + + /******************************************************************************* + ** Setter for description + *******************************************************************************/ + public void setDescription(String description) + { + this.description = description; + } + + + + /******************************************************************************* + ** Fluent setter for description + *******************************************************************************/ + public CmsMediaType withDescription(String description) + { + this.description = description; + return (this); + } + + + + /******************************************************************************* + ** Getter for isActive + *******************************************************************************/ + public Boolean getIsActive() + { + return (this.isActive); + } + + + + /******************************************************************************* + ** Setter for isActive + *******************************************************************************/ + public void setIsActive(Boolean isActive) + { + this.isActive = isActive; + } + + + + /******************************************************************************* + ** Fluent setter for isActive + *******************************************************************************/ + public CmsMediaType withIsActive(Boolean isActive) + { + this.isActive = isActive; + return (this); + } + + + + /******************************************************************************* + ** Getter for sortOrder + *******************************************************************************/ + public Integer getSortOrder() + { + return (this.sortOrder); + } + + + + /******************************************************************************* + ** Setter for sortOrder + *******************************************************************************/ + public void setSortOrder(Integer sortOrder) + { + this.sortOrder = sortOrder; + } + + + + /******************************************************************************* + ** Fluent setter for sortOrder + *******************************************************************************/ + public CmsMediaType withSortOrder(Integer sortOrder) + { + this.sortOrder = sortOrder; + return (this); + } + + + + /******************************************************************************* + ** Getter for allowedMimeTypes + *******************************************************************************/ + public String getAllowedMimeTypes() + { + return (this.allowedMimeTypes); + } + + + + /******************************************************************************* + ** Setter for allowedMimeTypes + *******************************************************************************/ + public void setAllowedMimeTypes(String allowedMimeTypes) + { + this.allowedMimeTypes = allowedMimeTypes; + } + + + + /******************************************************************************* + ** Fluent setter for allowedMimeTypes + *******************************************************************************/ + public CmsMediaType withAllowedMimeTypes(String allowedMimeTypes) + { + this.allowedMimeTypes = allowedMimeTypes; + return (this); + } + + + + /******************************************************************************* + ** Getter for allowedExtensions + *******************************************************************************/ + public String getAllowedExtensions() + { + return (this.allowedExtensions); + } + + + + /******************************************************************************* + ** Setter for allowedExtensions + *******************************************************************************/ + public void setAllowedExtensions(String allowedExtensions) + { + this.allowedExtensions = allowedExtensions; + } + + + + /******************************************************************************* + ** Fluent setter for allowedExtensions + *******************************************************************************/ + public CmsMediaType withAllowedExtensions(String allowedExtensions) + { + this.allowedExtensions = allowedExtensions; + return (this); + } + + + + /******************************************************************************* + ** Getter for maxFileSizeMb + *******************************************************************************/ + public Integer getMaxFileSizeMb() + { + return (this.maxFileSizeMb); + } + + + + /******************************************************************************* + ** Setter for maxFileSizeMb + *******************************************************************************/ + public void setMaxFileSizeMb(Integer maxFileSizeMb) + { + this.maxFileSizeMb = maxFileSizeMb; + } + + + + /******************************************************************************* + ** Fluent setter for maxFileSizeMb + *******************************************************************************/ + public CmsMediaType withMaxFileSizeMb(Integer maxFileSizeMb) + { + this.maxFileSizeMb = maxFileSizeMb; + return (this); + } + + + + /******************************************************************************* + ** Getter for thumbnailEnabled + *******************************************************************************/ + public Boolean getThumbnailEnabled() + { + return (this.thumbnailEnabled); + } + + + + /******************************************************************************* + ** Setter for thumbnailEnabled + *******************************************************************************/ + public void setThumbnailEnabled(Boolean thumbnailEnabled) + { + this.thumbnailEnabled = thumbnailEnabled; + } + + + + /******************************************************************************* + ** Fluent setter for thumbnailEnabled + *******************************************************************************/ + public CmsMediaType withThumbnailEnabled(Boolean thumbnailEnabled) + { + this.thumbnailEnabled = thumbnailEnabled; + return (this); + } + + + + /******************************************************************************* + ** Getter for thumbnailWidth + *******************************************************************************/ + public Integer getThumbnailWidth() + { + return (this.thumbnailWidth); + } + + + + /******************************************************************************* + ** Setter for thumbnailWidth + *******************************************************************************/ + public void setThumbnailWidth(Integer thumbnailWidth) + { + this.thumbnailWidth = thumbnailWidth; + } + + + + /******************************************************************************* + ** Fluent setter for thumbnailWidth + *******************************************************************************/ + public CmsMediaType withThumbnailWidth(Integer thumbnailWidth) + { + this.thumbnailWidth = thumbnailWidth; + return (this); + } + + + + /******************************************************************************* + ** Getter for thumbnailFormat + *******************************************************************************/ + public String getThumbnailFormat() + { + return (this.thumbnailFormat); + } + + + + /******************************************************************************* + ** Setter for thumbnailFormat + *******************************************************************************/ + public void setThumbnailFormat(String thumbnailFormat) + { + this.thumbnailFormat = thumbnailFormat; + } + + + + /******************************************************************************* + ** Fluent setter for thumbnailFormat + *******************************************************************************/ + public CmsMediaType withThumbnailFormat(String thumbnailFormat) + { + this.thumbnailFormat = thumbnailFormat; + return (this); + } + + + + /******************************************************************************* + ** Getter for thumbnailQuality + *******************************************************************************/ + public Integer getThumbnailQuality() + { + return (this.thumbnailQuality); + } + + + + /******************************************************************************* + ** Setter for thumbnailQuality + *******************************************************************************/ + public void setThumbnailQuality(Integer thumbnailQuality) + { + this.thumbnailQuality = thumbnailQuality; + } + + + + /******************************************************************************* + ** Fluent setter for thumbnailQuality + *******************************************************************************/ + public CmsMediaType withThumbnailQuality(Integer thumbnailQuality) + { + this.thumbnailQuality = thumbnailQuality; + return (this); + } + + + + /******************************************************************************* + ** Getter for galleryEnabled + *******************************************************************************/ + public Boolean getGalleryEnabled() + { + return (this.galleryEnabled); + } + + + + /******************************************************************************* + ** Setter for galleryEnabled + *******************************************************************************/ + public void setGalleryEnabled(Boolean galleryEnabled) + { + this.galleryEnabled = galleryEnabled; + } + + + + /******************************************************************************* + ** Fluent setter for galleryEnabled + *******************************************************************************/ + public CmsMediaType withGalleryEnabled(Boolean galleryEnabled) + { + this.galleryEnabled = galleryEnabled; + return (this); + } + + + + /******************************************************************************* + ** Getter for galleryWidth + *******************************************************************************/ + public Integer getGalleryWidth() + { + return (this.galleryWidth); + } + + + + /******************************************************************************* + ** Setter for galleryWidth + *******************************************************************************/ + public void setGalleryWidth(Integer galleryWidth) + { + this.galleryWidth = galleryWidth; + } + + + + /******************************************************************************* + ** Fluent setter for galleryWidth + *******************************************************************************/ + public CmsMediaType withGalleryWidth(Integer galleryWidth) + { + this.galleryWidth = galleryWidth; + return (this); + } + + + + /******************************************************************************* + ** Getter for galleryFormat + *******************************************************************************/ + public String getGalleryFormat() + { + return (this.galleryFormat); + } + + + + /******************************************************************************* + ** Setter for galleryFormat + *******************************************************************************/ + public void setGalleryFormat(String galleryFormat) + { + this.galleryFormat = galleryFormat; + } + + + + /******************************************************************************* + ** Fluent setter for galleryFormat + *******************************************************************************/ + public CmsMediaType withGalleryFormat(String galleryFormat) + { + this.galleryFormat = galleryFormat; + return (this); + } + + + + /******************************************************************************* + ** Getter for galleryQuality + *******************************************************************************/ + public Integer getGalleryQuality() + { + return (this.galleryQuality); + } + + + + /******************************************************************************* + ** Setter for galleryQuality + *******************************************************************************/ + public void setGalleryQuality(Integer galleryQuality) + { + this.galleryQuality = galleryQuality; + } + + + + /******************************************************************************* + ** Fluent setter for galleryQuality + *******************************************************************************/ + public CmsMediaType withGalleryQuality(Integer galleryQuality) + { + this.galleryQuality = galleryQuality; + return (this); + } + + + + /******************************************************************************* + ** Getter for slideshowEnabled + *******************************************************************************/ + public Boolean getSlideshowEnabled() + { + return (this.slideshowEnabled); + } + + + + /******************************************************************************* + ** Setter for slideshowEnabled + *******************************************************************************/ + public void setSlideshowEnabled(Boolean slideshowEnabled) + { + this.slideshowEnabled = slideshowEnabled; + } + + + + /******************************************************************************* + ** Fluent setter for slideshowEnabled + *******************************************************************************/ + public CmsMediaType withSlideshowEnabled(Boolean slideshowEnabled) + { + this.slideshowEnabled = slideshowEnabled; + return (this); + } + + + + /******************************************************************************* + ** Getter for slideshowWidth + *******************************************************************************/ + public Integer getSlideshowWidth() + { + return (this.slideshowWidth); + } + + + + /******************************************************************************* + ** Setter for slideshowWidth + *******************************************************************************/ + public void setSlideshowWidth(Integer slideshowWidth) + { + this.slideshowWidth = slideshowWidth; + } + + + + /******************************************************************************* + ** Fluent setter for slideshowWidth + *******************************************************************************/ + public CmsMediaType withSlideshowWidth(Integer slideshowWidth) + { + this.slideshowWidth = slideshowWidth; + return (this); + } + + + + /******************************************************************************* + ** Getter for slideshowFormat + *******************************************************************************/ + public String getSlideshowFormat() + { + return (this.slideshowFormat); + } + + + + /******************************************************************************* + ** Setter for slideshowFormat + *******************************************************************************/ + public void setSlideshowFormat(String slideshowFormat) + { + this.slideshowFormat = slideshowFormat; + } + + + + /******************************************************************************* + ** Fluent setter for slideshowFormat + *******************************************************************************/ + public CmsMediaType withSlideshowFormat(String slideshowFormat) + { + this.slideshowFormat = slideshowFormat; + return (this); + } + + + + /******************************************************************************* + ** Getter for slideshowQuality + *******************************************************************************/ + public Integer getSlideshowQuality() + { + return (this.slideshowQuality); + } + + + + /******************************************************************************* + ** Setter for slideshowQuality + *******************************************************************************/ + public void setSlideshowQuality(Integer slideshowQuality) + { + this.slideshowQuality = slideshowQuality; + } + + + + /******************************************************************************* + ** Fluent setter for slideshowQuality + *******************************************************************************/ + public CmsMediaType withSlideshowQuality(Integer slideshowQuality) + { + this.slideshowQuality = slideshowQuality; + return (this); + } + + + + /******************************************************************************* + ** Getter for stripMetadata + *******************************************************************************/ + public Boolean getStripMetadata() + { + return (this.stripMetadata); + } + + + + /******************************************************************************* + ** Setter for stripMetadata + *******************************************************************************/ + public void setStripMetadata(Boolean stripMetadata) + { + this.stripMetadata = stripMetadata; + } + + + + /******************************************************************************* + ** Fluent setter for stripMetadata + *******************************************************************************/ + public CmsMediaType withStripMetadata(Boolean stripMetadata) + { + this.stripMetadata = stripMetadata; + return (this); + } + + + + /******************************************************************************* + ** Getter for requireAltText + *******************************************************************************/ + public Boolean getRequireAltText() + { + return (this.requireAltText); + } + + + + /******************************************************************************* + ** Setter for requireAltText + *******************************************************************************/ + public void setRequireAltText(Boolean requireAltText) + { + this.requireAltText = requireAltText; + } + + + + /******************************************************************************* + ** Fluent setter for requireAltText + *******************************************************************************/ + public CmsMediaType withRequireAltText(Boolean requireAltText) + { + this.requireAltText = requireAltText; + return (this); + } + + + + /******************************************************************************* + ** Getter for requireCaption + *******************************************************************************/ + public Boolean getRequireCaption() + { + return (this.requireCaption); + } + + + + /******************************************************************************* + ** Setter for requireCaption + *******************************************************************************/ + public void setRequireCaption(Boolean requireCaption) + { + this.requireCaption = requireCaption; + } + + + + /******************************************************************************* + ** Fluent setter for requireCaption + *******************************************************************************/ + public CmsMediaType withRequireCaption(Boolean requireCaption) + { + this.requireCaption = requireCaption; + return (this); + } + + + + /******************************************************************************* + ** Getter for defaultCredit + *******************************************************************************/ + public String getDefaultCredit() + { + return (this.defaultCredit); + } + + + + /******************************************************************************* + ** Setter for defaultCredit + *******************************************************************************/ + public void setDefaultCredit(String defaultCredit) + { + this.defaultCredit = defaultCredit; + } + + + + /******************************************************************************* + ** Fluent setter for defaultCredit + *******************************************************************************/ + public CmsMediaType withDefaultCredit(String defaultCredit) + { + this.defaultCredit = defaultCredit; + return (this); + } + + + + /******************************************************************************* + ** Getter for defaultLicense + *******************************************************************************/ + public String getDefaultLicense() + { + return (this.defaultLicense); + } + + + + /******************************************************************************* + ** Setter for defaultLicense + *******************************************************************************/ + public void setDefaultLicense(String defaultLicense) + { + this.defaultLicense = defaultLicense; + } + + + + /******************************************************************************* + ** Fluent setter for defaultLicense + *******************************************************************************/ + public CmsMediaType withDefaultLicense(String defaultLicense) + { + this.defaultLicense = defaultLicense; + return (this); + } + + + + /******************************************************************************* + ** Getter for cacheClass + *******************************************************************************/ + public String getCacheClass() + { + return (this.cacheClass); + } + + + + /******************************************************************************* + ** Setter for cacheClass + *******************************************************************************/ + public void setCacheClass(String cacheClass) + { + this.cacheClass = cacheClass; + } + + + + /******************************************************************************* + ** Fluent setter for cacheClass + *******************************************************************************/ + public CmsMediaType withCacheClass(String cacheClass) + { + this.cacheClass = cacheClass; + return (this); + } + + + + /******************************************************************************* + ** Getter for storagePrefix + *******************************************************************************/ + public String getStoragePrefix() + { + return (this.storagePrefix); + } + + + + /******************************************************************************* + ** Setter for storagePrefix + *******************************************************************************/ + public void setStoragePrefix(String storagePrefix) + { + this.storagePrefix = storagePrefix; + } + + + + /******************************************************************************* + ** Fluent setter for storagePrefix + *******************************************************************************/ + public CmsMediaType withStoragePrefix(String storagePrefix) + { + this.storagePrefix = storagePrefix; + return (this); + } + + + + /******************************************************************************* + ** Getter for createDate + *******************************************************************************/ + public Instant getCreateDate() + { + return (this.createDate); + } + + + + /******************************************************************************* + ** Setter for createDate + *******************************************************************************/ + public void setCreateDate(Instant createDate) + { + this.createDate = createDate; + } + + + + /******************************************************************************* + ** Fluent setter for createDate + *******************************************************************************/ + public CmsMediaType withCreateDate(Instant createDate) + { + this.createDate = createDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for modifyDate + *******************************************************************************/ + public Instant getModifyDate() + { + return (this.modifyDate); + } + + + + /******************************************************************************* + ** Setter for modifyDate + *******************************************************************************/ + public void setModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + } + + + + /******************************************************************************* + ** Fluent setter for modifyDate + *******************************************************************************/ + public CmsMediaType withModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + return (this); + } + +} diff --git a/src/main/java/com/kingsrook/qbits/cms/metadata/CmsAreas.java b/src/main/java/com/kingsrook/qbits/cms/metadata/CmsAreas.java index 440fecb..0e43739 100644 --- a/src/main/java/com/kingsrook/qbits/cms/metadata/CmsAreas.java +++ b/src/main/java/com/kingsrook/qbits/cms/metadata/CmsAreas.java @@ -67,7 +67,11 @@ public final class CmsAreas private static final List AREAS = List.of( new Area("Sites", "Sites", "language", CmsFeature.CORE, List.of(CmsTables.SITE, CmsTables.REDIRECT), List.of(CmsTables.REDIRECT_TYPE)), new Area("Pages", "Pages", "description", CmsFeature.CORE, List.of(CmsTables.PAGE, CmsTables.SNIPPET), List.of(CmsTables.PAGE_TYPE, CmsTables.PAGE_SECTION_TYPE)), - new Area("Navigation", "Navigation", "menu", CmsFeature.CORE, List.of(CmsTables.MENU), List.of())); + new Area("Navigation", "Navigation", "menu", CmsFeature.CORE, List.of(CmsTables.MENU), List.of()), + new Area("Media", "Media", "perm_media", CmsFeature.MEDIA, List.of(CmsTables.MEDIA), List.of(CmsTables.MEDIA_TYPE)), + new Area("Blogs", "Blogs", "article", CmsFeature.BLOG, List.of(CmsTables.BLOG_POST, CmsTables.BLOG, CmsTables.AUTHOR), List.of(CmsTables.BLOG_TYPE)), + new Area("Projects", "Projects", "code", CmsFeature.PROJECTS, List.of(CmsTables.PROJECT, CmsTables.PROJECT_CATEGORY), List.of()), + new Area("Photos", "Photos", "photo_camera", CmsFeature.PHOTOS, List.of(CmsTables.PHOTO_ALBUM, CmsTables.PHOTO_ALBUM_FOLDER, CmsTables.PHOTO_TAG), List.of())); diff --git a/src/main/java/com/kingsrook/qbits/cms/metadata/CmsTableBuilder.java b/src/main/java/com/kingsrook/qbits/cms/metadata/CmsTableBuilder.java index 6ed7bc0..fc4f69e 100644 --- a/src/main/java/com/kingsrook/qbits/cms/metadata/CmsTableBuilder.java +++ b/src/main/java/com/kingsrook/qbits/cms/metadata/CmsTableBuilder.java @@ -27,6 +27,7 @@ import com.kingsrook.qbits.cms.CmsQBitConfig; import com.kingsrook.qbits.cms.CmsTables; import com.kingsrook.qbits.cms.core.model.CmsRedirectMatchType; import com.kingsrook.qbits.cms.security.CmsOpenReadsPermissionChecker; +import com.kingsrook.qqq.backend.core.actions.customizers.TableCustomizers; import com.kingsrook.qqq.backend.core.actions.dashboard.widgets.ChildRecordListRenderer; import com.kingsrook.qqq.backend.core.exceptions.QException; import com.kingsrook.qqq.backend.core.instances.QInstanceEnricher; @@ -36,8 +37,11 @@ import com.kingsrook.qqq.backend.core.model.metadata.audits.AuditLevel; import com.kingsrook.qqq.backend.core.model.metadata.audits.QAuditRules; import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference; import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaData; +import com.kingsrook.qqq.backend.core.model.metadata.fields.AdornmentType; +import com.kingsrook.qqq.backend.core.model.metadata.fields.FieldAdornment; import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData; import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldType; +import com.kingsrook.qqq.backend.core.model.metadata.help.QHelpContent; import com.kingsrook.qqq.backend.core.model.metadata.joins.JoinOn; import com.kingsrook.qqq.backend.core.model.metadata.joins.JoinType; import com.kingsrook.qqq.backend.core.model.metadata.joins.QJoinMetaData; @@ -57,7 +61,7 @@ import com.kingsrook.qqq.backend.module.rdbms.model.metadata.RDBMSTableBackendDe /******************************************************************************* ** Builds the CMS tables of a config: one standard QQQ table per definition ** (fields from the entity, prefixed names, snake_case columns), a - ** possible-value source per table, joins and child-record lists for child + ** possible-value source per table and per value list, joins and child-record lists for child ** tables, associations, permission rules and field audit. ** ** Every table is a normal, visible QQQ table (owner rule): reference tables @@ -115,6 +119,14 @@ public class CmsTableBuilder tables.put(config.applyPrefix(definition.logicalName()), buildTable(definition, logicals, audit)); pvs.add(QPossibleValueSource.newForTable(config.applyPrefix(definition.logicalName()))); } + for(String valueList : CmsTables.valueListNames()) + { + String name = config.applyPrefix(valueList); + if(tables.values().stream().anyMatch(t -> t.getFields().values().stream().anyMatch(f -> name.equals(f.getPossibleValueSourceName())))) + { + pvs.add(QPossibleValueSource.newForEnum(name, CmsTables.valueList(valueList).orElseThrow())); + } + } if(logicals.contains(CmsTables.REDIRECT)) { pvs.add(QPossibleValueSource.newForEnum(config.applyPrefix(CmsRedirectMatchType.NAME), CmsRedirectMatchType.values())); @@ -154,10 +166,12 @@ public class CmsTableBuilder .withRecordLabelFields(definition.recordLabelFields()) .withPermissionRules(permissionRules()); + boolean valueLists = false; for(QFieldMetaData field : table.getFields().values()) { String pvsName = field.getPossibleValueSourceName(); - if(pvsName != null && logicals.contains(pvsName)) + valueLists |= pvsName != null && CmsTables.valueList(pvsName).isPresent(); + if(pvsName != null && (logicals.contains(pvsName) || CmsTables.valueList(pvsName).isPresent())) { field.setPossibleValueSourceName(config.applyPrefix(pvsName)); } @@ -177,6 +191,19 @@ public class CmsTableBuilder { table.getField("matchType").setPossibleValueSourceName(config.applyPrefix(CmsRedirectMatchType.NAME)); } + if(valueLists) + { + table.withCustomizer(TableCustomizers.PRE_INSERT_RECORD.getRole(), new QCodeReference(CmsValueListCheck.class)); + table.withCustomizer(TableCustomizers.PRE_UPDATE_RECORD.getRole(), new QCodeReference(CmsValueListCheck.class)); + } + for(CmsTableDefinition.Preview preview : definition.previews()) + { + table.getField(preview.field()).withFieldAdornment(previewAdornment(preview)); + } + for(Map.Entry help : definition.helpTexts().entrySet()) + { + table.getField(help.getKey()).withHelpContent(new QHelpContent().withContentAsText(help.getValue())); + } QInstanceEnricher.setInferredFieldBackendNames(table); for(List uniqueKey : definition.uniqueKeys()) @@ -198,6 +225,42 @@ public class CmsTableBuilder + /******************************************************************************* + ** The file preview of a field: one image by its address, or a stored file + ** with a thumbnail and its file facts. + *******************************************************************************/ + static FieldAdornment previewAdornment(CmsTableDefinition.Preview preview) + { + FieldAdornment adornment = AdornmentType.FilePreviewValues.newFieldAdornment(); + if(preview.thumbnailUrlField() == null) + { + adornment.withValue(AdornmentType.FilePreviewValues.DEFAULT_MIME_TYPE, "image/*"); + } + else + { + adornment.withValue(AdornmentType.FilePreviewValues.THUMBNAIL_URL_FIELD, preview.thumbnailUrlField()) + .withValue(AdornmentType.FilePreviewValues.MIME_TYPE_FIELD, "mimeType") + .withValue(AdornmentType.FilePreviewValues.WIDTH_FIELD, "width") + .withValue(AdornmentType.FilePreviewValues.HEIGHT_FIELD, "height") + .withValue(AdornmentType.FilePreviewValues.SIZE_BYTES_FIELD, "fileSize"); + } + if(preview.fileNameField() != null) + { + adornment.withValue(AdornmentType.FilePreviewValues.FILE_NAME_FIELD, preview.fileNameField()); + } + if(preview.altTextField() != null) + { + adornment.withValue(AdornmentType.FilePreviewValues.ALT_TEXT_FIELD, preview.altTextField()); + } + if(preview.captionField() != null) + { + adornment.withValue(AdornmentType.FilePreviewValues.CAPTION_FIELD, preview.captionField()); + } + return (adornment); + } + + + /******************************************************************************* ** Permission rules for every CMS table: the table name plus .read, .insert, ** .edit and .delete; with openReads, reads need nothing. diff --git a/src/main/java/com/kingsrook/qbits/cms/metadata/CmsTableDefinition.java b/src/main/java/com/kingsrook/qbits/cms/metadata/CmsTableDefinition.java index e374cc4..d05c231 100644 --- a/src/main/java/com/kingsrook/qbits/cms/metadata/CmsTableDefinition.java +++ b/src/main/java/com/kingsrook/qbits/cms/metadata/CmsTableDefinition.java @@ -18,8 +18,10 @@ package com.kingsrook.qbits.cms.metadata; import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; import java.util.Locale; +import java.util.Map; import java.util.Set; import com.kingsrook.qbits.cms.CmsFeature; import com.kingsrook.qqq.backend.core.model.data.QRecordEntity; @@ -29,7 +31,8 @@ import com.kingsrook.qqq.backend.core.model.metadata.tables.Tier; /******************************************************************************* ** Everything the builder needs to know about one CMS table beyond its ** entity: label, icon, record label, screen sections, child tables, unique - ** keys and which fields hold long text. + ** keys, which fields hold long text, which show a file preview and the + ** help text of fields. ** ** @param logicalName the unprefixed table name, e.g. "page" ** @param entityClass the entity whose fields the table has @@ -42,10 +45,12 @@ import com.kingsrook.qqq.backend.core.model.metadata.tables.Tier; ** @param children child tables shown as lists on this table's records ** @param uniqueKeys unique keys (field names) ** @param textFields fields stored as TEXT (long, unbounded content) + ** @param previews fields that hold a file's address and show it as a preview + ** @param helpTexts help text by field name *******************************************************************************/ public record CmsTableDefinition(String logicalName, Class entityClass, CmsFeature feature, String label, String icon, Kind kind, List recordLabelFields, List
    sections, List children, - List> uniqueKeys, Set textFields) + List> uniqueKeys, Set textFields, List previews, Map helpTexts) { /******************************************************************************* ** How a table appears in the admin. @@ -94,6 +99,22 @@ public record CmsTableDefinition(String logicalName, Class children = new ArrayList<>(); private final List> uniqueKeys = new ArrayList<>(); private Set textFields = Set.of(); + private final List previews = new ArrayList<>(); + private final Map helpTexts = new LinkedHashMap<>(); @@ -215,13 +242,47 @@ public record CmsTableDefinition(String logicalName, Class preInsertOrUpdate(AbstractActionInput input, List records, boolean isPreview, Optional> oldRecordList) throws QException + { + String tableName = input instanceof InsertInput insert ? insert.getTableName() : input instanceof UpdateInput update ? update.getTableName() : null; + if(tableName == null || records == null) + { + return (records); + } + QTableMetaData table = QContext.getQInstance().getTable(tableName); + for(QFieldMetaData field : table.getFields().values()) + { + QPossibleValueSource source = field.getPossibleValueSourceName() == null ? null : QContext.getQInstance().getPossibleValueSource(field.getPossibleValueSourceName()); + if(source == null || source.getType() != QPossibleValueSourceType.ENUM) + { + continue; + } + Set allowed = source.getEnumValues().stream().map(value -> String.valueOf(value.getId())).collect(Collectors.toSet()); + for(QRecord record : records) + { + Serializable value = record.getValue(field.getName()); + if(value != null && !"".equals(value) && !allowed.contains(String.valueOf(value))) + { + String label = field.getLabel() == null ? field.getName() : field.getLabel(); + record.addError(new BadInputStatusMessage(label + " must be one of: " + allowed.stream().sorted().collect(Collectors.joining(", ")))); + } + } + } + return (records); + } +} diff --git a/src/main/java/com/kingsrook/qbits/cms/photos/model/CmsPhoto.java b/src/main/java/com/kingsrook/qbits/cms/photos/model/CmsPhoto.java new file mode 100644 index 0000000..c75cd01 --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/photos/model/CmsPhoto.java @@ -0,0 +1,1319 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.photos.model; + + +import java.math.BigDecimal; +import java.time.Instant; +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.core.model.data.QField; +import com.kingsrook.qqq.backend.core.model.data.QRecord; +import com.kingsrook.qqq.backend.core.model.data.QRecordEntity; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DisplayFormat; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DynamicDefaultValueBehavior; +import com.kingsrook.qqq.backend.core.model.metadata.fields.ValueTooLongBehavior; + + +/******************************************************************************* + ** A photo in an album: its renditions, file facts, camera data and tags. + ** + ** The physical table name is the configured prefix plus TABLE_NAME (for + ** example cms_photo); possible-value source names on the fields are + ** logical and get the same prefix when the table is built. + *******************************************************************************/ +public class CmsPhoto extends QRecordEntity +{ + public static final String TABLE_NAME = "photo"; + + @QField(isEditable = false, isPrimaryKey = true) + private Long id; + + @QField(isRequired = true, possibleValueSourceName = "photo_album", label = "Album") + private Long photoAlbumId; + + @QField(possibleValueSourceName = "media", label = "Media") + private Long mediaId; + + @QField(isRequired = true, maxLength = 200, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String title; + + @QField(isRequired = true, maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String slug; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String caption; + + @QField(maxLength = 1000, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12) + private String description; + + @QField + private Integer score; + + @QField(isRequired = true, defaultValue = "false") + private Boolean isFavorite; + + @QField(isRequired = true, defaultValue = "false") + private Boolean isAlbumCover; + + @QField(isRequired = true, defaultValue = "0") + private Integer sortOrder; + + @QField(isRequired = true, defaultValue = "false") + private Boolean isPublished; + + @QField + private Instant publishDate; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12, label = "Original URL") + private String originalUrl; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12, label = "Gallery URL") + private String galleryUrl; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12, label = "Slideshow URL") + private String slideshowUrl; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12, label = "Thumbnail URL") + private String thumbnailUrl; + + @QField(isEditable = false, maxLength = 255, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String originalFilename; + + @QField(isEditable = false, maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String storageKey; + + @QField(maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR, label = "MIME type") + private String mimeType; + + @QField(isEditable = false, displayFormat = DisplayFormat.COMMAS) + private Long fileSize; + + @QField(isEditable = false, displayFormat = DisplayFormat.COMMAS) + private Integer width; + + @QField(isEditable = false, displayFormat = DisplayFormat.COMMAS) + private Integer height; + + @QField(label = "Date taken") + private Instant exifDateTaken; + + @QField(maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR, label = "Camera make") + private String exifCameraMake; + + @QField(maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR, label = "Camera model") + private String exifCameraModel; + + @QField(maxLength = 200, valueTooLongBehavior = ValueTooLongBehavior.ERROR, label = "Lens") + private String exifLensModel; + + @QField(maxLength = 20, valueTooLongBehavior = ValueTooLongBehavior.ERROR, label = "Focal length") + private String exifFocalLength; + + @QField(maxLength = 20, valueTooLongBehavior = ValueTooLongBehavior.ERROR, label = "Aperture") + private String exifAperture; + + @QField(maxLength = 20, valueTooLongBehavior = ValueTooLongBehavior.ERROR, label = "Shutter speed") + private String exifShutterSpeed; + + @QField(label = "ISO") + private Integer exifIso; + + @QField(maxLength = 50, valueTooLongBehavior = ValueTooLongBehavior.ERROR, label = "White balance") + private String exifWhiteBalance; + + @QField(maxLength = 50, valueTooLongBehavior = ValueTooLongBehavior.ERROR, label = "Flash") + private String exifFlash; + + @QField(label = "GPS latitude") + private BigDecimal exifGpsLatitude; + + @QField(label = "GPS longitude") + private BigDecimal exifGpsLongitude; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.CREATE_DATE) + private Instant createDate; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.MODIFY_DATE) + private Instant modifyDate; + + + + /******************************************************************************* + ** Default constructor + *******************************************************************************/ + public CmsPhoto() + { + } + + + + /******************************************************************************* + ** Constructor that takes a QRecord + *******************************************************************************/ + public CmsPhoto(QRecord record) throws QException + { + populateFromQRecord(record); + } + + + + /******************************************************************************* + ** Getter for id + *******************************************************************************/ + public Long getId() + { + return (this.id); + } + + + + /******************************************************************************* + ** Setter for id + *******************************************************************************/ + public void setId(Long id) + { + this.id = id; + } + + + + /******************************************************************************* + ** Fluent setter for id + *******************************************************************************/ + public CmsPhoto withId(Long id) + { + this.id = id; + return (this); + } + + + + /******************************************************************************* + ** Getter for photoAlbumId + *******************************************************************************/ + public Long getPhotoAlbumId() + { + return (this.photoAlbumId); + } + + + + /******************************************************************************* + ** Setter for photoAlbumId + *******************************************************************************/ + public void setPhotoAlbumId(Long photoAlbumId) + { + this.photoAlbumId = photoAlbumId; + } + + + + /******************************************************************************* + ** Fluent setter for photoAlbumId + *******************************************************************************/ + public CmsPhoto withPhotoAlbumId(Long photoAlbumId) + { + this.photoAlbumId = photoAlbumId; + return (this); + } + + + + /******************************************************************************* + ** Getter for mediaId + *******************************************************************************/ + public Long getMediaId() + { + return (this.mediaId); + } + + + + /******************************************************************************* + ** Setter for mediaId + *******************************************************************************/ + public void setMediaId(Long mediaId) + { + this.mediaId = mediaId; + } + + + + /******************************************************************************* + ** Fluent setter for mediaId + *******************************************************************************/ + public CmsPhoto withMediaId(Long mediaId) + { + this.mediaId = mediaId; + return (this); + } + + + + /******************************************************************************* + ** Getter for title + *******************************************************************************/ + public String getTitle() + { + return (this.title); + } + + + + /******************************************************************************* + ** Setter for title + *******************************************************************************/ + public void setTitle(String title) + { + this.title = title; + } + + + + /******************************************************************************* + ** Fluent setter for title + *******************************************************************************/ + public CmsPhoto withTitle(String title) + { + this.title = title; + return (this); + } + + + + /******************************************************************************* + ** Getter for slug + *******************************************************************************/ + public String getSlug() + { + return (this.slug); + } + + + + /******************************************************************************* + ** Setter for slug + *******************************************************************************/ + public void setSlug(String slug) + { + this.slug = slug; + } + + + + /******************************************************************************* + ** Fluent setter for slug + *******************************************************************************/ + public CmsPhoto withSlug(String slug) + { + this.slug = slug; + return (this); + } + + + + /******************************************************************************* + ** Getter for caption + *******************************************************************************/ + public String getCaption() + { + return (this.caption); + } + + + + /******************************************************************************* + ** Setter for caption + *******************************************************************************/ + public void setCaption(String caption) + { + this.caption = caption; + } + + + + /******************************************************************************* + ** Fluent setter for caption + *******************************************************************************/ + public CmsPhoto withCaption(String caption) + { + this.caption = caption; + return (this); + } + + + + /******************************************************************************* + ** Getter for description + *******************************************************************************/ + public String getDescription() + { + return (this.description); + } + + + + /******************************************************************************* + ** Setter for description + *******************************************************************************/ + public void setDescription(String description) + { + this.description = description; + } + + + + /******************************************************************************* + ** Fluent setter for description + *******************************************************************************/ + public CmsPhoto withDescription(String description) + { + this.description = description; + return (this); + } + + + + /******************************************************************************* + ** Getter for score + *******************************************************************************/ + public Integer getScore() + { + return (this.score); + } + + + + /******************************************************************************* + ** Setter for score + *******************************************************************************/ + public void setScore(Integer score) + { + this.score = score; + } + + + + /******************************************************************************* + ** Fluent setter for score + *******************************************************************************/ + public CmsPhoto withScore(Integer score) + { + this.score = score; + return (this); + } + + + + /******************************************************************************* + ** Getter for isFavorite + *******************************************************************************/ + public Boolean getIsFavorite() + { + return (this.isFavorite); + } + + + + /******************************************************************************* + ** Setter for isFavorite + *******************************************************************************/ + public void setIsFavorite(Boolean isFavorite) + { + this.isFavorite = isFavorite; + } + + + + /******************************************************************************* + ** Fluent setter for isFavorite + *******************************************************************************/ + public CmsPhoto withIsFavorite(Boolean isFavorite) + { + this.isFavorite = isFavorite; + return (this); + } + + + + /******************************************************************************* + ** Getter for isAlbumCover + *******************************************************************************/ + public Boolean getIsAlbumCover() + { + return (this.isAlbumCover); + } + + + + /******************************************************************************* + ** Setter for isAlbumCover + *******************************************************************************/ + public void setIsAlbumCover(Boolean isAlbumCover) + { + this.isAlbumCover = isAlbumCover; + } + + + + /******************************************************************************* + ** Fluent setter for isAlbumCover + *******************************************************************************/ + public CmsPhoto withIsAlbumCover(Boolean isAlbumCover) + { + this.isAlbumCover = isAlbumCover; + return (this); + } + + + + /******************************************************************************* + ** Getter for sortOrder + *******************************************************************************/ + public Integer getSortOrder() + { + return (this.sortOrder); + } + + + + /******************************************************************************* + ** Setter for sortOrder + *******************************************************************************/ + public void setSortOrder(Integer sortOrder) + { + this.sortOrder = sortOrder; + } + + + + /******************************************************************************* + ** Fluent setter for sortOrder + *******************************************************************************/ + public CmsPhoto withSortOrder(Integer sortOrder) + { + this.sortOrder = sortOrder; + return (this); + } + + + + /******************************************************************************* + ** Getter for isPublished + *******************************************************************************/ + public Boolean getIsPublished() + { + return (this.isPublished); + } + + + + /******************************************************************************* + ** Setter for isPublished + *******************************************************************************/ + public void setIsPublished(Boolean isPublished) + { + this.isPublished = isPublished; + } + + + + /******************************************************************************* + ** Fluent setter for isPublished + *******************************************************************************/ + public CmsPhoto withIsPublished(Boolean isPublished) + { + this.isPublished = isPublished; + return (this); + } + + + + /******************************************************************************* + ** Getter for publishDate + *******************************************************************************/ + public Instant getPublishDate() + { + return (this.publishDate); + } + + + + /******************************************************************************* + ** Setter for publishDate + *******************************************************************************/ + public void setPublishDate(Instant publishDate) + { + this.publishDate = publishDate; + } + + + + /******************************************************************************* + ** Fluent setter for publishDate + *******************************************************************************/ + public CmsPhoto withPublishDate(Instant publishDate) + { + this.publishDate = publishDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for originalUrl + *******************************************************************************/ + public String getOriginalUrl() + { + return (this.originalUrl); + } + + + + /******************************************************************************* + ** Setter for originalUrl + *******************************************************************************/ + public void setOriginalUrl(String originalUrl) + { + this.originalUrl = originalUrl; + } + + + + /******************************************************************************* + ** Fluent setter for originalUrl + *******************************************************************************/ + public CmsPhoto withOriginalUrl(String originalUrl) + { + this.originalUrl = originalUrl; + return (this); + } + + + + /******************************************************************************* + ** Getter for galleryUrl + *******************************************************************************/ + public String getGalleryUrl() + { + return (this.galleryUrl); + } + + + + /******************************************************************************* + ** Setter for galleryUrl + *******************************************************************************/ + public void setGalleryUrl(String galleryUrl) + { + this.galleryUrl = galleryUrl; + } + + + + /******************************************************************************* + ** Fluent setter for galleryUrl + *******************************************************************************/ + public CmsPhoto withGalleryUrl(String galleryUrl) + { + this.galleryUrl = galleryUrl; + return (this); + } + + + + /******************************************************************************* + ** Getter for slideshowUrl + *******************************************************************************/ + public String getSlideshowUrl() + { + return (this.slideshowUrl); + } + + + + /******************************************************************************* + ** Setter for slideshowUrl + *******************************************************************************/ + public void setSlideshowUrl(String slideshowUrl) + { + this.slideshowUrl = slideshowUrl; + } + + + + /******************************************************************************* + ** Fluent setter for slideshowUrl + *******************************************************************************/ + public CmsPhoto withSlideshowUrl(String slideshowUrl) + { + this.slideshowUrl = slideshowUrl; + return (this); + } + + + + /******************************************************************************* + ** Getter for thumbnailUrl + *******************************************************************************/ + public String getThumbnailUrl() + { + return (this.thumbnailUrl); + } + + + + /******************************************************************************* + ** Setter for thumbnailUrl + *******************************************************************************/ + public void setThumbnailUrl(String thumbnailUrl) + { + this.thumbnailUrl = thumbnailUrl; + } + + + + /******************************************************************************* + ** Fluent setter for thumbnailUrl + *******************************************************************************/ + public CmsPhoto withThumbnailUrl(String thumbnailUrl) + { + this.thumbnailUrl = thumbnailUrl; + return (this); + } + + + + /******************************************************************************* + ** Getter for originalFilename + *******************************************************************************/ + public String getOriginalFilename() + { + return (this.originalFilename); + } + + + + /******************************************************************************* + ** Setter for originalFilename + *******************************************************************************/ + public void setOriginalFilename(String originalFilename) + { + this.originalFilename = originalFilename; + } + + + + /******************************************************************************* + ** Fluent setter for originalFilename + *******************************************************************************/ + public CmsPhoto withOriginalFilename(String originalFilename) + { + this.originalFilename = originalFilename; + return (this); + } + + + + /******************************************************************************* + ** Getter for storageKey + *******************************************************************************/ + public String getStorageKey() + { + return (this.storageKey); + } + + + + /******************************************************************************* + ** Setter for storageKey + *******************************************************************************/ + public void setStorageKey(String storageKey) + { + this.storageKey = storageKey; + } + + + + /******************************************************************************* + ** Fluent setter for storageKey + *******************************************************************************/ + public CmsPhoto withStorageKey(String storageKey) + { + this.storageKey = storageKey; + return (this); + } + + + + /******************************************************************************* + ** Getter for mimeType + *******************************************************************************/ + public String getMimeType() + { + return (this.mimeType); + } + + + + /******************************************************************************* + ** Setter for mimeType + *******************************************************************************/ + public void setMimeType(String mimeType) + { + this.mimeType = mimeType; + } + + + + /******************************************************************************* + ** Fluent setter for mimeType + *******************************************************************************/ + public CmsPhoto withMimeType(String mimeType) + { + this.mimeType = mimeType; + return (this); + } + + + + /******************************************************************************* + ** Getter for fileSize + *******************************************************************************/ + public Long getFileSize() + { + return (this.fileSize); + } + + + + /******************************************************************************* + ** Setter for fileSize + *******************************************************************************/ + public void setFileSize(Long fileSize) + { + this.fileSize = fileSize; + } + + + + /******************************************************************************* + ** Fluent setter for fileSize + *******************************************************************************/ + public CmsPhoto withFileSize(Long fileSize) + { + this.fileSize = fileSize; + return (this); + } + + + + /******************************************************************************* + ** Getter for width + *******************************************************************************/ + public Integer getWidth() + { + return (this.width); + } + + + + /******************************************************************************* + ** Setter for width + *******************************************************************************/ + public void setWidth(Integer width) + { + this.width = width; + } + + + + /******************************************************************************* + ** Fluent setter for width + *******************************************************************************/ + public CmsPhoto withWidth(Integer width) + { + this.width = width; + return (this); + } + + + + /******************************************************************************* + ** Getter for height + *******************************************************************************/ + public Integer getHeight() + { + return (this.height); + } + + + + /******************************************************************************* + ** Setter for height + *******************************************************************************/ + public void setHeight(Integer height) + { + this.height = height; + } + + + + /******************************************************************************* + ** Fluent setter for height + *******************************************************************************/ + public CmsPhoto withHeight(Integer height) + { + this.height = height; + return (this); + } + + + + /******************************************************************************* + ** Getter for exifDateTaken + *******************************************************************************/ + public Instant getExifDateTaken() + { + return (this.exifDateTaken); + } + + + + /******************************************************************************* + ** Setter for exifDateTaken + *******************************************************************************/ + public void setExifDateTaken(Instant exifDateTaken) + { + this.exifDateTaken = exifDateTaken; + } + + + + /******************************************************************************* + ** Fluent setter for exifDateTaken + *******************************************************************************/ + public CmsPhoto withExifDateTaken(Instant exifDateTaken) + { + this.exifDateTaken = exifDateTaken; + return (this); + } + + + + /******************************************************************************* + ** Getter for exifCameraMake + *******************************************************************************/ + public String getExifCameraMake() + { + return (this.exifCameraMake); + } + + + + /******************************************************************************* + ** Setter for exifCameraMake + *******************************************************************************/ + public void setExifCameraMake(String exifCameraMake) + { + this.exifCameraMake = exifCameraMake; + } + + + + /******************************************************************************* + ** Fluent setter for exifCameraMake + *******************************************************************************/ + public CmsPhoto withExifCameraMake(String exifCameraMake) + { + this.exifCameraMake = exifCameraMake; + return (this); + } + + + + /******************************************************************************* + ** Getter for exifCameraModel + *******************************************************************************/ + public String getExifCameraModel() + { + return (this.exifCameraModel); + } + + + + /******************************************************************************* + ** Setter for exifCameraModel + *******************************************************************************/ + public void setExifCameraModel(String exifCameraModel) + { + this.exifCameraModel = exifCameraModel; + } + + + + /******************************************************************************* + ** Fluent setter for exifCameraModel + *******************************************************************************/ + public CmsPhoto withExifCameraModel(String exifCameraModel) + { + this.exifCameraModel = exifCameraModel; + return (this); + } + + + + /******************************************************************************* + ** Getter for exifLensModel + *******************************************************************************/ + public String getExifLensModel() + { + return (this.exifLensModel); + } + + + + /******************************************************************************* + ** Setter for exifLensModel + *******************************************************************************/ + public void setExifLensModel(String exifLensModel) + { + this.exifLensModel = exifLensModel; + } + + + + /******************************************************************************* + ** Fluent setter for exifLensModel + *******************************************************************************/ + public CmsPhoto withExifLensModel(String exifLensModel) + { + this.exifLensModel = exifLensModel; + return (this); + } + + + + /******************************************************************************* + ** Getter for exifFocalLength + *******************************************************************************/ + public String getExifFocalLength() + { + return (this.exifFocalLength); + } + + + + /******************************************************************************* + ** Setter for exifFocalLength + *******************************************************************************/ + public void setExifFocalLength(String exifFocalLength) + { + this.exifFocalLength = exifFocalLength; + } + + + + /******************************************************************************* + ** Fluent setter for exifFocalLength + *******************************************************************************/ + public CmsPhoto withExifFocalLength(String exifFocalLength) + { + this.exifFocalLength = exifFocalLength; + return (this); + } + + + + /******************************************************************************* + ** Getter for exifAperture + *******************************************************************************/ + public String getExifAperture() + { + return (this.exifAperture); + } + + + + /******************************************************************************* + ** Setter for exifAperture + *******************************************************************************/ + public void setExifAperture(String exifAperture) + { + this.exifAperture = exifAperture; + } + + + + /******************************************************************************* + ** Fluent setter for exifAperture + *******************************************************************************/ + public CmsPhoto withExifAperture(String exifAperture) + { + this.exifAperture = exifAperture; + return (this); + } + + + + /******************************************************************************* + ** Getter for exifShutterSpeed + *******************************************************************************/ + public String getExifShutterSpeed() + { + return (this.exifShutterSpeed); + } + + + + /******************************************************************************* + ** Setter for exifShutterSpeed + *******************************************************************************/ + public void setExifShutterSpeed(String exifShutterSpeed) + { + this.exifShutterSpeed = exifShutterSpeed; + } + + + + /******************************************************************************* + ** Fluent setter for exifShutterSpeed + *******************************************************************************/ + public CmsPhoto withExifShutterSpeed(String exifShutterSpeed) + { + this.exifShutterSpeed = exifShutterSpeed; + return (this); + } + + + + /******************************************************************************* + ** Getter for exifIso + *******************************************************************************/ + public Integer getExifIso() + { + return (this.exifIso); + } + + + + /******************************************************************************* + ** Setter for exifIso + *******************************************************************************/ + public void setExifIso(Integer exifIso) + { + this.exifIso = exifIso; + } + + + + /******************************************************************************* + ** Fluent setter for exifIso + *******************************************************************************/ + public CmsPhoto withExifIso(Integer exifIso) + { + this.exifIso = exifIso; + return (this); + } + + + + /******************************************************************************* + ** Getter for exifWhiteBalance + *******************************************************************************/ + public String getExifWhiteBalance() + { + return (this.exifWhiteBalance); + } + + + + /******************************************************************************* + ** Setter for exifWhiteBalance + *******************************************************************************/ + public void setExifWhiteBalance(String exifWhiteBalance) + { + this.exifWhiteBalance = exifWhiteBalance; + } + + + + /******************************************************************************* + ** Fluent setter for exifWhiteBalance + *******************************************************************************/ + public CmsPhoto withExifWhiteBalance(String exifWhiteBalance) + { + this.exifWhiteBalance = exifWhiteBalance; + return (this); + } + + + + /******************************************************************************* + ** Getter for exifFlash + *******************************************************************************/ + public String getExifFlash() + { + return (this.exifFlash); + } + + + + /******************************************************************************* + ** Setter for exifFlash + *******************************************************************************/ + public void setExifFlash(String exifFlash) + { + this.exifFlash = exifFlash; + } + + + + /******************************************************************************* + ** Fluent setter for exifFlash + *******************************************************************************/ + public CmsPhoto withExifFlash(String exifFlash) + { + this.exifFlash = exifFlash; + return (this); + } + + + + /******************************************************************************* + ** Getter for exifGpsLatitude + *******************************************************************************/ + public BigDecimal getExifGpsLatitude() + { + return (this.exifGpsLatitude); + } + + + + /******************************************************************************* + ** Setter for exifGpsLatitude + *******************************************************************************/ + public void setExifGpsLatitude(BigDecimal exifGpsLatitude) + { + this.exifGpsLatitude = exifGpsLatitude; + } + + + + /******************************************************************************* + ** Fluent setter for exifGpsLatitude + *******************************************************************************/ + public CmsPhoto withExifGpsLatitude(BigDecimal exifGpsLatitude) + { + this.exifGpsLatitude = exifGpsLatitude; + return (this); + } + + + + /******************************************************************************* + ** Getter for exifGpsLongitude + *******************************************************************************/ + public BigDecimal getExifGpsLongitude() + { + return (this.exifGpsLongitude); + } + + + + /******************************************************************************* + ** Setter for exifGpsLongitude + *******************************************************************************/ + public void setExifGpsLongitude(BigDecimal exifGpsLongitude) + { + this.exifGpsLongitude = exifGpsLongitude; + } + + + + /******************************************************************************* + ** Fluent setter for exifGpsLongitude + *******************************************************************************/ + public CmsPhoto withExifGpsLongitude(BigDecimal exifGpsLongitude) + { + this.exifGpsLongitude = exifGpsLongitude; + return (this); + } + + + + /******************************************************************************* + ** Getter for createDate + *******************************************************************************/ + public Instant getCreateDate() + { + return (this.createDate); + } + + + + /******************************************************************************* + ** Setter for createDate + *******************************************************************************/ + public void setCreateDate(Instant createDate) + { + this.createDate = createDate; + } + + + + /******************************************************************************* + ** Fluent setter for createDate + *******************************************************************************/ + public CmsPhoto withCreateDate(Instant createDate) + { + this.createDate = createDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for modifyDate + *******************************************************************************/ + public Instant getModifyDate() + { + return (this.modifyDate); + } + + + + /******************************************************************************* + ** Setter for modifyDate + *******************************************************************************/ + public void setModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + } + + + + /******************************************************************************* + ** Fluent setter for modifyDate + *******************************************************************************/ + public CmsPhoto withModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + return (this); + } + +} diff --git a/src/main/java/com/kingsrook/qbits/cms/photos/model/CmsPhotoAlbum.java b/src/main/java/com/kingsrook/qbits/cms/photos/model/CmsPhotoAlbum.java new file mode 100644 index 0000000..ccedb80 --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/photos/model/CmsPhotoAlbum.java @@ -0,0 +1,979 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.photos.model; + + +import java.math.BigDecimal; +import java.time.Instant; +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.core.model.data.QField; +import com.kingsrook.qqq.backend.core.model.data.QRecord; +import com.kingsrook.qqq.backend.core.model.data.QRecordEntity; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DynamicDefaultValueBehavior; +import com.kingsrook.qqq.backend.core.model.metadata.fields.ValueTooLongBehavior; + + +/******************************************************************************* + ** An album of photos of a site, optionally in a folder and optionally + ** belonging to a project or a project update. + ** + ** The physical table name is the configured prefix plus TABLE_NAME (for + ** example cms_photo_album); possible-value source names on the fields are + ** logical and get the same prefix when the table is built. + *******************************************************************************/ +public class CmsPhotoAlbum extends QRecordEntity +{ + public static final String TABLE_NAME = "photo_album"; + + @QField(isEditable = false, isPrimaryKey = true) + private Long id; + + @QField(isRequired = true, possibleValueSourceName = "site", label = "Site") + private Long siteId; + + @QField(possibleValueSourceName = "photo_album_folder", label = "Folder") + private Long photoAlbumFolderId; + + @QField(possibleValueSourceName = "project", label = "Project") + private Long projectId; + + @QField(possibleValueSourceName = "project_update", label = "Project Update") + private Long projectUpdateId; + + @QField(isRequired = true, maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String name; + + @QField(isRequired = true, maxLength = 40, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String shortName; + + @QField(isRequired = true, maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String slug; + + @QField(maxLength = 200, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String title; + + @QField(maxLength = 1000, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12) + private String description; + + @QField(possibleValueSourceName = "photo", label = "Cover Photo") + private Long coverPhotoId; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12, label = "Cover Image URL") + private String coverImageUrl; + + @QField(isRequired = true, defaultValue = "false") + private Boolean isPublished; + + @QField + private Instant publishDate; + + @QField(isRequired = true, defaultValue = "0") + private Integer sortOrder; + + @QField(maxLength = 200, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String location; + + @QField(label = "Latitude") + private BigDecimal locationLatitude; + + @QField(label = "Longitude") + private BigDecimal locationLongitude; + + @QField + private Instant albumDate; + + @QField + private Instant albumEndDate; + + @QField(maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String primaryCamera; + + @QField(maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String primaryLens; + + @QField(maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String weather; + + @QField(maxLength = 255, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String metaTitle; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String metaDescription; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.CREATE_DATE) + private Instant createDate; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.MODIFY_DATE) + private Instant modifyDate; + + + + /******************************************************************************* + ** Default constructor + *******************************************************************************/ + public CmsPhotoAlbum() + { + } + + + + /******************************************************************************* + ** Constructor that takes a QRecord + *******************************************************************************/ + public CmsPhotoAlbum(QRecord record) throws QException + { + populateFromQRecord(record); + } + + + + /******************************************************************************* + ** Getter for id + *******************************************************************************/ + public Long getId() + { + return (this.id); + } + + + + /******************************************************************************* + ** Setter for id + *******************************************************************************/ + public void setId(Long id) + { + this.id = id; + } + + + + /******************************************************************************* + ** Fluent setter for id + *******************************************************************************/ + public CmsPhotoAlbum withId(Long id) + { + this.id = id; + return (this); + } + + + + /******************************************************************************* + ** Getter for siteId + *******************************************************************************/ + public Long getSiteId() + { + return (this.siteId); + } + + + + /******************************************************************************* + ** Setter for siteId + *******************************************************************************/ + public void setSiteId(Long siteId) + { + this.siteId = siteId; + } + + + + /******************************************************************************* + ** Fluent setter for siteId + *******************************************************************************/ + public CmsPhotoAlbum withSiteId(Long siteId) + { + this.siteId = siteId; + return (this); + } + + + + /******************************************************************************* + ** Getter for photoAlbumFolderId + *******************************************************************************/ + public Long getPhotoAlbumFolderId() + { + return (this.photoAlbumFolderId); + } + + + + /******************************************************************************* + ** Setter for photoAlbumFolderId + *******************************************************************************/ + public void setPhotoAlbumFolderId(Long photoAlbumFolderId) + { + this.photoAlbumFolderId = photoAlbumFolderId; + } + + + + /******************************************************************************* + ** Fluent setter for photoAlbumFolderId + *******************************************************************************/ + public CmsPhotoAlbum withPhotoAlbumFolderId(Long photoAlbumFolderId) + { + this.photoAlbumFolderId = photoAlbumFolderId; + return (this); + } + + + + /******************************************************************************* + ** Getter for projectId + *******************************************************************************/ + public Long getProjectId() + { + return (this.projectId); + } + + + + /******************************************************************************* + ** Setter for projectId + *******************************************************************************/ + public void setProjectId(Long projectId) + { + this.projectId = projectId; + } + + + + /******************************************************************************* + ** Fluent setter for projectId + *******************************************************************************/ + public CmsPhotoAlbum withProjectId(Long projectId) + { + this.projectId = projectId; + return (this); + } + + + + /******************************************************************************* + ** Getter for projectUpdateId + *******************************************************************************/ + public Long getProjectUpdateId() + { + return (this.projectUpdateId); + } + + + + /******************************************************************************* + ** Setter for projectUpdateId + *******************************************************************************/ + public void setProjectUpdateId(Long projectUpdateId) + { + this.projectUpdateId = projectUpdateId; + } + + + + /******************************************************************************* + ** Fluent setter for projectUpdateId + *******************************************************************************/ + public CmsPhotoAlbum withProjectUpdateId(Long projectUpdateId) + { + this.projectUpdateId = projectUpdateId; + return (this); + } + + + + /******************************************************************************* + ** Getter for name + *******************************************************************************/ + public String getName() + { + return (this.name); + } + + + + /******************************************************************************* + ** Setter for name + *******************************************************************************/ + public void setName(String name) + { + this.name = name; + } + + + + /******************************************************************************* + ** Fluent setter for name + *******************************************************************************/ + public CmsPhotoAlbum withName(String name) + { + this.name = name; + return (this); + } + + + + /******************************************************************************* + ** Getter for shortName + *******************************************************************************/ + public String getShortName() + { + return (this.shortName); + } + + + + /******************************************************************************* + ** Setter for shortName + *******************************************************************************/ + public void setShortName(String shortName) + { + this.shortName = shortName; + } + + + + /******************************************************************************* + ** Fluent setter for shortName + *******************************************************************************/ + public CmsPhotoAlbum withShortName(String shortName) + { + this.shortName = shortName; + return (this); + } + + + + /******************************************************************************* + ** Getter for slug + *******************************************************************************/ + public String getSlug() + { + return (this.slug); + } + + + + /******************************************************************************* + ** Setter for slug + *******************************************************************************/ + public void setSlug(String slug) + { + this.slug = slug; + } + + + + /******************************************************************************* + ** Fluent setter for slug + *******************************************************************************/ + public CmsPhotoAlbum withSlug(String slug) + { + this.slug = slug; + return (this); + } + + + + /******************************************************************************* + ** Getter for title + *******************************************************************************/ + public String getTitle() + { + return (this.title); + } + + + + /******************************************************************************* + ** Setter for title + *******************************************************************************/ + public void setTitle(String title) + { + this.title = title; + } + + + + /******************************************************************************* + ** Fluent setter for title + *******************************************************************************/ + public CmsPhotoAlbum withTitle(String title) + { + this.title = title; + return (this); + } + + + + /******************************************************************************* + ** Getter for description + *******************************************************************************/ + public String getDescription() + { + return (this.description); + } + + + + /******************************************************************************* + ** Setter for description + *******************************************************************************/ + public void setDescription(String description) + { + this.description = description; + } + + + + /******************************************************************************* + ** Fluent setter for description + *******************************************************************************/ + public CmsPhotoAlbum withDescription(String description) + { + this.description = description; + return (this); + } + + + + /******************************************************************************* + ** Getter for coverPhotoId + *******************************************************************************/ + public Long getCoverPhotoId() + { + return (this.coverPhotoId); + } + + + + /******************************************************************************* + ** Setter for coverPhotoId + *******************************************************************************/ + public void setCoverPhotoId(Long coverPhotoId) + { + this.coverPhotoId = coverPhotoId; + } + + + + /******************************************************************************* + ** Fluent setter for coverPhotoId + *******************************************************************************/ + public CmsPhotoAlbum withCoverPhotoId(Long coverPhotoId) + { + this.coverPhotoId = coverPhotoId; + return (this); + } + + + + /******************************************************************************* + ** Getter for coverImageUrl + *******************************************************************************/ + public String getCoverImageUrl() + { + return (this.coverImageUrl); + } + + + + /******************************************************************************* + ** Setter for coverImageUrl + *******************************************************************************/ + public void setCoverImageUrl(String coverImageUrl) + { + this.coverImageUrl = coverImageUrl; + } + + + + /******************************************************************************* + ** Fluent setter for coverImageUrl + *******************************************************************************/ + public CmsPhotoAlbum withCoverImageUrl(String coverImageUrl) + { + this.coverImageUrl = coverImageUrl; + return (this); + } + + + + /******************************************************************************* + ** Getter for isPublished + *******************************************************************************/ + public Boolean getIsPublished() + { + return (this.isPublished); + } + + + + /******************************************************************************* + ** Setter for isPublished + *******************************************************************************/ + public void setIsPublished(Boolean isPublished) + { + this.isPublished = isPublished; + } + + + + /******************************************************************************* + ** Fluent setter for isPublished + *******************************************************************************/ + public CmsPhotoAlbum withIsPublished(Boolean isPublished) + { + this.isPublished = isPublished; + return (this); + } + + + + /******************************************************************************* + ** Getter for publishDate + *******************************************************************************/ + public Instant getPublishDate() + { + return (this.publishDate); + } + + + + /******************************************************************************* + ** Setter for publishDate + *******************************************************************************/ + public void setPublishDate(Instant publishDate) + { + this.publishDate = publishDate; + } + + + + /******************************************************************************* + ** Fluent setter for publishDate + *******************************************************************************/ + public CmsPhotoAlbum withPublishDate(Instant publishDate) + { + this.publishDate = publishDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for sortOrder + *******************************************************************************/ + public Integer getSortOrder() + { + return (this.sortOrder); + } + + + + /******************************************************************************* + ** Setter for sortOrder + *******************************************************************************/ + public void setSortOrder(Integer sortOrder) + { + this.sortOrder = sortOrder; + } + + + + /******************************************************************************* + ** Fluent setter for sortOrder + *******************************************************************************/ + public CmsPhotoAlbum withSortOrder(Integer sortOrder) + { + this.sortOrder = sortOrder; + return (this); + } + + + + /******************************************************************************* + ** Getter for location + *******************************************************************************/ + public String getLocation() + { + return (this.location); + } + + + + /******************************************************************************* + ** Setter for location + *******************************************************************************/ + public void setLocation(String location) + { + this.location = location; + } + + + + /******************************************************************************* + ** Fluent setter for location + *******************************************************************************/ + public CmsPhotoAlbum withLocation(String location) + { + this.location = location; + return (this); + } + + + + /******************************************************************************* + ** Getter for locationLatitude + *******************************************************************************/ + public BigDecimal getLocationLatitude() + { + return (this.locationLatitude); + } + + + + /******************************************************************************* + ** Setter for locationLatitude + *******************************************************************************/ + public void setLocationLatitude(BigDecimal locationLatitude) + { + this.locationLatitude = locationLatitude; + } + + + + /******************************************************************************* + ** Fluent setter for locationLatitude + *******************************************************************************/ + public CmsPhotoAlbum withLocationLatitude(BigDecimal locationLatitude) + { + this.locationLatitude = locationLatitude; + return (this); + } + + + + /******************************************************************************* + ** Getter for locationLongitude + *******************************************************************************/ + public BigDecimal getLocationLongitude() + { + return (this.locationLongitude); + } + + + + /******************************************************************************* + ** Setter for locationLongitude + *******************************************************************************/ + public void setLocationLongitude(BigDecimal locationLongitude) + { + this.locationLongitude = locationLongitude; + } + + + + /******************************************************************************* + ** Fluent setter for locationLongitude + *******************************************************************************/ + public CmsPhotoAlbum withLocationLongitude(BigDecimal locationLongitude) + { + this.locationLongitude = locationLongitude; + return (this); + } + + + + /******************************************************************************* + ** Getter for albumDate + *******************************************************************************/ + public Instant getAlbumDate() + { + return (this.albumDate); + } + + + + /******************************************************************************* + ** Setter for albumDate + *******************************************************************************/ + public void setAlbumDate(Instant albumDate) + { + this.albumDate = albumDate; + } + + + + /******************************************************************************* + ** Fluent setter for albumDate + *******************************************************************************/ + public CmsPhotoAlbum withAlbumDate(Instant albumDate) + { + this.albumDate = albumDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for albumEndDate + *******************************************************************************/ + public Instant getAlbumEndDate() + { + return (this.albumEndDate); + } + + + + /******************************************************************************* + ** Setter for albumEndDate + *******************************************************************************/ + public void setAlbumEndDate(Instant albumEndDate) + { + this.albumEndDate = albumEndDate; + } + + + + /******************************************************************************* + ** Fluent setter for albumEndDate + *******************************************************************************/ + public CmsPhotoAlbum withAlbumEndDate(Instant albumEndDate) + { + this.albumEndDate = albumEndDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for primaryCamera + *******************************************************************************/ + public String getPrimaryCamera() + { + return (this.primaryCamera); + } + + + + /******************************************************************************* + ** Setter for primaryCamera + *******************************************************************************/ + public void setPrimaryCamera(String primaryCamera) + { + this.primaryCamera = primaryCamera; + } + + + + /******************************************************************************* + ** Fluent setter for primaryCamera + *******************************************************************************/ + public CmsPhotoAlbum withPrimaryCamera(String primaryCamera) + { + this.primaryCamera = primaryCamera; + return (this); + } + + + + /******************************************************************************* + ** Getter for primaryLens + *******************************************************************************/ + public String getPrimaryLens() + { + return (this.primaryLens); + } + + + + /******************************************************************************* + ** Setter for primaryLens + *******************************************************************************/ + public void setPrimaryLens(String primaryLens) + { + this.primaryLens = primaryLens; + } + + + + /******************************************************************************* + ** Fluent setter for primaryLens + *******************************************************************************/ + public CmsPhotoAlbum withPrimaryLens(String primaryLens) + { + this.primaryLens = primaryLens; + return (this); + } + + + + /******************************************************************************* + ** Getter for weather + *******************************************************************************/ + public String getWeather() + { + return (this.weather); + } + + + + /******************************************************************************* + ** Setter for weather + *******************************************************************************/ + public void setWeather(String weather) + { + this.weather = weather; + } + + + + /******************************************************************************* + ** Fluent setter for weather + *******************************************************************************/ + public CmsPhotoAlbum withWeather(String weather) + { + this.weather = weather; + return (this); + } + + + + /******************************************************************************* + ** Getter for metaTitle + *******************************************************************************/ + public String getMetaTitle() + { + return (this.metaTitle); + } + + + + /******************************************************************************* + ** Setter for metaTitle + *******************************************************************************/ + public void setMetaTitle(String metaTitle) + { + this.metaTitle = metaTitle; + } + + + + /******************************************************************************* + ** Fluent setter for metaTitle + *******************************************************************************/ + public CmsPhotoAlbum withMetaTitle(String metaTitle) + { + this.metaTitle = metaTitle; + return (this); + } + + + + /******************************************************************************* + ** Getter for metaDescription + *******************************************************************************/ + public String getMetaDescription() + { + return (this.metaDescription); + } + + + + /******************************************************************************* + ** Setter for metaDescription + *******************************************************************************/ + public void setMetaDescription(String metaDescription) + { + this.metaDescription = metaDescription; + } + + + + /******************************************************************************* + ** Fluent setter for metaDescription + *******************************************************************************/ + public CmsPhotoAlbum withMetaDescription(String metaDescription) + { + this.metaDescription = metaDescription; + return (this); + } + + + + /******************************************************************************* + ** Getter for createDate + *******************************************************************************/ + public Instant getCreateDate() + { + return (this.createDate); + } + + + + /******************************************************************************* + ** Setter for createDate + *******************************************************************************/ + public void setCreateDate(Instant createDate) + { + this.createDate = createDate; + } + + + + /******************************************************************************* + ** Fluent setter for createDate + *******************************************************************************/ + public CmsPhotoAlbum withCreateDate(Instant createDate) + { + this.createDate = createDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for modifyDate + *******************************************************************************/ + public Instant getModifyDate() + { + return (this.modifyDate); + } + + + + /******************************************************************************* + ** Setter for modifyDate + *******************************************************************************/ + public void setModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + } + + + + /******************************************************************************* + ** Fluent setter for modifyDate + *******************************************************************************/ + public CmsPhotoAlbum withModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + return (this); + } + +} diff --git a/src/main/java/com/kingsrook/qbits/cms/photos/model/CmsPhotoAlbumFolder.java b/src/main/java/com/kingsrook/qbits/cms/photos/model/CmsPhotoAlbumFolder.java new file mode 100644 index 0000000..3c5eb38 --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/photos/model/CmsPhotoAlbumFolder.java @@ -0,0 +1,501 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.photos.model; + + +import java.time.Instant; +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.core.model.data.QField; +import com.kingsrook.qqq.backend.core.model.data.QRecord; +import com.kingsrook.qqq.backend.core.model.data.QRecordEntity; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DynamicDefaultValueBehavior; +import com.kingsrook.qqq.backend.core.model.metadata.fields.ValueTooLongBehavior; + + +/******************************************************************************* + ** A folder of photo albums of a site; folders nest. + ** + ** The physical table name is the configured prefix plus TABLE_NAME (for + ** example cms_photo_album_folder); possible-value source names on the fields are + ** logical and get the same prefix when the table is built. + *******************************************************************************/ +public class CmsPhotoAlbumFolder extends QRecordEntity +{ + public static final String TABLE_NAME = "photo_album_folder"; + + @QField(isEditable = false, isPrimaryKey = true) + private Long id; + + @QField(isRequired = true, possibleValueSourceName = "site", label = "Site") + private Long siteId; + + @QField(possibleValueSourceName = "photo_album_folder", label = "Parent Folder") + private Long parentId; + + @QField(isRequired = true, maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String name; + + @QField(isRequired = true, maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String slug; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12) + private String description; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12, label = "Folder Image URL") + private String folderImageUrl; + + @QField(isRequired = true, defaultValue = "false") + private Boolean isPublished; + + @QField(isRequired = true, defaultValue = "0") + private Integer sortOrder; + + @QField(maxLength = 255, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String metaTitle; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String metaDescription; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.CREATE_DATE) + private Instant createDate; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.MODIFY_DATE) + private Instant modifyDate; + + + + /******************************************************************************* + ** Default constructor + *******************************************************************************/ + public CmsPhotoAlbumFolder() + { + } + + + + /******************************************************************************* + ** Constructor that takes a QRecord + *******************************************************************************/ + public CmsPhotoAlbumFolder(QRecord record) throws QException + { + populateFromQRecord(record); + } + + + + /******************************************************************************* + ** Getter for id + *******************************************************************************/ + public Long getId() + { + return (this.id); + } + + + + /******************************************************************************* + ** Setter for id + *******************************************************************************/ + public void setId(Long id) + { + this.id = id; + } + + + + /******************************************************************************* + ** Fluent setter for id + *******************************************************************************/ + public CmsPhotoAlbumFolder withId(Long id) + { + this.id = id; + return (this); + } + + + + /******************************************************************************* + ** Getter for siteId + *******************************************************************************/ + public Long getSiteId() + { + return (this.siteId); + } + + + + /******************************************************************************* + ** Setter for siteId + *******************************************************************************/ + public void setSiteId(Long siteId) + { + this.siteId = siteId; + } + + + + /******************************************************************************* + ** Fluent setter for siteId + *******************************************************************************/ + public CmsPhotoAlbumFolder withSiteId(Long siteId) + { + this.siteId = siteId; + return (this); + } + + + + /******************************************************************************* + ** Getter for parentId + *******************************************************************************/ + public Long getParentId() + { + return (this.parentId); + } + + + + /******************************************************************************* + ** Setter for parentId + *******************************************************************************/ + public void setParentId(Long parentId) + { + this.parentId = parentId; + } + + + + /******************************************************************************* + ** Fluent setter for parentId + *******************************************************************************/ + public CmsPhotoAlbumFolder withParentId(Long parentId) + { + this.parentId = parentId; + return (this); + } + + + + /******************************************************************************* + ** Getter for name + *******************************************************************************/ + public String getName() + { + return (this.name); + } + + + + /******************************************************************************* + ** Setter for name + *******************************************************************************/ + public void setName(String name) + { + this.name = name; + } + + + + /******************************************************************************* + ** Fluent setter for name + *******************************************************************************/ + public CmsPhotoAlbumFolder withName(String name) + { + this.name = name; + return (this); + } + + + + /******************************************************************************* + ** Getter for slug + *******************************************************************************/ + public String getSlug() + { + return (this.slug); + } + + + + /******************************************************************************* + ** Setter for slug + *******************************************************************************/ + public void setSlug(String slug) + { + this.slug = slug; + } + + + + /******************************************************************************* + ** Fluent setter for slug + *******************************************************************************/ + public CmsPhotoAlbumFolder withSlug(String slug) + { + this.slug = slug; + return (this); + } + + + + /******************************************************************************* + ** Getter for description + *******************************************************************************/ + public String getDescription() + { + return (this.description); + } + + + + /******************************************************************************* + ** Setter for description + *******************************************************************************/ + public void setDescription(String description) + { + this.description = description; + } + + + + /******************************************************************************* + ** Fluent setter for description + *******************************************************************************/ + public CmsPhotoAlbumFolder withDescription(String description) + { + this.description = description; + return (this); + } + + + + /******************************************************************************* + ** Getter for folderImageUrl + *******************************************************************************/ + public String getFolderImageUrl() + { + return (this.folderImageUrl); + } + + + + /******************************************************************************* + ** Setter for folderImageUrl + *******************************************************************************/ + public void setFolderImageUrl(String folderImageUrl) + { + this.folderImageUrl = folderImageUrl; + } + + + + /******************************************************************************* + ** Fluent setter for folderImageUrl + *******************************************************************************/ + public CmsPhotoAlbumFolder withFolderImageUrl(String folderImageUrl) + { + this.folderImageUrl = folderImageUrl; + return (this); + } + + + + /******************************************************************************* + ** Getter for isPublished + *******************************************************************************/ + public Boolean getIsPublished() + { + return (this.isPublished); + } + + + + /******************************************************************************* + ** Setter for isPublished + *******************************************************************************/ + public void setIsPublished(Boolean isPublished) + { + this.isPublished = isPublished; + } + + + + /******************************************************************************* + ** Fluent setter for isPublished + *******************************************************************************/ + public CmsPhotoAlbumFolder withIsPublished(Boolean isPublished) + { + this.isPublished = isPublished; + return (this); + } + + + + /******************************************************************************* + ** Getter for sortOrder + *******************************************************************************/ + public Integer getSortOrder() + { + return (this.sortOrder); + } + + + + /******************************************************************************* + ** Setter for sortOrder + *******************************************************************************/ + public void setSortOrder(Integer sortOrder) + { + this.sortOrder = sortOrder; + } + + + + /******************************************************************************* + ** Fluent setter for sortOrder + *******************************************************************************/ + public CmsPhotoAlbumFolder withSortOrder(Integer sortOrder) + { + this.sortOrder = sortOrder; + return (this); + } + + + + /******************************************************************************* + ** Getter for metaTitle + *******************************************************************************/ + public String getMetaTitle() + { + return (this.metaTitle); + } + + + + /******************************************************************************* + ** Setter for metaTitle + *******************************************************************************/ + public void setMetaTitle(String metaTitle) + { + this.metaTitle = metaTitle; + } + + + + /******************************************************************************* + ** Fluent setter for metaTitle + *******************************************************************************/ + public CmsPhotoAlbumFolder withMetaTitle(String metaTitle) + { + this.metaTitle = metaTitle; + return (this); + } + + + + /******************************************************************************* + ** Getter for metaDescription + *******************************************************************************/ + public String getMetaDescription() + { + return (this.metaDescription); + } + + + + /******************************************************************************* + ** Setter for metaDescription + *******************************************************************************/ + public void setMetaDescription(String metaDescription) + { + this.metaDescription = metaDescription; + } + + + + /******************************************************************************* + ** Fluent setter for metaDescription + *******************************************************************************/ + public CmsPhotoAlbumFolder withMetaDescription(String metaDescription) + { + this.metaDescription = metaDescription; + return (this); + } + + + + /******************************************************************************* + ** Getter for createDate + *******************************************************************************/ + public Instant getCreateDate() + { + return (this.createDate); + } + + + + /******************************************************************************* + ** Setter for createDate + *******************************************************************************/ + public void setCreateDate(Instant createDate) + { + this.createDate = createDate; + } + + + + /******************************************************************************* + ** Fluent setter for createDate + *******************************************************************************/ + public CmsPhotoAlbumFolder withCreateDate(Instant createDate) + { + this.createDate = createDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for modifyDate + *******************************************************************************/ + public Instant getModifyDate() + { + return (this.modifyDate); + } + + + + /******************************************************************************* + ** Setter for modifyDate + *******************************************************************************/ + public void setModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + } + + + + /******************************************************************************* + ** Fluent setter for modifyDate + *******************************************************************************/ + public CmsPhotoAlbumFolder withModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + return (this); + } + +} diff --git a/src/main/java/com/kingsrook/qbits/cms/photos/model/CmsPhotoTag.java b/src/main/java/com/kingsrook/qbits/cms/photos/model/CmsPhotoTag.java new file mode 100644 index 0000000..d374c51 --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/photos/model/CmsPhotoTag.java @@ -0,0 +1,263 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.photos.model; + + +import java.time.Instant; +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.core.model.data.QField; +import com.kingsrook.qqq.backend.core.model.data.QRecord; +import com.kingsrook.qqq.backend.core.model.data.QRecordEntity; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DynamicDefaultValueBehavior; +import com.kingsrook.qqq.backend.core.model.metadata.fields.ValueTooLongBehavior; + + +/******************************************************************************* + ** A tag for photos. + ** + ** The physical table name is the configured prefix plus TABLE_NAME (for + ** example cms_photo_tag); possible-value source names on the fields are + ** logical and get the same prefix when the table is built. + *******************************************************************************/ +public class CmsPhotoTag extends QRecordEntity +{ + public static final String TABLE_NAME = "photo_tag"; + + @QField(isEditable = false, isPrimaryKey = true) + private Long id; + + @QField(isRequired = true, maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String name; + + @QField(isRequired = true, maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String slug; + + @QField(maxLength = 255, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12) + private String description; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.CREATE_DATE) + private Instant createDate; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.MODIFY_DATE) + private Instant modifyDate; + + + + /******************************************************************************* + ** Default constructor + *******************************************************************************/ + public CmsPhotoTag() + { + } + + + + /******************************************************************************* + ** Constructor that takes a QRecord + *******************************************************************************/ + public CmsPhotoTag(QRecord record) throws QException + { + populateFromQRecord(record); + } + + + + /******************************************************************************* + ** Getter for id + *******************************************************************************/ + public Long getId() + { + return (this.id); + } + + + + /******************************************************************************* + ** Setter for id + *******************************************************************************/ + public void setId(Long id) + { + this.id = id; + } + + + + /******************************************************************************* + ** Fluent setter for id + *******************************************************************************/ + public CmsPhotoTag withId(Long id) + { + this.id = id; + return (this); + } + + + + /******************************************************************************* + ** Getter for name + *******************************************************************************/ + public String getName() + { + return (this.name); + } + + + + /******************************************************************************* + ** Setter for name + *******************************************************************************/ + public void setName(String name) + { + this.name = name; + } + + + + /******************************************************************************* + ** Fluent setter for name + *******************************************************************************/ + public CmsPhotoTag withName(String name) + { + this.name = name; + return (this); + } + + + + /******************************************************************************* + ** Getter for slug + *******************************************************************************/ + public String getSlug() + { + return (this.slug); + } + + + + /******************************************************************************* + ** Setter for slug + *******************************************************************************/ + public void setSlug(String slug) + { + this.slug = slug; + } + + + + /******************************************************************************* + ** Fluent setter for slug + *******************************************************************************/ + public CmsPhotoTag withSlug(String slug) + { + this.slug = slug; + return (this); + } + + + + /******************************************************************************* + ** Getter for description + *******************************************************************************/ + public String getDescription() + { + return (this.description); + } + + + + /******************************************************************************* + ** Setter for description + *******************************************************************************/ + public void setDescription(String description) + { + this.description = description; + } + + + + /******************************************************************************* + ** Fluent setter for description + *******************************************************************************/ + public CmsPhotoTag withDescription(String description) + { + this.description = description; + return (this); + } + + + + /******************************************************************************* + ** Getter for createDate + *******************************************************************************/ + public Instant getCreateDate() + { + return (this.createDate); + } + + + + /******************************************************************************* + ** Setter for createDate + *******************************************************************************/ + public void setCreateDate(Instant createDate) + { + this.createDate = createDate; + } + + + + /******************************************************************************* + ** Fluent setter for createDate + *******************************************************************************/ + public CmsPhotoTag withCreateDate(Instant createDate) + { + this.createDate = createDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for modifyDate + *******************************************************************************/ + public Instant getModifyDate() + { + return (this.modifyDate); + } + + + + /******************************************************************************* + ** Setter for modifyDate + *******************************************************************************/ + public void setModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + } + + + + /******************************************************************************* + ** Fluent setter for modifyDate + *******************************************************************************/ + public CmsPhotoTag withModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + return (this); + } + +} diff --git a/src/main/java/com/kingsrook/qbits/cms/photos/model/CmsPhotoTagLink.java b/src/main/java/com/kingsrook/qbits/cms/photos/model/CmsPhotoTagLink.java new file mode 100644 index 0000000..4c55a26 --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/photos/model/CmsPhotoTagLink.java @@ -0,0 +1,228 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.photos.model; + + +import java.time.Instant; +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.core.model.data.QField; +import com.kingsrook.qqq.backend.core.model.data.QRecord; +import com.kingsrook.qqq.backend.core.model.data.QRecordEntity; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DynamicDefaultValueBehavior; + + +/******************************************************************************* + ** One tag on one photo. + ** + ** The physical table name is the configured prefix plus TABLE_NAME (for + ** example cms_photo_tag_int); possible-value source names on the fields are + ** logical and get the same prefix when the table is built. + *******************************************************************************/ +public class CmsPhotoTagLink extends QRecordEntity +{ + public static final String TABLE_NAME = "photo_tag_int"; + + @QField(isEditable = false, isPrimaryKey = true) + private Long id; + + @QField(isRequired = true, possibleValueSourceName = "photo", label = "Photo") + private Long photoId; + + @QField(isRequired = true, possibleValueSourceName = "photo_tag", label = "Photo Tag") + private Long photoTagId; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.CREATE_DATE) + private Instant createDate; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.MODIFY_DATE) + private Instant modifyDate; + + + + /******************************************************************************* + ** Default constructor + *******************************************************************************/ + public CmsPhotoTagLink() + { + } + + + + /******************************************************************************* + ** Constructor that takes a QRecord + *******************************************************************************/ + public CmsPhotoTagLink(QRecord record) throws QException + { + populateFromQRecord(record); + } + + + + /******************************************************************************* + ** Getter for id + *******************************************************************************/ + public Long getId() + { + return (this.id); + } + + + + /******************************************************************************* + ** Setter for id + *******************************************************************************/ + public void setId(Long id) + { + this.id = id; + } + + + + /******************************************************************************* + ** Fluent setter for id + *******************************************************************************/ + public CmsPhotoTagLink withId(Long id) + { + this.id = id; + return (this); + } + + + + /******************************************************************************* + ** Getter for photoId + *******************************************************************************/ + public Long getPhotoId() + { + return (this.photoId); + } + + + + /******************************************************************************* + ** Setter for photoId + *******************************************************************************/ + public void setPhotoId(Long photoId) + { + this.photoId = photoId; + } + + + + /******************************************************************************* + ** Fluent setter for photoId + *******************************************************************************/ + public CmsPhotoTagLink withPhotoId(Long photoId) + { + this.photoId = photoId; + return (this); + } + + + + /******************************************************************************* + ** Getter for photoTagId + *******************************************************************************/ + public Long getPhotoTagId() + { + return (this.photoTagId); + } + + + + /******************************************************************************* + ** Setter for photoTagId + *******************************************************************************/ + public void setPhotoTagId(Long photoTagId) + { + this.photoTagId = photoTagId; + } + + + + /******************************************************************************* + ** Fluent setter for photoTagId + *******************************************************************************/ + public CmsPhotoTagLink withPhotoTagId(Long photoTagId) + { + this.photoTagId = photoTagId; + return (this); + } + + + + /******************************************************************************* + ** Getter for createDate + *******************************************************************************/ + public Instant getCreateDate() + { + return (this.createDate); + } + + + + /******************************************************************************* + ** Setter for createDate + *******************************************************************************/ + public void setCreateDate(Instant createDate) + { + this.createDate = createDate; + } + + + + /******************************************************************************* + ** Fluent setter for createDate + *******************************************************************************/ + public CmsPhotoTagLink withCreateDate(Instant createDate) + { + this.createDate = createDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for modifyDate + *******************************************************************************/ + public Instant getModifyDate() + { + return (this.modifyDate); + } + + + + /******************************************************************************* + ** Setter for modifyDate + *******************************************************************************/ + public void setModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + } + + + + /******************************************************************************* + ** Fluent setter for modifyDate + *******************************************************************************/ + public CmsPhotoTagLink withModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + return (this); + } + +} diff --git a/src/main/java/com/kingsrook/qbits/cms/projects/model/CmsProject.java b/src/main/java/com/kingsrook/qbits/cms/projects/model/CmsProject.java new file mode 100644 index 0000000..50a66a1 --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/projects/model/CmsProject.java @@ -0,0 +1,943 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.projects.model; + + +import java.time.Instant; +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.core.model.data.QField; +import com.kingsrook.qqq.backend.core.model.data.QRecord; +import com.kingsrook.qqq.backend.core.model.data.QRecordEntity; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DynamicDefaultValueBehavior; +import com.kingsrook.qqq.backend.core.model.metadata.fields.ValueTooLongBehavior; + + +/******************************************************************************* + ** A project of a site: its page content, state, links, image and dates. + ** + ** The physical table name is the configured prefix plus TABLE_NAME (for + ** example cms_project); possible-value source names on the fields are + ** logical and get the same prefix when the table is built. + *******************************************************************************/ +public class CmsProject extends QRecordEntity +{ + public static final String TABLE_NAME = "project"; + + @QField(isEditable = false, isPrimaryKey = true) + private Long id; + + @QField(isRequired = true, maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String name; + + @QField(isRequired = true, maxLength = 20, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String shortName; + + @QField(isRequired = true, maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String slug; + + @QField(isRequired = true, maxLength = 200, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String title; + + @QField(gridColumns = 12) + private String description; + + @QField(gridColumns = 12) + private String content; + + @QField(isRequired = true, maxLength = 20, defaultValue = "ACTIVE", possibleValueSourceName = "project_status", label = "Status") + private String projectStatus; + + @QField(maxLength = 255, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12, label = "GitHub URL") + private String githubUrl; + + @QField(maxLength = 255, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12, label = "Live URL") + private String liveUrl; + + @QField(possibleValueSourceName = "media", label = "Featured Media") + private Long featuredMediaId; + + @QField(maxLength = 255, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12, label = "Featured Image URL") + private String featuredImage; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR, label = "Image description") + private String imageAlt; + + @QField(maxLength = 1000, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String imageCaption; + + @QField(defaultValue = "50", label = "Horizontal focal point (%)") + private Integer imageFocalX; + + @QField(defaultValue = "50", label = "Vertical focal point (%)") + private Integer imageFocalY; + + @QField + private Instant startDate; + + @QField + private Instant endDate; + + @QField(isRequired = true, defaultValue = "false") + private Boolean isFeatured; + + @QField(isRequired = true, defaultValue = "0") + private Integer sortOrder; + + @QField(isRequired = true, possibleValueSourceName = "site", label = "Site") + private Long siteId; + + @QField(isRequired = true, possibleValueSourceName = "project_category", label = "Category") + private Long categoryId; + + @QField(isRequired = true, defaultValue = "false") + private Boolean isPublished; + + @QField + private Instant publishDate; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.CREATE_DATE) + private Instant createDate; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.MODIFY_DATE) + private Instant modifyDate; + + + + /******************************************************************************* + ** Default constructor + *******************************************************************************/ + public CmsProject() + { + } + + + + /******************************************************************************* + ** Constructor that takes a QRecord + *******************************************************************************/ + public CmsProject(QRecord record) throws QException + { + populateFromQRecord(record); + } + + + + /******************************************************************************* + ** Getter for id + *******************************************************************************/ + public Long getId() + { + return (this.id); + } + + + + /******************************************************************************* + ** Setter for id + *******************************************************************************/ + public void setId(Long id) + { + this.id = id; + } + + + + /******************************************************************************* + ** Fluent setter for id + *******************************************************************************/ + public CmsProject withId(Long id) + { + this.id = id; + return (this); + } + + + + /******************************************************************************* + ** Getter for name + *******************************************************************************/ + public String getName() + { + return (this.name); + } + + + + /******************************************************************************* + ** Setter for name + *******************************************************************************/ + public void setName(String name) + { + this.name = name; + } + + + + /******************************************************************************* + ** Fluent setter for name + *******************************************************************************/ + public CmsProject withName(String name) + { + this.name = name; + return (this); + } + + + + /******************************************************************************* + ** Getter for shortName + *******************************************************************************/ + public String getShortName() + { + return (this.shortName); + } + + + + /******************************************************************************* + ** Setter for shortName + *******************************************************************************/ + public void setShortName(String shortName) + { + this.shortName = shortName; + } + + + + /******************************************************************************* + ** Fluent setter for shortName + *******************************************************************************/ + public CmsProject withShortName(String shortName) + { + this.shortName = shortName; + return (this); + } + + + + /******************************************************************************* + ** Getter for slug + *******************************************************************************/ + public String getSlug() + { + return (this.slug); + } + + + + /******************************************************************************* + ** Setter for slug + *******************************************************************************/ + public void setSlug(String slug) + { + this.slug = slug; + } + + + + /******************************************************************************* + ** Fluent setter for slug + *******************************************************************************/ + public CmsProject withSlug(String slug) + { + this.slug = slug; + return (this); + } + + + + /******************************************************************************* + ** Getter for title + *******************************************************************************/ + public String getTitle() + { + return (this.title); + } + + + + /******************************************************************************* + ** Setter for title + *******************************************************************************/ + public void setTitle(String title) + { + this.title = title; + } + + + + /******************************************************************************* + ** Fluent setter for title + *******************************************************************************/ + public CmsProject withTitle(String title) + { + this.title = title; + return (this); + } + + + + /******************************************************************************* + ** Getter for description + *******************************************************************************/ + public String getDescription() + { + return (this.description); + } + + + + /******************************************************************************* + ** Setter for description + *******************************************************************************/ + public void setDescription(String description) + { + this.description = description; + } + + + + /******************************************************************************* + ** Fluent setter for description + *******************************************************************************/ + public CmsProject withDescription(String description) + { + this.description = description; + return (this); + } + + + + /******************************************************************************* + ** Getter for content + *******************************************************************************/ + public String getContent() + { + return (this.content); + } + + + + /******************************************************************************* + ** Setter for content + *******************************************************************************/ + public void setContent(String content) + { + this.content = content; + } + + + + /******************************************************************************* + ** Fluent setter for content + *******************************************************************************/ + public CmsProject withContent(String content) + { + this.content = content; + return (this); + } + + + + /******************************************************************************* + ** Getter for projectStatus + *******************************************************************************/ + public String getProjectStatus() + { + return (this.projectStatus); + } + + + + /******************************************************************************* + ** Setter for projectStatus + *******************************************************************************/ + public void setProjectStatus(String projectStatus) + { + this.projectStatus = projectStatus; + } + + + + /******************************************************************************* + ** Fluent setter for projectStatus + *******************************************************************************/ + public CmsProject withProjectStatus(String projectStatus) + { + this.projectStatus = projectStatus; + return (this); + } + + + + /******************************************************************************* + ** Getter for githubUrl + *******************************************************************************/ + public String getGithubUrl() + { + return (this.githubUrl); + } + + + + /******************************************************************************* + ** Setter for githubUrl + *******************************************************************************/ + public void setGithubUrl(String githubUrl) + { + this.githubUrl = githubUrl; + } + + + + /******************************************************************************* + ** Fluent setter for githubUrl + *******************************************************************************/ + public CmsProject withGithubUrl(String githubUrl) + { + this.githubUrl = githubUrl; + return (this); + } + + + + /******************************************************************************* + ** Getter for liveUrl + *******************************************************************************/ + public String getLiveUrl() + { + return (this.liveUrl); + } + + + + /******************************************************************************* + ** Setter for liveUrl + *******************************************************************************/ + public void setLiveUrl(String liveUrl) + { + this.liveUrl = liveUrl; + } + + + + /******************************************************************************* + ** Fluent setter for liveUrl + *******************************************************************************/ + public CmsProject withLiveUrl(String liveUrl) + { + this.liveUrl = liveUrl; + return (this); + } + + + + /******************************************************************************* + ** Getter for featuredMediaId + *******************************************************************************/ + public Long getFeaturedMediaId() + { + return (this.featuredMediaId); + } + + + + /******************************************************************************* + ** Setter for featuredMediaId + *******************************************************************************/ + public void setFeaturedMediaId(Long featuredMediaId) + { + this.featuredMediaId = featuredMediaId; + } + + + + /******************************************************************************* + ** Fluent setter for featuredMediaId + *******************************************************************************/ + public CmsProject withFeaturedMediaId(Long featuredMediaId) + { + this.featuredMediaId = featuredMediaId; + return (this); + } + + + + /******************************************************************************* + ** Getter for featuredImage + *******************************************************************************/ + public String getFeaturedImage() + { + return (this.featuredImage); + } + + + + /******************************************************************************* + ** Setter for featuredImage + *******************************************************************************/ + public void setFeaturedImage(String featuredImage) + { + this.featuredImage = featuredImage; + } + + + + /******************************************************************************* + ** Fluent setter for featuredImage + *******************************************************************************/ + public CmsProject withFeaturedImage(String featuredImage) + { + this.featuredImage = featuredImage; + return (this); + } + + + + /******************************************************************************* + ** Getter for imageAlt + *******************************************************************************/ + public String getImageAlt() + { + return (this.imageAlt); + } + + + + /******************************************************************************* + ** Setter for imageAlt + *******************************************************************************/ + public void setImageAlt(String imageAlt) + { + this.imageAlt = imageAlt; + } + + + + /******************************************************************************* + ** Fluent setter for imageAlt + *******************************************************************************/ + public CmsProject withImageAlt(String imageAlt) + { + this.imageAlt = imageAlt; + return (this); + } + + + + /******************************************************************************* + ** Getter for imageCaption + *******************************************************************************/ + public String getImageCaption() + { + return (this.imageCaption); + } + + + + /******************************************************************************* + ** Setter for imageCaption + *******************************************************************************/ + public void setImageCaption(String imageCaption) + { + this.imageCaption = imageCaption; + } + + + + /******************************************************************************* + ** Fluent setter for imageCaption + *******************************************************************************/ + public CmsProject withImageCaption(String imageCaption) + { + this.imageCaption = imageCaption; + return (this); + } + + + + /******************************************************************************* + ** Getter for imageFocalX + *******************************************************************************/ + public Integer getImageFocalX() + { + return (this.imageFocalX); + } + + + + /******************************************************************************* + ** Setter for imageFocalX + *******************************************************************************/ + public void setImageFocalX(Integer imageFocalX) + { + this.imageFocalX = imageFocalX; + } + + + + /******************************************************************************* + ** Fluent setter for imageFocalX + *******************************************************************************/ + public CmsProject withImageFocalX(Integer imageFocalX) + { + this.imageFocalX = imageFocalX; + return (this); + } + + + + /******************************************************************************* + ** Getter for imageFocalY + *******************************************************************************/ + public Integer getImageFocalY() + { + return (this.imageFocalY); + } + + + + /******************************************************************************* + ** Setter for imageFocalY + *******************************************************************************/ + public void setImageFocalY(Integer imageFocalY) + { + this.imageFocalY = imageFocalY; + } + + + + /******************************************************************************* + ** Fluent setter for imageFocalY + *******************************************************************************/ + public CmsProject withImageFocalY(Integer imageFocalY) + { + this.imageFocalY = imageFocalY; + return (this); + } + + + + /******************************************************************************* + ** Getter for startDate + *******************************************************************************/ + public Instant getStartDate() + { + return (this.startDate); + } + + + + /******************************************************************************* + ** Setter for startDate + *******************************************************************************/ + public void setStartDate(Instant startDate) + { + this.startDate = startDate; + } + + + + /******************************************************************************* + ** Fluent setter for startDate + *******************************************************************************/ + public CmsProject withStartDate(Instant startDate) + { + this.startDate = startDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for endDate + *******************************************************************************/ + public Instant getEndDate() + { + return (this.endDate); + } + + + + /******************************************************************************* + ** Setter for endDate + *******************************************************************************/ + public void setEndDate(Instant endDate) + { + this.endDate = endDate; + } + + + + /******************************************************************************* + ** Fluent setter for endDate + *******************************************************************************/ + public CmsProject withEndDate(Instant endDate) + { + this.endDate = endDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for isFeatured + *******************************************************************************/ + public Boolean getIsFeatured() + { + return (this.isFeatured); + } + + + + /******************************************************************************* + ** Setter for isFeatured + *******************************************************************************/ + public void setIsFeatured(Boolean isFeatured) + { + this.isFeatured = isFeatured; + } + + + + /******************************************************************************* + ** Fluent setter for isFeatured + *******************************************************************************/ + public CmsProject withIsFeatured(Boolean isFeatured) + { + this.isFeatured = isFeatured; + return (this); + } + + + + /******************************************************************************* + ** Getter for sortOrder + *******************************************************************************/ + public Integer getSortOrder() + { + return (this.sortOrder); + } + + + + /******************************************************************************* + ** Setter for sortOrder + *******************************************************************************/ + public void setSortOrder(Integer sortOrder) + { + this.sortOrder = sortOrder; + } + + + + /******************************************************************************* + ** Fluent setter for sortOrder + *******************************************************************************/ + public CmsProject withSortOrder(Integer sortOrder) + { + this.sortOrder = sortOrder; + return (this); + } + + + + /******************************************************************************* + ** Getter for siteId + *******************************************************************************/ + public Long getSiteId() + { + return (this.siteId); + } + + + + /******************************************************************************* + ** Setter for siteId + *******************************************************************************/ + public void setSiteId(Long siteId) + { + this.siteId = siteId; + } + + + + /******************************************************************************* + ** Fluent setter for siteId + *******************************************************************************/ + public CmsProject withSiteId(Long siteId) + { + this.siteId = siteId; + return (this); + } + + + + /******************************************************************************* + ** Getter for categoryId + *******************************************************************************/ + public Long getCategoryId() + { + return (this.categoryId); + } + + + + /******************************************************************************* + ** Setter for categoryId + *******************************************************************************/ + public void setCategoryId(Long categoryId) + { + this.categoryId = categoryId; + } + + + + /******************************************************************************* + ** Fluent setter for categoryId + *******************************************************************************/ + public CmsProject withCategoryId(Long categoryId) + { + this.categoryId = categoryId; + return (this); + } + + + + /******************************************************************************* + ** Getter for isPublished + *******************************************************************************/ + public Boolean getIsPublished() + { + return (this.isPublished); + } + + + + /******************************************************************************* + ** Setter for isPublished + *******************************************************************************/ + public void setIsPublished(Boolean isPublished) + { + this.isPublished = isPublished; + } + + + + /******************************************************************************* + ** Fluent setter for isPublished + *******************************************************************************/ + public CmsProject withIsPublished(Boolean isPublished) + { + this.isPublished = isPublished; + return (this); + } + + + + /******************************************************************************* + ** Getter for publishDate + *******************************************************************************/ + public Instant getPublishDate() + { + return (this.publishDate); + } + + + + /******************************************************************************* + ** Setter for publishDate + *******************************************************************************/ + public void setPublishDate(Instant publishDate) + { + this.publishDate = publishDate; + } + + + + /******************************************************************************* + ** Fluent setter for publishDate + *******************************************************************************/ + public CmsProject withPublishDate(Instant publishDate) + { + this.publishDate = publishDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for createDate + *******************************************************************************/ + public Instant getCreateDate() + { + return (this.createDate); + } + + + + /******************************************************************************* + ** Setter for createDate + *******************************************************************************/ + public void setCreateDate(Instant createDate) + { + this.createDate = createDate; + } + + + + /******************************************************************************* + ** Fluent setter for createDate + *******************************************************************************/ + public CmsProject withCreateDate(Instant createDate) + { + this.createDate = createDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for modifyDate + *******************************************************************************/ + public Instant getModifyDate() + { + return (this.modifyDate); + } + + + + /******************************************************************************* + ** Setter for modifyDate + *******************************************************************************/ + public void setModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + } + + + + /******************************************************************************* + ** Fluent setter for modifyDate + *******************************************************************************/ + public CmsProject withModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + return (this); + } + +} diff --git a/src/main/java/com/kingsrook/qbits/cms/projects/model/CmsProjectCategory.java b/src/main/java/com/kingsrook/qbits/cms/projects/model/CmsProjectCategory.java new file mode 100644 index 0000000..3b1c010 --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/projects/model/CmsProjectCategory.java @@ -0,0 +1,501 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.projects.model; + + +import java.time.Instant; +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.core.model.data.QField; +import com.kingsrook.qqq.backend.core.model.data.QRecord; +import com.kingsrook.qqq.backend.core.model.data.QRecordEntity; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DynamicDefaultValueBehavior; +import com.kingsrook.qqq.backend.core.model.metadata.fields.ValueTooLongBehavior; + + +/******************************************************************************* + ** A group of projects of a site, with its own page text and image. + ** + ** The physical table name is the configured prefix plus TABLE_NAME (for + ** example cms_project_category); possible-value source names on the fields are + ** logical and get the same prefix when the table is built. + *******************************************************************************/ +public class CmsProjectCategory extends QRecordEntity +{ + public static final String TABLE_NAME = "project_category"; + + @QField(isEditable = false, isPrimaryKey = true) + private Long id; + + @QField(isRequired = true, possibleValueSourceName = "site", label = "Site") + private Long siteId; + + @QField(isRequired = true, maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String name; + + @QField(isRequired = true, maxLength = 200, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String title; + + @QField(isRequired = true, maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String slug; + + @QField(maxLength = 20, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String section; + + @QField(maxLength = 1000, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12) + private String description; + + @QField(possibleValueSourceName = "media", label = "Featured Media") + private Long featuredMediaId; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12, label = "Featured Image URL") + private String featuredImage; + + @QField(isRequired = true, defaultValue = "0") + private Integer sortOrder; + + @QField(isRequired = true, defaultValue = "false") + private Boolean isPublished; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.CREATE_DATE) + private Instant createDate; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.MODIFY_DATE) + private Instant modifyDate; + + + + /******************************************************************************* + ** Default constructor + *******************************************************************************/ + public CmsProjectCategory() + { + } + + + + /******************************************************************************* + ** Constructor that takes a QRecord + *******************************************************************************/ + public CmsProjectCategory(QRecord record) throws QException + { + populateFromQRecord(record); + } + + + + /******************************************************************************* + ** Getter for id + *******************************************************************************/ + public Long getId() + { + return (this.id); + } + + + + /******************************************************************************* + ** Setter for id + *******************************************************************************/ + public void setId(Long id) + { + this.id = id; + } + + + + /******************************************************************************* + ** Fluent setter for id + *******************************************************************************/ + public CmsProjectCategory withId(Long id) + { + this.id = id; + return (this); + } + + + + /******************************************************************************* + ** Getter for siteId + *******************************************************************************/ + public Long getSiteId() + { + return (this.siteId); + } + + + + /******************************************************************************* + ** Setter for siteId + *******************************************************************************/ + public void setSiteId(Long siteId) + { + this.siteId = siteId; + } + + + + /******************************************************************************* + ** Fluent setter for siteId + *******************************************************************************/ + public CmsProjectCategory withSiteId(Long siteId) + { + this.siteId = siteId; + return (this); + } + + + + /******************************************************************************* + ** Getter for name + *******************************************************************************/ + public String getName() + { + return (this.name); + } + + + + /******************************************************************************* + ** Setter for name + *******************************************************************************/ + public void setName(String name) + { + this.name = name; + } + + + + /******************************************************************************* + ** Fluent setter for name + *******************************************************************************/ + public CmsProjectCategory withName(String name) + { + this.name = name; + return (this); + } + + + + /******************************************************************************* + ** Getter for title + *******************************************************************************/ + public String getTitle() + { + return (this.title); + } + + + + /******************************************************************************* + ** Setter for title + *******************************************************************************/ + public void setTitle(String title) + { + this.title = title; + } + + + + /******************************************************************************* + ** Fluent setter for title + *******************************************************************************/ + public CmsProjectCategory withTitle(String title) + { + this.title = title; + return (this); + } + + + + /******************************************************************************* + ** Getter for slug + *******************************************************************************/ + public String getSlug() + { + return (this.slug); + } + + + + /******************************************************************************* + ** Setter for slug + *******************************************************************************/ + public void setSlug(String slug) + { + this.slug = slug; + } + + + + /******************************************************************************* + ** Fluent setter for slug + *******************************************************************************/ + public CmsProjectCategory withSlug(String slug) + { + this.slug = slug; + return (this); + } + + + + /******************************************************************************* + ** Getter for section + *******************************************************************************/ + public String getSection() + { + return (this.section); + } + + + + /******************************************************************************* + ** Setter for section + *******************************************************************************/ + public void setSection(String section) + { + this.section = section; + } + + + + /******************************************************************************* + ** Fluent setter for section + *******************************************************************************/ + public CmsProjectCategory withSection(String section) + { + this.section = section; + return (this); + } + + + + /******************************************************************************* + ** Getter for description + *******************************************************************************/ + public String getDescription() + { + return (this.description); + } + + + + /******************************************************************************* + ** Setter for description + *******************************************************************************/ + public void setDescription(String description) + { + this.description = description; + } + + + + /******************************************************************************* + ** Fluent setter for description + *******************************************************************************/ + public CmsProjectCategory withDescription(String description) + { + this.description = description; + return (this); + } + + + + /******************************************************************************* + ** Getter for featuredMediaId + *******************************************************************************/ + public Long getFeaturedMediaId() + { + return (this.featuredMediaId); + } + + + + /******************************************************************************* + ** Setter for featuredMediaId + *******************************************************************************/ + public void setFeaturedMediaId(Long featuredMediaId) + { + this.featuredMediaId = featuredMediaId; + } + + + + /******************************************************************************* + ** Fluent setter for featuredMediaId + *******************************************************************************/ + public CmsProjectCategory withFeaturedMediaId(Long featuredMediaId) + { + this.featuredMediaId = featuredMediaId; + return (this); + } + + + + /******************************************************************************* + ** Getter for featuredImage + *******************************************************************************/ + public String getFeaturedImage() + { + return (this.featuredImage); + } + + + + /******************************************************************************* + ** Setter for featuredImage + *******************************************************************************/ + public void setFeaturedImage(String featuredImage) + { + this.featuredImage = featuredImage; + } + + + + /******************************************************************************* + ** Fluent setter for featuredImage + *******************************************************************************/ + public CmsProjectCategory withFeaturedImage(String featuredImage) + { + this.featuredImage = featuredImage; + return (this); + } + + + + /******************************************************************************* + ** Getter for sortOrder + *******************************************************************************/ + public Integer getSortOrder() + { + return (this.sortOrder); + } + + + + /******************************************************************************* + ** Setter for sortOrder + *******************************************************************************/ + public void setSortOrder(Integer sortOrder) + { + this.sortOrder = sortOrder; + } + + + + /******************************************************************************* + ** Fluent setter for sortOrder + *******************************************************************************/ + public CmsProjectCategory withSortOrder(Integer sortOrder) + { + this.sortOrder = sortOrder; + return (this); + } + + + + /******************************************************************************* + ** Getter for isPublished + *******************************************************************************/ + public Boolean getIsPublished() + { + return (this.isPublished); + } + + + + /******************************************************************************* + ** Setter for isPublished + *******************************************************************************/ + public void setIsPublished(Boolean isPublished) + { + this.isPublished = isPublished; + } + + + + /******************************************************************************* + ** Fluent setter for isPublished + *******************************************************************************/ + public CmsProjectCategory withIsPublished(Boolean isPublished) + { + this.isPublished = isPublished; + return (this); + } + + + + /******************************************************************************* + ** Getter for createDate + *******************************************************************************/ + public Instant getCreateDate() + { + return (this.createDate); + } + + + + /******************************************************************************* + ** Setter for createDate + *******************************************************************************/ + public void setCreateDate(Instant createDate) + { + this.createDate = createDate; + } + + + + /******************************************************************************* + ** Fluent setter for createDate + *******************************************************************************/ + public CmsProjectCategory withCreateDate(Instant createDate) + { + this.createDate = createDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for modifyDate + *******************************************************************************/ + public Instant getModifyDate() + { + return (this.modifyDate); + } + + + + /******************************************************************************* + ** Setter for modifyDate + *******************************************************************************/ + public void setModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + } + + + + /******************************************************************************* + ** Fluent setter for modifyDate + *******************************************************************************/ + public CmsProjectCategory withModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + return (this); + } + +} diff --git a/src/main/java/com/kingsrook/qbits/cms/projects/model/CmsProjectStatus.java b/src/main/java/com/kingsrook/qbits/cms/projects/model/CmsProjectStatus.java new file mode 100644 index 0000000..91b3095 --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/projects/model/CmsProjectStatus.java @@ -0,0 +1,70 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.projects.model; + + +import com.kingsrook.qqq.backend.core.model.metadata.possiblevalues.PossibleValueEnum; + + +/******************************************************************************* + ** The state of a project. Its possible-value source gets the table prefix + ** (cms_project_status). + *******************************************************************************/ +public enum CmsProjectStatus implements PossibleValueEnum +{ + PLANNED("Planned"), + IN_PROGRESS("In progress"), + ACTIVE("Active"), + ARCHIVED("Archived"); + + /** The logical possible-value source name (the prefix is added). */ + public static final String NAME = "project_status"; + + private final String label; + + + + /******************************************************************************* + ** Constructor. + *******************************************************************************/ + CmsProjectStatus(String label) + { + this.label = label; + } + + + + /******************************************************************************* + ** The stored value. + *******************************************************************************/ + @Override + public String getPossibleValueId() + { + return (name()); + } + + + + /******************************************************************************* + ** The label. + *******************************************************************************/ + @Override + public String getPossibleValueLabel() + { + return (label); + } +} diff --git a/src/main/java/com/kingsrook/qbits/cms/projects/model/CmsProjectUpdate.java b/src/main/java/com/kingsrook/qbits/cms/projects/model/CmsProjectUpdate.java new file mode 100644 index 0000000..901c342 --- /dev/null +++ b/src/main/java/com/kingsrook/qbits/cms/projects/model/CmsProjectUpdate.java @@ -0,0 +1,535 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms.projects.model; + + +import java.time.Instant; +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.core.model.data.QField; +import com.kingsrook.qqq.backend.core.model.data.QRecord; +import com.kingsrook.qqq.backend.core.model.data.QRecordEntity; +import com.kingsrook.qqq.backend.core.model.metadata.fields.DynamicDefaultValueBehavior; +import com.kingsrook.qqq.backend.core.model.metadata.fields.ValueTooLongBehavior; + + +/******************************************************************************* + ** A dated update on a project. + ** + ** The physical table name is the configured prefix plus TABLE_NAME (for + ** example cms_project_update); possible-value source names on the fields are + ** logical and get the same prefix when the table is built. + *******************************************************************************/ +public class CmsProjectUpdate extends QRecordEntity +{ + public static final String TABLE_NAME = "project_update"; + + @QField(isEditable = false, isPrimaryKey = true) + private Long id; + + @QField(isRequired = true, possibleValueSourceName = "project", label = "Project") + private Long projectId; + + @QField(isRequired = true, maxLength = 100, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String slug; + + @QField(isRequired = true, maxLength = 200, valueTooLongBehavior = ValueTooLongBehavior.ERROR) + private String title; + + @QField(maxLength = 1000, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12) + private String excerpt; + + @QField(isRequired = true, gridColumns = 12) + private String content; + + @QField(isRequired = true) + private Instant updateDate; + + @QField(isRequired = true, defaultValue = "false") + private Boolean isPublished; + + @QField + private Instant publishDate; + + @QField(isRequired = true, defaultValue = "0") + private Integer sortOrder; + + @QField(possibleValueSourceName = "media", label = "Featured Media") + private Long featuredMediaId; + + @QField(maxLength = 500, valueTooLongBehavior = ValueTooLongBehavior.ERROR, gridColumns = 12, label = "Featured Image URL") + private String featuredImage; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.CREATE_DATE) + private Instant createDate; + + @QField(isEditable = false, dynamicDefaultValueBehavior = DynamicDefaultValueBehavior.MODIFY_DATE) + private Instant modifyDate; + + + + /******************************************************************************* + ** Default constructor + *******************************************************************************/ + public CmsProjectUpdate() + { + } + + + + /******************************************************************************* + ** Constructor that takes a QRecord + *******************************************************************************/ + public CmsProjectUpdate(QRecord record) throws QException + { + populateFromQRecord(record); + } + + + + /******************************************************************************* + ** Getter for id + *******************************************************************************/ + public Long getId() + { + return (this.id); + } + + + + /******************************************************************************* + ** Setter for id + *******************************************************************************/ + public void setId(Long id) + { + this.id = id; + } + + + + /******************************************************************************* + ** Fluent setter for id + *******************************************************************************/ + public CmsProjectUpdate withId(Long id) + { + this.id = id; + return (this); + } + + + + /******************************************************************************* + ** Getter for projectId + *******************************************************************************/ + public Long getProjectId() + { + return (this.projectId); + } + + + + /******************************************************************************* + ** Setter for projectId + *******************************************************************************/ + public void setProjectId(Long projectId) + { + this.projectId = projectId; + } + + + + /******************************************************************************* + ** Fluent setter for projectId + *******************************************************************************/ + public CmsProjectUpdate withProjectId(Long projectId) + { + this.projectId = projectId; + return (this); + } + + + + /******************************************************************************* + ** Getter for slug + *******************************************************************************/ + public String getSlug() + { + return (this.slug); + } + + + + /******************************************************************************* + ** Setter for slug + *******************************************************************************/ + public void setSlug(String slug) + { + this.slug = slug; + } + + + + /******************************************************************************* + ** Fluent setter for slug + *******************************************************************************/ + public CmsProjectUpdate withSlug(String slug) + { + this.slug = slug; + return (this); + } + + + + /******************************************************************************* + ** Getter for title + *******************************************************************************/ + public String getTitle() + { + return (this.title); + } + + + + /******************************************************************************* + ** Setter for title + *******************************************************************************/ + public void setTitle(String title) + { + this.title = title; + } + + + + /******************************************************************************* + ** Fluent setter for title + *******************************************************************************/ + public CmsProjectUpdate withTitle(String title) + { + this.title = title; + return (this); + } + + + + /******************************************************************************* + ** Getter for excerpt + *******************************************************************************/ + public String getExcerpt() + { + return (this.excerpt); + } + + + + /******************************************************************************* + ** Setter for excerpt + *******************************************************************************/ + public void setExcerpt(String excerpt) + { + this.excerpt = excerpt; + } + + + + /******************************************************************************* + ** Fluent setter for excerpt + *******************************************************************************/ + public CmsProjectUpdate withExcerpt(String excerpt) + { + this.excerpt = excerpt; + return (this); + } + + + + /******************************************************************************* + ** Getter for content + *******************************************************************************/ + public String getContent() + { + return (this.content); + } + + + + /******************************************************************************* + ** Setter for content + *******************************************************************************/ + public void setContent(String content) + { + this.content = content; + } + + + + /******************************************************************************* + ** Fluent setter for content + *******************************************************************************/ + public CmsProjectUpdate withContent(String content) + { + this.content = content; + return (this); + } + + + + /******************************************************************************* + ** Getter for updateDate + *******************************************************************************/ + public Instant getUpdateDate() + { + return (this.updateDate); + } + + + + /******************************************************************************* + ** Setter for updateDate + *******************************************************************************/ + public void setUpdateDate(Instant updateDate) + { + this.updateDate = updateDate; + } + + + + /******************************************************************************* + ** Fluent setter for updateDate + *******************************************************************************/ + public CmsProjectUpdate withUpdateDate(Instant updateDate) + { + this.updateDate = updateDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for isPublished + *******************************************************************************/ + public Boolean getIsPublished() + { + return (this.isPublished); + } + + + + /******************************************************************************* + ** Setter for isPublished + *******************************************************************************/ + public void setIsPublished(Boolean isPublished) + { + this.isPublished = isPublished; + } + + + + /******************************************************************************* + ** Fluent setter for isPublished + *******************************************************************************/ + public CmsProjectUpdate withIsPublished(Boolean isPublished) + { + this.isPublished = isPublished; + return (this); + } + + + + /******************************************************************************* + ** Getter for publishDate + *******************************************************************************/ + public Instant getPublishDate() + { + return (this.publishDate); + } + + + + /******************************************************************************* + ** Setter for publishDate + *******************************************************************************/ + public void setPublishDate(Instant publishDate) + { + this.publishDate = publishDate; + } + + + + /******************************************************************************* + ** Fluent setter for publishDate + *******************************************************************************/ + public CmsProjectUpdate withPublishDate(Instant publishDate) + { + this.publishDate = publishDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for sortOrder + *******************************************************************************/ + public Integer getSortOrder() + { + return (this.sortOrder); + } + + + + /******************************************************************************* + ** Setter for sortOrder + *******************************************************************************/ + public void setSortOrder(Integer sortOrder) + { + this.sortOrder = sortOrder; + } + + + + /******************************************************************************* + ** Fluent setter for sortOrder + *******************************************************************************/ + public CmsProjectUpdate withSortOrder(Integer sortOrder) + { + this.sortOrder = sortOrder; + return (this); + } + + + + /******************************************************************************* + ** Getter for featuredMediaId + *******************************************************************************/ + public Long getFeaturedMediaId() + { + return (this.featuredMediaId); + } + + + + /******************************************************************************* + ** Setter for featuredMediaId + *******************************************************************************/ + public void setFeaturedMediaId(Long featuredMediaId) + { + this.featuredMediaId = featuredMediaId; + } + + + + /******************************************************************************* + ** Fluent setter for featuredMediaId + *******************************************************************************/ + public CmsProjectUpdate withFeaturedMediaId(Long featuredMediaId) + { + this.featuredMediaId = featuredMediaId; + return (this); + } + + + + /******************************************************************************* + ** Getter for featuredImage + *******************************************************************************/ + public String getFeaturedImage() + { + return (this.featuredImage); + } + + + + /******************************************************************************* + ** Setter for featuredImage + *******************************************************************************/ + public void setFeaturedImage(String featuredImage) + { + this.featuredImage = featuredImage; + } + + + + /******************************************************************************* + ** Fluent setter for featuredImage + *******************************************************************************/ + public CmsProjectUpdate withFeaturedImage(String featuredImage) + { + this.featuredImage = featuredImage; + return (this); + } + + + + /******************************************************************************* + ** Getter for createDate + *******************************************************************************/ + public Instant getCreateDate() + { + return (this.createDate); + } + + + + /******************************************************************************* + ** Setter for createDate + *******************************************************************************/ + public void setCreateDate(Instant createDate) + { + this.createDate = createDate; + } + + + + /******************************************************************************* + ** Fluent setter for createDate + *******************************************************************************/ + public CmsProjectUpdate withCreateDate(Instant createDate) + { + this.createDate = createDate; + return (this); + } + + + + /******************************************************************************* + ** Getter for modifyDate + *******************************************************************************/ + public Instant getModifyDate() + { + return (this.modifyDate); + } + + + + /******************************************************************************* + ** Setter for modifyDate + *******************************************************************************/ + public void setModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + } + + + + /******************************************************************************* + ** Fluent setter for modifyDate + *******************************************************************************/ + public CmsProjectUpdate withModifyDate(Instant modifyDate) + { + this.modifyDate = modifyDate; + return (this); + } + +} diff --git a/src/main/resources/help/qbit-cms.yaml b/src/main/resources/help/qbit-cms.yaml new file mode 100644 index 0000000..38f8b0c --- /dev/null +++ b/src/main/resources/help/qbit-cms.yaml @@ -0,0 +1,1365 @@ +# Help for the CMS: every app, home, table, section, field, child list and value list of the qbit, under its default +# names (table prefix cms_, name prefix cms). CmsQBitProducer registers it when the host uses those names; a host with +# its own prefixes writes its own. Keys are sorted by kind, then by name. +bundle: qbit-cms +version: 0.1.0 +layer: QBIT +entries: + - key: app:cms;slot:help + summary: "The content of your websites: sites, pages, navigation, media, blogs, projects and photos." + content: | + The content of your websites: sites and their domains, redirects, pages, snippets and menus, the media library, blogs and their posts, projects and photo albums. The content is kept here as ordinary records; a website reads it from these tables. + - key: app:cmsBlogs;slot:help + summary: "Blogs, their posts and the authors who write them." + content: | + Blogs, their posts and the authors who write them. The tags of a blog are edited on the blog; the tags, media and related versions of a post are edited on the post. Settings holds the kinds of blog. + - key: app:cmsMedia;slot:help + summary: "The media library: the images and other files that content refers to, with their text and credit." + content: | + The media library: the images and other files that content refers to, with their text and credit. Settings holds the kinds of media and their rules. + - key: app:cmsNavigation;slot:help + summary: "The navigation menus of a site, such as the header and footer menus." + content: | + The navigation menus of a site, such as the header and footer menus. The entries of a menu are edited on the menu itself. + - key: app:cmsPages;slot:help + summary: "Pages and the reusable snippets of a site." + content: | + Pages and the reusable snippets of a site. A page is made of ordered sections and can sit under a parent page. Settings holds the kinds of page and of page section. + - key: app:cmsPhotos;slot:help + summary: "Photo albums, the folders they are kept in, and the tags photos carry. The photos of an album are edited on the album." + - key: app:cmsProjects;slot:help + summary: "Projects and the categories they are grouped in. The updates of a project are edited on the project." + - key: app:cmsSites;slot:help + summary: "The websites this content belongs to, the host names of each, and the redirects of each." + content: | + The websites this content belongs to, the host names of each, and the redirects of each. Settings holds the kinds of redirect. + - key: widget:cmsBlogsHome;slot:label + summary: "An overview of blogs, posts and authors: counts, drafts, inactive authors and recent changes." + content: | + An overview of blogs, posts and authors: counts, posts that are not published, inactive authors and the records changed most recently. It shows only what you may read. + - key: widget:cmsHome;slot:label + summary: "An overview of the content: how much there is, what is a draft or inactive, and what changed." + content: | + An overview of the content: how much there is of each kind, what is still a draft or inactive, and what changed most recently. It shows only what you may read. + - key: widget:cmsMediaHome;slot:label + summary: "An overview of the media library: how many files there are, inactive ones and the records changed most recently." + content: | + An overview of the media library: how many files there are, inactive ones and the records changed most recently. It shows only what you may read. + - key: widget:cmsNavigationHome;slot:label + summary: "An overview of menus and their items: counts, inactive ones and the records changed most recently." + content: | + An overview of menus and their items: counts, inactive ones and the records changed most recently. It shows only what you may read. + - key: widget:cmsPagesHome;slot:label + summary: "An overview of pages and snippets: counts, drafts, inactive snippets and recent changes." + content: | + An overview of pages and snippets: counts, pages that are not published, inactive snippets and the records changed most recently. It shows only what you may read. + - key: widget:cmsPhotosHome;slot:label + summary: "An overview of photo albums, folders and tags: counts, what is not published and the records changed most recently." + content: | + An overview of photo albums, folders and tags: counts, what is not published and the records changed most recently. It shows only what you may read. + - key: widget:cmsProjectsHome;slot:label + summary: "An overview of projects and their categories: counts, what is not published and the records changed most recently." + content: | + An overview of projects and their categories: counts, what is not published and the records changed most recently. It shows only what you may read. + - key: widget:cmsSitesHome;slot:label + summary: "An overview of sites, domains and redirects: counts, inactive redirects and the records changed most recently." + content: | + An overview of sites, domains and redirects: counts, inactive redirects and the records changed most recently. It shows only what you may read. + - key: widget:cms_author_cms_blog_post_authorId;slot:label + summary: "The posts this author wrote." + - key: widget:cms_blog_cms_blog_post_blogId;slot:label + summary: "The posts of this blog." + - key: widget:cms_blog_cms_blog_tag_blogId;slot:label + summary: "The tags posts of this blog can carry." + - key: widget:cms_blog_post_cms_blog_post_media_blogPostId;slot:label + summary: "The media files attached to this post, in their order." + - key: widget:cms_blog_post_cms_blog_post_tag_int_blogPostId;slot:label + summary: "The tags on this post." + - key: widget:cms_blog_post_cms_blog_post_version_blogPostId;slot:label + summary: "Versions of this post written for other channels, such as LinkedIn." + - key: widget:cms_blog_tag_cms_blog_post_tag_int_blogTagId;slot:label + summary: "The posts that carry this tag." + - key: widget:cms_media_type_cms_media_mediaTypeId;slot:label + summary: "The files in the media library that are of this kind." + - key: widget:cms_menu_cms_menu_item_menuId;slot:label + summary: "The entries of this menu, in their display order." + - key: widget:cms_menu_item_cms_menu_item_parentId;slot:label + summary: "The entries nested under this menu entry, in their display order." + - key: widget:cms_page_cms_page_parentPageId;slot:label + summary: "The pages that sit under this page, in their order." + - key: widget:cms_page_cms_page_section_pageId;slot:label + summary: "The sections this page is made of, in their order." + - key: widget:cms_photo_album_cms_photo_photoAlbumId;slot:label + summary: "The photos of this album, in their order." + - key: widget:cms_photo_album_folder_cms_photo_album_folder_parentId;slot:label + summary: "The folders inside this folder, in their order." + - key: widget:cms_photo_album_folder_cms_photo_album_photoAlbumFolderId;slot:label + summary: "The albums in this folder, in their order." + - key: widget:cms_photo_cms_photo_tag_int_photoId;slot:label + summary: "The tags on this photo." + - key: widget:cms_photo_tag_cms_photo_tag_int_photoTagId;slot:label + summary: "The photos that carry this tag." + - key: widget:cms_project_category_cms_project_categoryId;slot:label + summary: "The projects in this category, in their order." + - key: widget:cms_project_cms_blog_post_version_projectId;slot:label + summary: "Versions of this project's text written for other channels, such as LinkedIn." + - key: widget:cms_project_cms_photo_album_projectId;slot:label + summary: "The photo albums that belong to this project." + - key: widget:cms_project_cms_project_update_projectId;slot:label + summary: "The dated updates on this project." + - key: widget:cms_project_update_cms_blog_post_version_projectUpdateId;slot:label + summary: "Versions of this update written for other channels, such as LinkedIn." + - key: widget:cms_project_update_cms_photo_album_projectUpdateId;slot:label + summary: "The photo albums that belong to this update." + - key: widget:cms_site_cms_domain_siteId;slot:label + summary: "The host names of this site. One of them is the primary one." + - key: table:cms_author;slot:help + summary: "A person who writes posts. An author is shown with their posts by name, with a picture and links." + - key: table:cms_author;section:author + summary: "The author's name, their address part, whether they are active and a short description." + - key: table:cms_author;section:cms_author_cms_blog_post_authorId + summary: "The posts this author wrote." + - key: table:cms_author;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_author;section:links + summary: "Where readers can find the author: a website, an email address and social profiles." + - key: table:cms_author;section:profile + summary: "The author's picture and their place in lists of authors." + - key: table:cms_author;field:createDate + summary: "When the record was created." + - key: table:cms_author;field:description + summary: "A sentence or two about the author." + - key: table:cms_author;field:displayOrder + summary: "A number that puts authors in order: lower numbers come first." + - key: table:cms_author;field:email + summary: "An email address shown with the author. Leave it empty to show none: whatever is entered here is meant to be public." + - key: table:cms_author;field:id + summary: "System-assigned record identifier." + - key: table:cms_author;field:isActive + summary: "Whether the author is shown and can be chosen for new posts." + - key: table:cms_author;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_author;field:name + summary: "The author's name as readers see it. It must be unique." + - key: table:cms_author;field:profileImageUrl + summary: "The address of the author's picture." + - key: table:cms_author;field:profileMediaId + summary: "The author's picture, from the media library." + - key: table:cms_author;field:shortName + summary: "A short name for the author." + - key: table:cms_author;field:slug + summary: "The part of a public address that names this author. It must be unique." + - key: table:cms_author;field:socialLinks + summary: "The author's social profiles, in the form the website expects (usually a small JSON document of names and addresses)." + - key: table:cms_author;field:website + summary: "The address of the author's own website." + - key: table:cms_blog;slot:help + summary: "A blog of a site: a named stream of posts with its own tags." + - key: table:cms_blog;section:blog + summary: "The name of the blog, its address part, its kind, its site and a description." + - key: table:cms_blog;section:cms_blog_cms_blog_post_blogId + summary: "The posts of this blog." + - key: table:cms_blog;section:cms_blog_cms_blog_tag_blogId + summary: "The tags posts of this blog can carry." + - key: table:cms_blog;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_blog;section:seo + summary: "What search engines and link previews are offered for the blog." + - key: table:cms_blog;field:blogTypeId + summary: "The kind of blog." + - key: table:cms_blog;field:createDate + summary: "When the record was created." + - key: table:cms_blog;field:description + summary: "What the blog is about." + - key: table:cms_blog;field:id + summary: "System-assigned record identifier." + - key: table:cms_blog;field:metaDescription + summary: "The short description offered to search engines and link previews." + - key: table:cms_blog;field:metaKeywords + summary: "Keywords offered to search engines, separated by commas." + - key: table:cms_blog;field:metaTitle + summary: "The title offered to search engines and link previews. Empty means the record's own title is used." + - key: table:cms_blog;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_blog;field:name + summary: "The name of the blog. It must be unique." + - key: table:cms_blog;field:shortName + summary: "A short name for the blog. It must be unique." + - key: table:cms_blog;field:siteId + summary: "The site this record belongs to." + - key: table:cms_blog;field:slug + summary: "The part of a public address that names this blog, for example news. It must be unique within its site." + - key: table:cms_blog_post;slot:help + summary: "A post of a blog: its text, its author, its publication and its image." + content: | + A post of a blog: its title and text, who wrote it, whether and when it is published, its image and what search engines are offered. + - key: table:cms_blog_post;section:blogPost + summary: "The title and names of the post, its address part, its blog and author, and whether and when it is published." + - key: table:cms_blog_post;section:cms_blog_post_cms_blog_post_media_blogPostId + summary: "The media files attached to this post, in their order." + - key: table:cms_blog_post;section:cms_blog_post_cms_blog_post_tag_int_blogPostId + summary: "The tags on this post." + - key: table:cms_blog_post;section:cms_blog_post_cms_blog_post_version_blogPostId + summary: "Versions of this post written for other channels, such as LinkedIn." + - key: table:cms_blog_post;section:content + summary: "The text of the post, a short summary, a description and the reading time." + - key: table:cms_blog_post;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_blog_post;section:featured + summary: "The image shown with the post, and whether the post is featured." + - key: table:cms_blog_post;section:seo + summary: "What search engines and link previews are offered for the post." + - key: table:cms_blog_post;section:usage + summary: "How often the post has been read. Kept by the website that shows it." + - key: table:cms_blog_post;field:authorId + summary: "Who wrote the post." + - key: table:cms_blog_post;field:blogId + summary: "The blog this post belongs to." + - key: table:cms_blog_post;field:content + summary: "The text of the post." + - key: table:cms_blog_post;field:createDate + summary: "When the record was created." + - key: table:cms_blog_post;field:description + summary: "What the post is about, in a sentence." + - key: table:cms_blog_post;field:excerpt + summary: "A short summary, shown in lists and previews." + - key: table:cms_blog_post;field:featuredImage + summary: "The address of the image shown with this record." + - key: table:cms_blog_post;field:featuredMediaId + summary: "The image from the media library that is shown with this record." + - key: table:cms_blog_post;field:id + summary: "System-assigned record identifier." + - key: table:cms_blog_post;field:isFeatured + summary: "Whether the post is put forward, for example on a home page." + - key: table:cms_blog_post;field:isPublished + summary: "Whether the website shows this post. A new post starts as a draft." + - key: table:cms_blog_post;field:metaDescription + summary: "The short description offered to search engines and link previews." + - key: table:cms_blog_post;field:metaKeywords + summary: "Keywords offered to search engines, separated by commas." + - key: table:cms_blog_post;field:metaTitle + summary: "The title offered to search engines and link previews. Empty means the record's own title is used." + - key: table:cms_blog_post;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_blog_post;field:name + summary: "A name for the post, for the people who maintain it. It must be unique within its blog." + - key: table:cms_blog_post;field:publishDate + summary: "When the record was published, or is to be." + - key: table:cms_blog_post;field:readTime + summary: "How long the post takes to read, in minutes." + - key: table:cms_blog_post;field:shortName + summary: "A short name for the post. It must be unique within its blog." + - key: table:cms_blog_post;field:slug + summary: "The part of a public address that names this post, for example first-light. It must be unique within its blog." + - key: table:cms_blog_post;field:title + summary: "The title readers see." + - key: table:cms_blog_post;field:viewCount + summary: "How often the post has been read." + - key: table:cms_blog_post_media;slot:help + summary: "A media file attached to a post, with its place among the post's files and the text shown with it." + - key: table:cms_blog_post_media;section:blogPostMedia + summary: "The post, the file, its place in the order and its addresses." + - key: table:cms_blog_post_media;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_blog_post_media;section:size + summary: "The dimensions of the image in pixels." + - key: table:cms_blog_post_media;section:text + summary: "The text shown with the file on this post." + - key: table:cms_blog_post_media;field:altText + summary: "A description of the image for people who cannot see it." + - key: table:cms_blog_post_media;field:blogPostId + summary: "The post the file is attached to." + - key: table:cms_blog_post_media;field:caption + summary: "A line of text shown with the image." + - key: table:cms_blog_post_media;field:createDate + summary: "When the record was created." + - key: table:cms_blog_post_media;field:height + summary: "The height in pixels." + - key: table:cms_blog_post_media;field:id + summary: "System-assigned record identifier." + - key: table:cms_blog_post_media;field:mediaId + summary: "The file in the media library." + - key: table:cms_blog_post_media;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_blog_post_media;field:sortOrder + summary: "A number that puts records in order: lower numbers come first." + - key: table:cms_blog_post_media;field:thumbnailUrl + summary: "The address of the small version of the image." + - key: table:cms_blog_post_media;field:url + summary: "The address of the file as shown on the post." + - key: table:cms_blog_post_media;field:width + summary: "The width in pixels." + - key: table:cms_blog_post_tag_int;slot:help + summary: "One tag on one post." + - key: table:cms_blog_post_tag_int;section:blogPostTag + summary: "The post and the tag it carries." + - key: table:cms_blog_post_tag_int;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_blog_post_tag_int;field:blogPostId + summary: "The post that carries the tag." + - key: table:cms_blog_post_tag_int;field:blogTagId + summary: "The tag. It must be a tag of the post's blog." + - key: table:cms_blog_post_tag_int;field:createDate + summary: "When the record was created." + - key: table:cms_blog_post_tag_int;field:id + summary: "System-assigned record identifier." + - key: table:cms_blog_post_tag_int;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_blog_post_version;slot:help + summary: "A version of a piece of content written for another channel, for example a shorter text for LinkedIn." + content: | + A version of a piece of content written for another channel, for example a shorter text for LinkedIn. It belongs to one post, one project or one project update. + - key: table:cms_blog_post_version;section:content + summary: "The title and the text of the version, and the format the text is written in." + - key: table:cms_blog_post_version;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_blog_post_version;section:publication + summary: "Where and when the version was published outside the website." + - key: table:cms_blog_post_version;section:source + summary: "Where the text came from, for versions that are generated from a source file." + - key: table:cms_blog_post_version;section:version + summary: "What the version is of, its name and key, the channel it is for and how far it has got." + - key: table:cms_blog_post_version;field:blogPostId + summary: "The post this is a version of. Empty when it is a version of a project or of a project update." + - key: table:cms_blog_post_version;field:channel + summary: "Where the version is meant to be published." + - key: table:cms_blog_post_version;field:content + summary: "The text of the version." + - key: table:cms_blog_post_version;field:contentFormat + summary: "The format the text is written in." + - key: table:cms_blog_post_version;field:createDate + summary: "When the record was created." + - key: table:cms_blog_post_version;field:id + summary: "System-assigned record identifier." + - key: table:cms_blog_post_version;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_blog_post_version;field:name + summary: "A name for the version, for example LinkedIn." + - key: table:cms_blog_post_version;field:projectId + summary: "The project this is a version of. Empty when it is a version of a post or of a project update." + - key: table:cms_blog_post_version;field:projectUpdateId + summary: "The project update this is a version of. Empty when it is a version of a post or of a project." + - key: table:cms_blog_post_version;field:publishedDate + summary: "When the version was published." + - key: table:cms_blog_post_version;field:publishedUrl + summary: "The address at which the version was published." + - key: table:cms_blog_post_version;field:sourceCommit + summary: "The revision of the source the text was generated from." + - key: table:cms_blog_post_version;field:sourceDigest + summary: "A fingerprint of the source the text was generated from." + - key: table:cms_blog_post_version;field:status + summary: "How far the version has got: draft, ready, published externally or archived." + - key: table:cms_blog_post_version;field:title + summary: "The title of this version, when it differs from the original." + - key: table:cms_blog_post_version;field:variantKey + summary: "A short key that tells the versions of one piece of content apart, for example linkedin." + content: | + A short key that tells the versions of one piece of content apart, for example linkedin. It must be unique within the post, project or update. + - key: table:cms_blog_tag;slot:help + summary: "A tag of one blog. Posts of that blog carry it, and readers find posts by it." + - key: table:cms_blog_tag;section:cms_blog_tag_cms_blog_post_tag_int_blogTagId + summary: "The posts that carry this tag." + - key: table:cms_blog_tag;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_blog_tag;section:tag + summary: "The name of the tag, its address part, its blog and a description." + - key: table:cms_blog_tag;field:blogId + summary: "The blog this tag belongs to." + - key: table:cms_blog_tag;field:createDate + summary: "When the record was created." + - key: table:cms_blog_tag;field:description + summary: "What the tag is used for." + - key: table:cms_blog_tag;field:id + summary: "System-assigned record identifier." + - key: table:cms_blog_tag;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_blog_tag;field:name + summary: "The tag as readers see it. It must be unique within its blog." + - key: table:cms_blog_tag;field:slug + summary: "The part of a public address that names this tag. It must be unique within its blog." + - key: table:cms_blog_type;slot:help + summary: "A kind of blog, for example a general site blog or a blog of project updates." + - key: table:cms_blog_type;section:blogType + summary: "The name and code of the kind, whether it is in use, its place in lists and a description." + - key: table:cms_blog_type;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_blog_type;field:code + summary: "A short, stable code for this record, used by the website and by imports. It must be unique." + - key: table:cms_blog_type;field:createDate + summary: "When the record was created." + - key: table:cms_blog_type;field:description + summary: "What blogs of this kind are for." + - key: table:cms_blog_type;field:id + summary: "System-assigned record identifier." + - key: table:cms_blog_type;field:isActive + summary: "Whether the record is in use. Turn it off to retire a record without deleting it." + - key: table:cms_blog_type;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_blog_type;field:name + summary: "The name of the kind. It must be unique." + - key: table:cms_blog_type;field:sortOrder + summary: "A number that puts records in order: lower numbers come first." + - key: table:cms_domain;slot:help + summary: "A host name of a site. A site can have several; one of them is the primary one." + - key: table:cms_domain;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_domain;section:domain + summary: "The host name, the site it belongs to, whether it is the primary one, and its names." + - key: table:cms_domain;field:createDate + summary: "When the record was created." + - key: table:cms_domain;field:description + summary: "What this host name is for." + - key: table:cms_domain;field:fqdn + summary: "The full host name, for example www.example.com. It must be unique." + - key: table:cms_domain;field:id + summary: "System-assigned record identifier." + - key: table:cms_domain;field:isPrimary + summary: "Whether this is the main host name of the site." + - key: table:cms_domain;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_domain;field:name + summary: "A name for this host name. It must be unique." + - key: table:cms_domain;field:shortName + summary: "A short name for this host name. It must be unique." + - key: table:cms_domain;field:siteId + summary: "The site this host name belongs to." + - key: table:cms_media;slot:help + summary: "A file in the media library of a site: an image, a video, a document or another file that content refers to." + content: | + A file in the media library of a site: an image, a video, a document or another file that content refers to. In this release a record points at a file by its address; the CMS does not upload or store files itself. + - key: table:cms_media;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_media;section:file + summary: "What the file is: its name, type, size and dimensions." + content: | + What the file is: its name, type, size and dimensions. The values a person cannot change are filled in when a file is stored by an upload. + - key: table:cms_media;section:media + summary: "The name of the file, its address, its kind, its site and whether it is in use." + - key: table:cms_media;section:renditions + summary: "The addresses of the smaller versions of an image." + - key: table:cms_media;section:textAndCredit + summary: "The text that goes with the file: alternative text, a caption, a credit and a license." + - key: table:cms_media;field:altText + summary: "A description of the image for people who cannot see it." + - key: table:cms_media;field:caption + summary: "A line of text shown with the image." + - key: table:cms_media;field:checksum + summary: "A fingerprint of the file's content, by which two copies of the same file are recognised." + - key: table:cms_media;field:createDate + summary: "When the record was created." + - key: table:cms_media;field:credit + summary: "Who made the file, as it is to be credited." + - key: table:cms_media;field:description + summary: "What the file shows or contains." + - key: table:cms_media;field:duration + summary: "The length of a video or sound file in seconds." + - key: table:cms_media;field:fileExtension + summary: "The extension of the file, for example jpg." + - key: table:cms_media;field:fileName + summary: "The name the file had when it was uploaded." + - key: table:cms_media;field:fileSize + summary: "The size of the file in bytes." + - key: table:cms_media;field:galleryUrl + summary: "The address of the medium version of the image, used on pages." + - key: table:cms_media;field:height + summary: "The height in pixels." + - key: table:cms_media;field:id + summary: "System-assigned record identifier." + - key: table:cms_media;field:isActive + summary: "Whether the file may be chosen for content. Turn it off to retire a file without deleting it." + - key: table:cms_media;field:license + summary: "The license under which the file may be used." + - key: table:cms_media;field:mediaTypeId + summary: "The kind of file, which sets the rules for it." + - key: table:cms_media;field:mimeType + summary: "The type of the file, for example image/jpeg. A preview is shown for images." + - key: table:cms_media;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_media;field:name + summary: "The name of the file in the library, for the people who pick it." + - key: table:cms_media;field:publicUrl + summary: "The address at which the file is reached. For an image this is the version shown on pages." + - key: table:cms_media;field:siteId + summary: "The site this record belongs to." + - key: table:cms_media;field:slideshowUrl + summary: "The address of the large version of the image, used full screen." + - key: table:cms_media;field:slug + summary: "A short name for the file: lower-case letters, digits and hyphens." + - key: table:cms_media;field:storageKey + summary: "Where the file is kept in storage. Filled in when a file is stored by an upload." + - key: table:cms_media;field:thumbnailUrl + summary: "The address of the small version of the image, used in lists." + - key: table:cms_media;field:width + summary: "The width in pixels." + - key: table:cms_media_type;slot:help + summary: "A kind of media file, such as image, video or document, with the rules for files of that kind." + content: | + A kind of media file, such as image, video or document, with the rules for files of that kind: what may be uploaded, which versions of an image are made, which text is required, and how files are cached and stored. The rules are read by whatever uploads files; this release of the CMS has no upload of its own. + - key: table:cms_media_type;section:cacheStorage + summary: "How long files of this kind may be cached, and the storage folder new files go to." + - key: table:cms_media_type;section:cms_media_type_cms_media_mediaTypeId + summary: "The files in the media library that are of this kind." + - key: table:cms_media_type;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_media_type;section:mediaType + summary: "The name and code of the kind, whether it is in use and its place in lists." + - key: table:cms_media_type;section:privacy + summary: "What is removed from uploads, which text is required, and the default credit and license." + content: | + What is removed from uploaded images, which text a file of this kind must have, and the credit and license it gets when none is given. + - key: table:cms_media_type;section:renditions + summary: "The smaller versions made of an uploaded image: thumbnail, gallery and slideshow." + content: | + The smaller versions made of an uploaded image (thumbnail, gallery and slideshow): whether each is made, how wide, in which format and at which quality. + - key: table:cms_media_type;section:uploadRules + summary: "Which files of this kind are accepted: their types, their extensions and their largest size." + - key: table:cms_media_type;field:allowedExtensions + summary: "The file extensions that are accepted, separated by commas and without dots, for example jpg, png." + content: | + The file extensions that are accepted, separated by commas and without dots, for example jpg, png. Empty accepts any extension. + - key: table:cms_media_type;field:allowedMimeTypes + summary: "The file types that are accepted, separated by commas. Empty accepts any type." + content: | + The file types that are accepted, separated by commas, for example image/jpeg, image/png or image/*. Empty accepts any type. + - key: table:cms_media_type;field:cacheClass + summary: "How long browsers and content delivery networks may keep files of this kind." + - key: table:cms_media_type;field:code + summary: "A short, stable code for this record, used by the website and by imports. It must be unique." + - key: table:cms_media_type;field:createDate + summary: "When the record was created." + - key: table:cms_media_type;field:defaultCredit + summary: "The credit a file of this kind gets when none is given." + - key: table:cms_media_type;field:defaultLicense + summary: "The license a file of this kind gets when none is given." + - key: table:cms_media_type;field:description + summary: "What files of this kind are." + - key: table:cms_media_type;field:galleryEnabled + summary: "Whether a gallery version is made of an uploaded image of this kind." + - key: table:cms_media_type;field:galleryFormat + summary: "The image format the gallery version is written in." + - key: table:cms_media_type;field:galleryQuality + summary: "The JPEG or WebP quality of the gallery version, from 1 to 100. Empty means 85." + - key: table:cms_media_type;field:galleryWidth + summary: "The largest width of the gallery version, in pixels. Empty keeps the built-in width." + - key: table:cms_media_type;field:id + summary: "System-assigned record identifier." + - key: table:cms_media_type;field:isActive + summary: "Whether the record is in use. Turn it off to retire a record without deleting it." + - key: table:cms_media_type;field:maxFileSizeMb + summary: "The largest file that is accepted, in megabytes. Empty sets no limit of its own." + - key: table:cms_media_type;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_media_type;field:name + summary: "The name of the kind, for example Image." + - key: table:cms_media_type;field:requireAltText + summary: "Whether a file of this kind must have alternative text." + - key: table:cms_media_type;field:requireCaption + summary: "Whether a file of this kind must have a caption." + - key: table:cms_media_type;field:slideshowEnabled + summary: "Whether a slideshow version is made of an uploaded image of this kind." + - key: table:cms_media_type;field:slideshowFormat + summary: "The image format the slideshow version is written in." + - key: table:cms_media_type;field:slideshowQuality + summary: "The JPEG or WebP quality of the slideshow version, from 1 to 100. Empty means 85." + - key: table:cms_media_type;field:slideshowWidth + summary: "The largest width of the slideshow version, in pixels. Empty keeps the built-in width." + - key: table:cms_media_type;field:sortOrder + summary: "A number that puts records in order: lower numbers come first." + - key: table:cms_media_type;field:storagePrefix + summary: "The storage folder new files of this kind go to, for example media." + - key: table:cms_media_type;field:stripMetadata + summary: "Whether camera data, location and other embedded data are removed from an uploaded image." + - key: table:cms_media_type;field:thumbnailEnabled + summary: "Whether a thumbnail version is made of an uploaded image of this kind." + - key: table:cms_media_type;field:thumbnailFormat + summary: "The image format the thumbnail version is written in." + - key: table:cms_media_type;field:thumbnailQuality + summary: "The JPEG or WebP quality of the thumbnail version, from 1 to 100. Empty means 85." + - key: table:cms_media_type;field:thumbnailWidth + summary: "The largest width of the thumbnail version, in pixels. Empty keeps the built-in width." + - key: table:cms_menu;slot:help + summary: "A navigation menu of a site, for example the header menu or the footer menu." + - key: table:cms_menu;section:cms_menu_cms_menu_item_menuId + summary: "The entries of this menu, in their display order." + - key: table:cms_menu;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_menu;section:menu + summary: "The name of the menu, its address part, its kind, its site and whether it is in use." + - key: table:cms_menu;field:createDate + summary: "When the record was created." + - key: table:cms_menu;field:description + summary: "What the menu is for." + - key: table:cms_menu;field:id + summary: "System-assigned record identifier." + - key: table:cms_menu;field:isActive + summary: "Whether the menu is in use." + - key: table:cms_menu;field:menuType + summary: "The kind of menu, for example header or footer, as the website understands it." + - key: table:cms_menu;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_menu;field:name + summary: "The name of the menu." + - key: table:cms_menu;field:siteId + summary: "The site this menu belongs to." + - key: table:cms_menu;field:slug + summary: "The short name by which the website refers to this menu, for example header. It must be unique within its site." + - key: table:cms_menu_item;slot:help + summary: "One entry of a menu: a link or a route of the site. Entries are ordered and can be nested under another entry." + - key: table:cms_menu_item;section:cms_menu_item_cms_menu_item_parentId + summary: "The entries nested under this entry, in their display order." + - key: table:cms_menu_item;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_menu_item;section:display + summary: "How the entry looks: its icon, its style classes and a description." + - key: table:cms_menu_item;section:menuItem + summary: "The name of the entry, its menu, the entry it sits under, its kind, its place and whether it is in use." + - key: table:cms_menu_item;section:target + summary: "Where the entry leads: an outside address or a route of the site, and where it opens." + - key: table:cms_menu_item;field:createDate + summary: "When the record was created." + - key: table:cms_menu_item;field:cssClasses + summary: "Style class names the website puts on this entry." + - key: table:cms_menu_item;field:description + summary: "A description of the entry." + - key: table:cms_menu_item;field:displayOrder + summary: "A number that puts records in order: lower numbers come first." + - key: table:cms_menu_item;field:icon + summary: "The name of an icon shown with the entry." + - key: table:cms_menu_item;field:id + summary: "System-assigned record identifier." + - key: table:cms_menu_item;field:isActive + summary: "Whether the entry is shown." + - key: table:cms_menu_item;field:itemType + summary: "The kind of entry, as the website understands it: a link to an address or a route of the site, for example." + - key: table:cms_menu_item;field:linkUrl + summary: "The address the entry leads to, for an entry that links outside the site." + - key: table:cms_menu_item;field:menuId + summary: "The menu this entry belongs to." + - key: table:cms_menu_item;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_menu_item;field:name + summary: "The text of the entry, as readers see it." + - key: table:cms_menu_item;field:parentId + summary: "The entry this entry is nested under. Empty for an entry at the top of the menu." + - key: table:cms_menu_item;field:routePath + summary: "The route of the site the entry leads to, for example /about-us." + - key: table:cms_menu_item;field:slug + summary: "A short name for the entry." + - key: table:cms_menu_item;field:target + summary: "Where the link opens: the same window or a new one." + content: | + Where the link opens: `_self` for the same window, `_blank` for a new one. + - key: table:cms_page;slot:help + summary: "A page of a site. A page is made of ordered sections and can sit under a parent page." + - key: table:cms_page;section:cms_page_cms_page_parentPageId + summary: "The pages that sit under this page, in their order." + - key: table:cms_page;section:cms_page_cms_page_section_pageId + summary: "The sections this page is made of, in their order." + - key: table:cms_page;section:content + summary: "The text of the page itself. Its sections are listed separately." + - key: table:cms_page;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_page;section:page + summary: "What the page is: its title, name, address part, site, kind and template, and whether and when it is published." + - key: table:cms_page;section:seo + summary: "What search engines and link previews are told about the page: its description, keywords and preview image." + - key: table:cms_page;section:structure + summary: "Where the page sits: its parent page and its place among the pages beside it." + - key: table:cms_page;field:content + summary: "The text of the page itself." + - key: table:cms_page;field:createDate + summary: "When the record was created." + - key: table:cms_page;field:id + summary: "System-assigned record identifier." + - key: table:cms_page;field:isPublished + summary: "Whether the page is published. A page that is not published is a draft." + - key: table:cms_page;field:metaDescription + summary: "The short description of the page that search engines show." + - key: table:cms_page;field:metaKeywords + summary: "Keywords for the page, separated by commas." + - key: table:cms_page;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_page;field:name + summary: "A name for the page, for the people who maintain it." + - key: table:cms_page;field:ogImage + summary: "The address of the picture shown when the page is shared as a link." + - key: table:cms_page;field:pageTypeId + summary: "The kind of page." + - key: table:cms_page;field:parentPageId + summary: "The page this page sits under. Empty for a page at the top of the site." + - key: table:cms_page;field:publishDate + summary: "When the page is, or was, published." + - key: table:cms_page;field:siteId + summary: "The site this page belongs to." + - key: table:cms_page;field:slug + summary: "The part of the address that names this page, for example about-us." + content: | + The part of the address that names this page, for example about-us. It must be unique within its site and under its parent page. + - key: table:cms_page;field:sortOrder + summary: "A number that puts records in order: lower numbers come first." + - key: table:cms_page;field:template + summary: "The name of the layout the website uses to show this page." + - key: table:cms_page;field:title + summary: "The title of the page, as readers see it." + - key: table:cms_page_section;slot:help + summary: "One section of a page. Sections are shown in their order; what a section holds is read according to its kind." + - key: table:cms_page_section;section:content + summary: "What the section holds. How it is read depends on the kind of section." + - key: table:cms_page_section;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_page_section;section:pageSection + summary: "The name of the section, its page, its kind, its place on the page and its styling." + - key: table:cms_page_section;field:content + summary: "What the section holds. How it is read depends on the kind of section." + - key: table:cms_page_section;field:createDate + summary: "When the record was created." + - key: table:cms_page_section;field:cssClassName + summary: "A style class name the website puts on this section." + - key: table:cms_page_section;field:id + summary: "System-assigned record identifier." + - key: table:cms_page_section;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_page_section;field:name + summary: "A name for the section, for the people who maintain it." + - key: table:cms_page_section;field:pageId + summary: "The page this section belongs to." + - key: table:cms_page_section;field:sectionTypeId + summary: "The kind of section, which decides how its content is shown." + - key: table:cms_page_section;field:sortOrder + summary: "A number that puts records in order: lower numbers come first." + - key: table:cms_page_section_type;slot:help + summary: "A kind of page section. The website shows a section according to the code of its kind. Reference data." + - key: table:cms_page_section_type;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_page_section_type;section:pageSectionType + summary: "The name and code of this kind of section, and whether and where it is offered." + - key: table:cms_page_section_type;field:code + summary: "The code the website uses to decide how to show a section of this kind. It must be unique." + - key: table:cms_page_section_type;field:createDate + summary: "When the record was created." + - key: table:cms_page_section_type;field:description + summary: "What this kind of section is for." + - key: table:cms_page_section_type;field:id + summary: "System-assigned record identifier." + - key: table:cms_page_section_type;field:isActive + summary: "Whether this kind of section is offered." + - key: table:cms_page_section_type;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_page_section_type;field:name + summary: "The name of this kind of section. It must be unique." + - key: table:cms_page_section_type;field:sortOrder + summary: "A number that puts records in order: lower numbers come first." + - key: table:cms_page_type;slot:help + summary: "A kind of page. Reference data." + - key: table:cms_page_type;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_page_type;section:pageType + summary: "The name and code of this kind of page, and whether and where it is offered." + - key: table:cms_page_type;field:code + summary: "A short code for this kind of page. It must be unique." + - key: table:cms_page_type;field:createDate + summary: "When the record was created." + - key: table:cms_page_type;field:description + summary: "What this kind of page is for." + - key: table:cms_page_type;field:id + summary: "System-assigned record identifier." + - key: table:cms_page_type;field:isActive + summary: "Whether this kind of page is offered." + - key: table:cms_page_type;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_page_type;field:name + summary: "The name of this kind of page. It must be unique." + - key: table:cms_page_type;field:sortOrder + summary: "A number that puts records in order: lower numbers come first." + - key: table:cms_photo;slot:help + summary: "A photo in an album: its title and text, its image in several sizes, what the file is, and the data the camera recorded." + - key: table:cms_photo;section:cms_photo_cms_photo_tag_int_photoId + summary: "The tags on this photo." + - key: table:cms_photo;section:content + summary: "A description of the photo, its score, and whether it is a favourite or the album's cover." + - key: table:cms_photo;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_photo;section:exif + summary: "What the camera recorded when the photo was taken: date, camera, lens, exposure and position." + - key: table:cms_photo;section:file + summary: "What the file is: its name, type, size and dimensions." + content: | + What the file is: its name, type, size and dimensions. The values a person cannot change are filled in when a file is stored by an upload. + - key: table:cms_photo;section:photo + summary: "The photo itself: its title, album, file, caption, publication and place in the album." + content: | + The title of the photo, its address part, its album, its file in the media library, a caption, whether and when it is published, and its place in the album. + - key: table:cms_photo;section:renditions + summary: "The addresses of the photo in its original size and in its smaller versions." + - key: table:cms_photo;field:caption + summary: "A line of text shown with the image." + - key: table:cms_photo;field:createDate + summary: "When the record was created." + - key: table:cms_photo;field:description + summary: "What the photo shows." + - key: table:cms_photo;field:exifAperture + summary: "The aperture, for example f/2.8." + - key: table:cms_photo;field:exifCameraMake + summary: "The maker of the camera." + - key: table:cms_photo;field:exifCameraModel + summary: "The model of the camera." + - key: table:cms_photo;field:exifDateTaken + summary: "When the photo was taken, according to the camera." + - key: table:cms_photo;field:exifFlash + summary: "Whether and how the flash fired." + - key: table:cms_photo;field:exifFocalLength + summary: "The focal length, for example 35mm." + - key: table:cms_photo;field:exifGpsLatitude + summary: "The latitude at which the photo was taken, in degrees. Leave it empty to publish no position." + - key: table:cms_photo;field:exifGpsLongitude + summary: "The longitude at which the photo was taken, in degrees. Leave it empty to publish no position." + - key: table:cms_photo;field:exifIso + summary: "The ISO sensitivity." + - key: table:cms_photo;field:exifLensModel + summary: "The lens the photo was taken with." + - key: table:cms_photo;field:exifShutterSpeed + summary: "The shutter speed, for example 1/250." + - key: table:cms_photo;field:exifWhiteBalance + summary: "The white balance setting." + - key: table:cms_photo;field:fileSize + summary: "The size of the file in bytes." + - key: table:cms_photo;field:galleryUrl + summary: "The address of the medium version of the image, used on pages." + - key: table:cms_photo;field:height + summary: "The height in pixels." + - key: table:cms_photo;field:id + summary: "System-assigned record identifier." + - key: table:cms_photo;field:isAlbumCover + summary: "Whether this photo is the cover of its album." + - key: table:cms_photo;field:isFavorite + summary: "Whether the photo is marked as a favourite." + - key: table:cms_photo;field:isPublished + summary: "Whether the website shows this record. A new record starts unpublished." + - key: table:cms_photo;field:mediaId + summary: "The photo's file in the media library." + - key: table:cms_photo;field:mimeType + summary: "The type of the file, for example image/jpeg. A preview is shown for images." + - key: table:cms_photo;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_photo;field:originalFilename + summary: "The name the file had when it was uploaded." + - key: table:cms_photo;field:originalUrl + summary: "The address of the photo in its original size." + - key: table:cms_photo;field:photoAlbumId + summary: "The album this photo is in." + - key: table:cms_photo;field:publishDate + summary: "When the record was published, or is to be." + - key: table:cms_photo;field:score + summary: "A rating of the photo. Higher is better; what the numbers mean is up to the site." + - key: table:cms_photo;field:slideshowUrl + summary: "The address of the large version of the image, used full screen." + - key: table:cms_photo;field:slug + summary: "The part of a public address that names this photo. It must be unique within its album." + - key: table:cms_photo;field:sortOrder + summary: "A number that puts records in order: lower numbers come first." + - key: table:cms_photo;field:storageKey + summary: "Where the file is kept in storage. Filled in when a file is stored by an upload." + - key: table:cms_photo;field:thumbnailUrl + summary: "The address of the small version of the image, used in lists." + - key: table:cms_photo;field:title + summary: "The title readers see." + - key: table:cms_photo;field:width + summary: "The width in pixels." + - key: table:cms_photo_album;slot:help + summary: "An album of photos of a site. An album can sit in a folder, and can belong to a project or to a project update." + - key: table:cms_photo_album;section:album + summary: "The album itself: its names, site, folder, project, publication and place in lists." + content: | + The names of the album, its address part, its site and folder, the project or update it belongs to, whether and when it is published, and its place in lists. + - key: table:cms_photo_album;section:cms_photo_album_cms_photo_photoAlbumId + summary: "The photos of this album, in their order." + - key: table:cms_photo_album;section:content + summary: "The title and description of the album and its cover." + - key: table:cms_photo_album;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_photo_album;section:location + summary: "Where the photos were taken." + - key: table:cms_photo_album;section:seo + summary: "What search engines and link previews are offered for the album." + - key: table:cms_photo_album;section:shoot + summary: "When the photos were taken, with which camera and lens, and in what weather." + - key: table:cms_photo_album;field:albumDate + summary: "When the photos were taken, or when the shoot started." + - key: table:cms_photo_album;field:albumEndDate + summary: "When the shoot ended, for one that took more than a day." + - key: table:cms_photo_album;field:coverImageUrl + summary: "The address of the album's cover image." + - key: table:cms_photo_album;field:coverPhotoId + summary: "The photo that is the album's cover." + - key: table:cms_photo_album;field:createDate + summary: "When the record was created." + - key: table:cms_photo_album;field:description + summary: "What the album shows." + - key: table:cms_photo_album;field:id + summary: "System-assigned record identifier." + - key: table:cms_photo_album;field:isPublished + summary: "Whether the website shows this record. A new record starts unpublished." + - key: table:cms_photo_album;field:location + summary: "Where the photos were taken, as readers see it." + - key: table:cms_photo_album;field:locationLatitude + summary: "The latitude of the place, in degrees." + - key: table:cms_photo_album;field:locationLongitude + summary: "The longitude of the place, in degrees." + - key: table:cms_photo_album;field:metaDescription + summary: "The short description offered to search engines and link previews." + - key: table:cms_photo_album;field:metaTitle + summary: "The title offered to search engines and link previews. Empty means the record's own title is used." + - key: table:cms_photo_album;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_photo_album;field:name + summary: "A name for the record, for the people who maintain it." + - key: table:cms_photo_album;field:photoAlbumFolderId + summary: "The folder this album is in. Empty for an album that is in no folder." + - key: table:cms_photo_album;field:primaryCamera + summary: "The camera most of the photos were taken with." + - key: table:cms_photo_album;field:primaryLens + summary: "The lens most of the photos were taken with." + - key: table:cms_photo_album;field:projectId + summary: "The project this album belongs to, if any." + - key: table:cms_photo_album;field:projectUpdateId + summary: "The project update this album belongs to, if any." + - key: table:cms_photo_album;field:publishDate + summary: "When the record was published, or is to be." + - key: table:cms_photo_album;field:shortName + summary: "A short name for the album. It must be unique within its site." + - key: table:cms_photo_album;field:siteId + summary: "The site this record belongs to." + - key: table:cms_photo_album;field:slug + summary: "The part of a public address that names this album. It must be unique within its site." + - key: table:cms_photo_album;field:sortOrder + summary: "A number that puts records in order: lower numbers come first." + - key: table:cms_photo_album;field:title + summary: "The title readers see." + - key: table:cms_photo_album;field:weather + summary: "The weather during the shoot." + - key: table:cms_photo_album_folder;slot:help + summary: "A folder of photo albums of a site. Folders can sit inside other folders." + - key: table:cms_photo_album_folder;section:cms_photo_album_folder_cms_photo_album_folder_parentId + summary: "The folders inside this folder, in their order." + - key: table:cms_photo_album_folder;section:cms_photo_album_folder_cms_photo_album_photoAlbumFolderId + summary: "The albums in this folder, in their order." + - key: table:cms_photo_album_folder;section:content + summary: "A description of the folder and the image shown for it." + - key: table:cms_photo_album_folder;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_photo_album_folder;section:folder + summary: "The folder itself: its name, site, parent folder, publication and place in lists." + content: | + The name of the folder, its address part, its site, the folder it sits in, whether it is published and its place in lists. + - key: table:cms_photo_album_folder;section:seo + summary: "What search engines and link previews are offered for the folder." + - key: table:cms_photo_album_folder;field:createDate + summary: "When the record was created." + - key: table:cms_photo_album_folder;field:description + summary: "What this record is, in a sentence or two." + - key: table:cms_photo_album_folder;field:folderImageUrl + summary: "The address of the image shown for the folder." + - key: table:cms_photo_album_folder;field:id + summary: "System-assigned record identifier." + - key: table:cms_photo_album_folder;field:isPublished + summary: "Whether the website shows this record. A new record starts unpublished." + - key: table:cms_photo_album_folder;field:metaDescription + summary: "The short description offered to search engines and link previews." + - key: table:cms_photo_album_folder;field:metaTitle + summary: "The title offered to search engines and link previews. Empty means the record's own title is used." + - key: table:cms_photo_album_folder;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_photo_album_folder;field:name + summary: "The name of the folder as readers see it." + - key: table:cms_photo_album_folder;field:parentId + summary: "The folder this folder sits in. Empty for a folder at the top." + - key: table:cms_photo_album_folder;field:siteId + summary: "The site this record belongs to." + - key: table:cms_photo_album_folder;field:slug + summary: "The part of a public address that names this folder. It must be unique within its site." + - key: table:cms_photo_album_folder;field:sortOrder + summary: "A number that puts records in order: lower numbers come first." + - key: table:cms_photo_tag;slot:help + summary: "A tag for photos. Photos carry it, and readers find photos by it." + - key: table:cms_photo_tag;section:cms_photo_tag_cms_photo_tag_int_photoTagId + summary: "The photos that carry this tag." + - key: table:cms_photo_tag;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_photo_tag;section:tag + summary: "The name of the tag, its address part and a description." + - key: table:cms_photo_tag;field:createDate + summary: "When the record was created." + - key: table:cms_photo_tag;field:description + summary: "What the tag is used for." + - key: table:cms_photo_tag;field:id + summary: "System-assigned record identifier." + - key: table:cms_photo_tag;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_photo_tag;field:name + summary: "The tag as readers see it. It must be unique." + - key: table:cms_photo_tag;field:slug + summary: "The part of a public address that names this tag. It must be unique." + - key: table:cms_photo_tag_int;slot:help + summary: "One tag on one photo." + - key: table:cms_photo_tag_int;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_photo_tag_int;section:photoTag + summary: "The photo and the tag it carries." + - key: table:cms_photo_tag_int;field:createDate + summary: "When the record was created." + - key: table:cms_photo_tag_int;field:id + summary: "System-assigned record identifier." + - key: table:cms_photo_tag_int;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_photo_tag_int;field:photoId + summary: "The photo that carries the tag." + - key: table:cms_photo_tag_int;field:photoTagId + summary: "The tag." + - key: table:cms_project;slot:help + summary: "A project of a site: its text, its state, its links, its image and its dates." + - key: table:cms_project;section:cms_project_cms_blog_post_version_projectId + summary: "Versions of this project's text written for other channels, such as LinkedIn." + - key: table:cms_project;section:cms_project_cms_photo_album_projectId + summary: "The photo albums that belong to this project." + - key: table:cms_project;section:cms_project_cms_project_update_projectId + summary: "The dated updates on this project." + - key: table:cms_project;section:content + summary: "A description of the project and the text of its page." + - key: table:cms_project;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_project;section:featured + summary: "The image shown with the project, its text, and the point that stays in view when it is cropped." + content: | + The image shown with the project, the text that goes with it, and the point of the image that stays in view when it is cropped. + - key: table:cms_project;section:links + summary: "Where the project can be found: its source and where it runs." + - key: table:cms_project;section:project + summary: "The project itself: its title and names, site, category, state, publication and place in lists." + content: | + The title and names of the project, its address part, its site and category, its state, whether and when it is published, and its place in lists. + - key: table:cms_project;section:projectDates + summary: "When the project started and when it ended." + - key: table:cms_project;field:categoryId + summary: "The category this project is in." + - key: table:cms_project;field:content + summary: "The text of the project's page." + - key: table:cms_project;field:createDate + summary: "When the record was created." + - key: table:cms_project;field:description + summary: "What the project is, in a few sentences." + - key: table:cms_project;field:endDate + summary: "When the project ended. Empty for a project that is still going." + - key: table:cms_project;field:featuredImage + summary: "The address of the image shown with this record." + - key: table:cms_project;field:featuredMediaId + summary: "The image from the media library that is shown with this record." + - key: table:cms_project;field:githubUrl + summary: "The address of the project's source, for a project that has one." + - key: table:cms_project;field:id + summary: "System-assigned record identifier." + - key: table:cms_project;field:imageAlt + summary: "A description of the image for people who cannot see it." + - key: table:cms_project;field:imageCaption + summary: "A line of text shown with the image." + - key: table:cms_project;field:imageFocalX + summary: "The point of the image that stays in view when it is cropped, from the left edge in percent. 50 is the middle." + - key: table:cms_project;field:imageFocalY + summary: "The point of the image that stays in view when it is cropped, from the top edge in percent. 50 is the middle." + - key: table:cms_project;field:isFeatured + summary: "Whether the project is put forward, for example on a home page." + - key: table:cms_project;field:isPublished + summary: "Whether the website shows this record. A new record starts unpublished." + - key: table:cms_project;field:liveUrl + summary: "The address at which the project runs or can be seen." + - key: table:cms_project;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_project;field:name + summary: "A name for the record, for the people who maintain it." + - key: table:cms_project;field:projectStatus + summary: "The state of the project: planned, in progress, active or archived." + - key: table:cms_project;field:publishDate + summary: "When the record was published, or is to be." + - key: table:cms_project;field:shortName + summary: "A short name for the project." + - key: table:cms_project;field:siteId + summary: "The site this record belongs to." + - key: table:cms_project;field:slug + summary: "The part of a public address that names this project. It must be unique within its site." + - key: table:cms_project;field:sortOrder + summary: "A number that puts records in order: lower numbers come first." + - key: table:cms_project;field:startDate + summary: "When the project started." + - key: table:cms_project;field:title + summary: "The title readers see." + - key: table:cms_project_category;slot:help + summary: "A group of projects of a site, with its own title, text and image." + - key: table:cms_project_category;section:cms_project_category_cms_project_categoryId + summary: "The projects in this category, in their order." + - key: table:cms_project_category;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_project_category;section:featured + summary: "The image shown with the category." + - key: table:cms_project_category;section:projectCategory + summary: "The title and name of the category, its address part, its site, its place in lists and whether it is published." + - key: table:cms_project_category;field:createDate + summary: "When the record was created." + - key: table:cms_project_category;field:description + summary: "What the projects in this category have in common." + - key: table:cms_project_category;field:featuredImage + summary: "The address of the image shown with this record." + - key: table:cms_project_category;field:featuredMediaId + summary: "The image from the media library that is shown with this record." + - key: table:cms_project_category;field:id + summary: "System-assigned record identifier." + - key: table:cms_project_category;field:isPublished + summary: "Whether the website shows this record. A new record starts unpublished." + - key: table:cms_project_category;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_project_category;field:name + summary: "A name for the category, for the people who maintain it." + - key: table:cms_project_category;field:section + summary: "A grouping code the site chooses for its categories, for example an area of the site. Optional." + - key: table:cms_project_category;field:siteId + summary: "The site this record belongs to." + - key: table:cms_project_category;field:slug + summary: "The part of a public address that names this category. It must be unique within its site." + - key: table:cms_project_category;field:sortOrder + summary: "A number that puts records in order: lower numbers come first." + - key: table:cms_project_category;field:title + summary: "The title readers see." + - key: table:cms_project_update;slot:help + summary: "A dated update on a project: what happened, with its own text and image." + - key: table:cms_project_update;section:cms_project_update_cms_blog_post_version_projectUpdateId + summary: "Versions of this update written for other channels, such as LinkedIn." + - key: table:cms_project_update;section:cms_project_update_cms_photo_album_projectUpdateId + summary: "The photo albums that belong to this update." + - key: table:cms_project_update;section:content + summary: "A short summary and the text of the update." + - key: table:cms_project_update;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_project_update;section:featured + summary: "The image shown with the update." + - key: table:cms_project_update;section:projectUpdate + summary: "The update itself: its title, project, date, publication and place in lists." + content: | + The title of the update, its address part, its project, its date, whether and when it is published, and its place in lists. + - key: table:cms_project_update;field:content + summary: "The text of the update." + - key: table:cms_project_update;field:createDate + summary: "When the record was created." + - key: table:cms_project_update;field:excerpt + summary: "A short summary, shown in lists and previews." + - key: table:cms_project_update;field:featuredImage + summary: "The address of the image shown with this record." + - key: table:cms_project_update;field:featuredMediaId + summary: "The image from the media library that is shown with this record." + - key: table:cms_project_update;field:id + summary: "System-assigned record identifier." + - key: table:cms_project_update;field:isPublished + summary: "Whether the website shows this record. A new record starts unpublished." + - key: table:cms_project_update;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_project_update;field:projectId + summary: "The project this update is about." + - key: table:cms_project_update;field:publishDate + summary: "When the record was published, or is to be." + - key: table:cms_project_update;field:slug + summary: "The part of a public address that names this update. It must be unique within its project." + - key: table:cms_project_update;field:sortOrder + summary: "A number that puts records in order: lower numbers come first." + - key: table:cms_project_update;field:title + summary: "The title readers see." + - key: table:cms_project_update;field:updateDate + summary: "The date the update is about. Updates are shown in the order of this date." + - key: table:cms_redirect;slot:help + summary: "A redirect of a public address: a request whose path matches the source path is sent to the target path." + - key: table:cms_redirect;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_redirect;section:matching + summary: "How the source path is compared, which redirect wins, and whether and until when it applies." + content: | + How the source path is compared with a request, which redirect wins when several match, and whether and until when this one applies. + - key: table:cms_redirect;section:redirect + summary: "What is redirected where: the source path, the target path, the kind of redirect and the site." + - key: table:cms_redirect;section:usage + summary: "How often this redirect has been followed and when it last was. Kept by the website that serves the redirects." + - key: table:cms_redirect;field:createDate + summary: "When the record was created." + - key: table:cms_redirect;field:description + summary: "Why the redirect exists." + - key: table:cms_redirect;field:expiryDate + summary: "A moment after which the redirect no longer applies. Empty means it does not expire." + - key: table:cms_redirect;field:hitCount + summary: "How many times the redirect has been followed. It cannot be edited." + - key: table:cms_redirect;field:id + summary: "System-assigned record identifier." + - key: table:cms_redirect;field:isActive + summary: "Whether the redirect applies. Turn it off to stop a redirect without deleting it." + - key: table:cms_redirect;field:lastHitDate + summary: "When the redirect was last followed. It cannot be edited." + - key: table:cms_redirect;field:matchType + summary: "How the source path is compared with a requested path: the exact path, a path prefix, or a regular expression." + - key: table:cms_redirect;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_redirect;field:name + summary: "A name for the redirect, for the people who maintain it." + - key: table:cms_redirect;field:preserveQueryParams + summary: "Whether the query parameters of the request are carried over to the target." + - key: table:cms_redirect;field:priority + summary: "Which redirect is used when more than one matches a request." + - key: table:cms_redirect;field:redirectTypeId + summary: "The kind of redirect, which sets the HTTP status that is answered (301 permanent or 302 temporary, for example)." + - key: table:cms_redirect;field:siteId + summary: "The site this redirect belongs to." + - key: table:cms_redirect;field:sourcePath + summary: "The path that is redirected, for example /old-page. How it is compared with a request is set by Match Type." + - key: table:cms_redirect;field:targetPath + summary: "Where the request is sent." + - key: table:cms_redirect_type;slot:help + summary: "A kind of redirect and the HTTP status it answers with, for example 301 and 302. Reference data." + - key: table:cms_redirect_type;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_redirect_type;section:redirectType + summary: "The name and code of this kind of redirect, its HTTP status, and whether and where it is offered." + - key: table:cms_redirect_type;field:code + summary: "A short code for this kind of redirect. It must be unique." + - key: table:cms_redirect_type;field:createDate + summary: "When the record was created." + - key: table:cms_redirect_type;field:description + summary: "What this kind of redirect is for." + - key: table:cms_redirect_type;field:httpStatusCode + summary: "The HTTP status a redirect of this kind answers with, for example 301 or 302." + - key: table:cms_redirect_type;field:id + summary: "System-assigned record identifier." + - key: table:cms_redirect_type;field:isActive + summary: "Whether this kind of redirect is offered." + - key: table:cms_redirect_type;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_redirect_type;field:name + summary: "The name of this kind of redirect." + - key: table:cms_redirect_type;field:sortOrder + summary: "A number that puts records in order: lower numbers come first." + - key: table:cms_site;slot:help + summary: "A website. Every page, menu, redirect and snippet belongs to one site." + - key: table:cms_site;section:cms_site_cms_domain_siteId + summary: "The host names of this site. One of them is the primary one." + - key: table:cms_site;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_site;section:site + summary: "The name of the site, its short name and a description." + - key: table:cms_site;field:createDate + summary: "When the record was created." + - key: table:cms_site;field:description + summary: "What the site is, for the people who maintain it." + - key: table:cms_site;field:id + summary: "System-assigned record identifier." + - key: table:cms_site;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_site;field:name + summary: "The name of the site. It must be unique." + - key: table:cms_site;field:shortName + summary: "A short name for the site, for places where the full name does not fit." + - key: table:cms_snippet;slot:help + summary: "A reusable block of content of a site, referred to by its short name." + - key: table:cms_snippet;section:content + summary: "The content of the snippet." + - key: table:cms_snippet;section:dates + summary: "When the record was created and when it was last changed." + - key: table:cms_snippet;section:snippet + summary: "The name and short name of the snippet, its site, whether it is in use, its order and its styling." + - key: table:cms_snippet;field:content + summary: "The content of the snippet." + - key: table:cms_snippet;field:createDate + summary: "When the record was created." + - key: table:cms_snippet;field:cssClassName + summary: "A style class name the website puts on this snippet." + - key: table:cms_snippet;field:id + summary: "System-assigned record identifier." + - key: table:cms_snippet;field:isActive + summary: "Whether the snippet is in use." + - key: table:cms_snippet;field:modifyDate + summary: "When the record was last changed." + - key: table:cms_snippet;field:name + summary: "A name for the snippet, for the people who maintain it." + - key: table:cms_snippet;field:shortName + summary: "The short name by which the website refers to this snippet. It must be unique within its site." + - key: table:cms_snippet;field:siteId + summary: "The site this snippet belongs to." + - key: table:cms_snippet;field:sortOrder + summary: "A number that puts records in order: lower numbers come first." + - key: possibleValueSource:cms_author;slot:help + summary: "An author of posts." + - key: possibleValueSource:cms_blog;slot:help + summary: "A blog." + - key: possibleValueSource:cms_blog_post;slot:help + summary: "A blog post." + - key: possibleValueSource:cms_blog_post_media;slot:help + summary: "A media file of a post." + - key: possibleValueSource:cms_blog_post_tag_int;slot:help + summary: "A tag on a post." + - key: possibleValueSource:cms_blog_post_version;slot:help + summary: "A related version of a piece of content." + - key: possibleValueSource:cms_blog_tag;slot:help + summary: "A tag of a blog." + - key: possibleValueSource:cms_blog_type;slot:help + summary: "A kind of blog." + - key: possibleValueSource:cms_content_channel;slot:help + summary: "Where a related version of a piece of content is meant to be published." + content: | + Where a related version of a piece of content is meant to be published: the website, LinkedIn, Medium, Facebook or somewhere else. + - key: possibleValueSource:cms_content_format;slot:help + summary: "The format the text of a related version is written in: Markdown or plain text." + - key: possibleValueSource:cms_content_version_status;slot:help + summary: "How far a related version has got: draft, ready, published externally or archived." + - key: possibleValueSource:cms_domain;slot:help + summary: "A host name of a site." + - key: possibleValueSource:cms_media;slot:help + summary: "A file in the media library." + - key: possibleValueSource:cms_media_cache_class;slot:help + summary: "How long browsers and content delivery networks may keep files of a media type: immutable (a year) or mutable (a day)." + - key: possibleValueSource:cms_media_rendition_format;slot:help + summary: "The image format a generated version of an image is written in: JPEG, PNG or WebP." + - key: possibleValueSource:cms_media_type;slot:help + summary: "A kind of media file." + - key: possibleValueSource:cms_menu;slot:help + summary: "A navigation menu." + - key: possibleValueSource:cms_menu_item;slot:help + summary: "An entry of a menu." + - key: possibleValueSource:cms_page;slot:help + summary: "A page of a site." + - key: possibleValueSource:cms_page_section;slot:help + summary: "A section of a page." + - key: possibleValueSource:cms_page_section_type;slot:help + summary: "A kind of page section." + - key: possibleValueSource:cms_page_type;slot:help + summary: "A kind of page." + - key: possibleValueSource:cms_photo;slot:help + summary: "A photo." + - key: possibleValueSource:cms_photo_album;slot:help + summary: "A photo album." + - key: possibleValueSource:cms_photo_album_folder;slot:help + summary: "A folder of photo albums." + - key: possibleValueSource:cms_photo_tag;slot:help + summary: "A tag for photos." + - key: possibleValueSource:cms_photo_tag_int;slot:help + summary: "A tag on a photo." + - key: possibleValueSource:cms_project;slot:help + summary: "A project." + - key: possibleValueSource:cms_project_category;slot:help + summary: "A category of projects." + - key: possibleValueSource:cms_project_status;slot:help + summary: "The state of a project: planned, in progress, active or archived." + - key: possibleValueSource:cms_project_update;slot:help + summary: "An update on a project." + - key: possibleValueSource:cms_redirect;slot:help + summary: "A redirect of a public address." + - key: possibleValueSource:cms_redirect_match_type;slot:help + summary: "How the source path of a redirect is compared with a requested path." + content: | + How the source path of a redirect is compared with a requested path: the exact path, a path prefix, or a regular expression. + - key: possibleValueSource:cms_redirect_type;slot:help + summary: "A kind of redirect." + - key: possibleValueSource:cms_site;slot:help + summary: "A website." + - key: possibleValueSource:cms_snippet;slot:help + summary: "A reusable block of content." diff --git a/src/main/resources/qbit-cms/db/changelog/qbit-cms.changelog.yaml b/src/main/resources/qbit-cms/db/changelog/qbit-cms.changelog.yaml index 909765b..ad8a41e 100644 --- a/src/main/resources/qbit-cms/db/changelog/qbit-cms.changelog.yaml +++ b/src/main/resources/qbit-cms/db/changelog/qbit-cms.changelog.yaml @@ -14,11 +14,14 @@ databaseChangeLog: # Halt when a table with a qbit-cms name exists but was not created by this # changelog (a name collision): choose another cms.tablePrefix. + # It runs once, before the tables are created. Up to 0.1.0-RC.2 it ran on every migration (runAlways), which made + # every run rewrite its row in DATABASECHANGELOG: a second migration was never a no-op and a rollback by count + # began with this changeset. An install that already ran it keeps its row; validCheckSum accepts what it recorded. - changeSet: id: 1.0.0-guard-existing-tables author: qbit-cms logicalFilePath: qbit-cms/changelog - runAlways: true + validCheckSum: ANY preConditions: - onFail: HALT - onFailMessage: "A table named ${cms.tablePrefix} exists but was not created by qbit-cms; set a different cms.tablePrefix" @@ -1002,3 +1005,1990 @@ databaseChangeLog: - column: { name: create_date, valueComputed: CURRENT_TIMESTAMP } - column: { name: modify_date, valueComputed: CURRENT_TIMESTAMP } + # The content features: media, blogs, projects and photos (tables of a feature that is not in cms.features are + # skipped, and are created by a later run that names it). Every one of them needs CORE, and blogs, projects and photos + # need MEDIA, so a feature whose needs are not in cms.features installs nothing. + + # Halt when a table with a content-feature name already exists (a name collision): choose another cms.tablePrefix. + # Runs once, before any of these tables is created. + - changeSet: + id: 1.0.0-guard-existing-content-tables + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: HALT + - onFailMessage: "A table named ${cms.tablePrefix} exists but was not created by qbit-cms; set a different cms.tablePrefix" + - sqlCheck: + expectedResult: 0 + sql: >- + SELECT COUNT(*) FROM (VALUES ('media_type'), ('media'), ('blog_type'), ('blog'), ('author'), ('blog_tag'), ('blog_post'), ('blog_post_tag_int'), ('blog_post_media'), ('blog_post_version'), ('project_category'), ('project'), ('project_update'), ('photo_album_folder'), ('photo_album'), ('photo'), ('photo_tag'), ('photo_tag_int')) AS v(n) + WHERE EXISTS (SELECT 1 FROM information_schema.tables t WHERE LOWER(t.table_name) = LOWER(CONCAT('${cms.tablePrefix}', v.n))) + changes: + - sql: + sql: SELECT 1 + + - changeSet: + id: 1.0.0-create-media_type + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - createTable: + tableName: ${cms.tablePrefix}media_type + columns: + - column: + name: id + type: BIGINT + autoIncrement: true + constraints: { primaryKey: true, primaryKeyName: "pk_${cms.tablePrefix}media_type", nullable: false } + - column: + name: name + type: VARCHAR(100) + constraints: { nullable: false } + - column: + name: code + type: VARCHAR(50) + constraints: { nullable: false } + - column: + name: description + type: VARCHAR(500) + - column: + name: is_active + type: BOOLEAN + constraints: { nullable: false } + - column: + name: sort_order + type: INT + constraints: { nullable: false } + - column: + name: allowed_mime_types + type: VARCHAR(1000) + - column: + name: allowed_extensions + type: VARCHAR(500) + - column: + name: max_file_size_mb + type: INT + - column: + name: thumbnail_enabled + type: BOOLEAN + constraints: { nullable: false } + - column: + name: thumbnail_width + type: INT + - column: + name: thumbnail_format + type: VARCHAR(10) + constraints: { nullable: false } + - column: + name: thumbnail_quality + type: INT + - column: + name: gallery_enabled + type: BOOLEAN + constraints: { nullable: false } + - column: + name: gallery_width + type: INT + - column: + name: gallery_format + type: VARCHAR(10) + constraints: { nullable: false } + - column: + name: gallery_quality + type: INT + - column: + name: slideshow_enabled + type: BOOLEAN + constraints: { nullable: false } + - column: + name: slideshow_width + type: INT + - column: + name: slideshow_format + type: VARCHAR(10) + constraints: { nullable: false } + - column: + name: slideshow_quality + type: INT + - column: + name: strip_metadata + type: BOOLEAN + constraints: { nullable: false } + - column: + name: require_alt_text + type: BOOLEAN + constraints: { nullable: false } + - column: + name: require_caption + type: BOOLEAN + constraints: { nullable: false } + - column: + name: default_credit + type: VARCHAR(500) + - column: + name: default_license + type: VARCHAR(500) + - column: + name: cache_class + type: VARCHAR(20) + constraints: { nullable: false } + - column: + name: storage_prefix + type: VARCHAR(100) + constraints: { nullable: false } + - column: + name: create_date + type: TIMESTAMP + constraints: { nullable: false } + - column: + name: modify_date + type: TIMESTAMP + constraints: { nullable: false } + - addUniqueConstraint: + tableName: ${cms.tablePrefix}media_type + columnNames: code + constraintName: uq_${cms.tablePrefix}media_type_code + + - changeSet: + id: 1.0.0-create-media + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - createTable: + tableName: ${cms.tablePrefix}media + columns: + - column: + name: id + type: BIGINT + autoIncrement: true + constraints: { primaryKey: true, primaryKeyName: "pk_${cms.tablePrefix}media", nullable: false } + - column: + name: name + type: VARCHAR(200) + constraints: { nullable: false } + - column: + name: slug + type: VARCHAR(100) + - column: + name: description + type: VARCHAR(500) + - column: + name: alt_text + type: VARCHAR(1000) + - column: + name: caption + type: VARCHAR(2000) + - column: + name: credit + type: VARCHAR(500) + - column: + name: license + type: VARCHAR(500) + - column: + name: media_type_id + type: BIGINT + constraints: { nullable: false } + - column: + name: file_name + type: VARCHAR(255) + - column: + name: file_extension + type: VARCHAR(20) + - column: + name: mime_type + type: VARCHAR(100) + - column: + name: file_size + type: BIGINT + - column: + name: width + type: INT + - column: + name: height + type: INT + - column: + name: duration + type: INT + - column: + name: checksum + type: VARCHAR(64) + - column: + name: is_active + type: BOOLEAN + constraints: { nullable: false } + - column: + name: public_url + type: VARCHAR(500) + - column: + name: storage_key + type: VARCHAR(500) + - column: + name: thumbnail_url + type: VARCHAR(500) + - column: + name: gallery_url + type: VARCHAR(500) + - column: + name: slideshow_url + type: VARCHAR(500) + - column: + name: site_id + type: BIGINT + constraints: { nullable: false } + - column: + name: create_date + type: TIMESTAMP + constraints: { nullable: false } + - column: + name: modify_date + type: TIMESTAMP + constraints: { nullable: false } + + - changeSet: + id: 1.0.0-create-blog_type + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',BLOG,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - createTable: + tableName: ${cms.tablePrefix}blog_type + columns: + - column: + name: id + type: BIGINT + autoIncrement: true + constraints: { primaryKey: true, primaryKeyName: "pk_${cms.tablePrefix}blog_type", nullable: false } + - column: + name: name + type: VARCHAR(100) + constraints: { nullable: false } + - column: + name: code + type: VARCHAR(50) + constraints: { nullable: false } + - column: + name: description + type: VARCHAR(255) + - column: + name: is_active + type: BOOLEAN + constraints: { nullable: false } + - column: + name: sort_order + type: INT + constraints: { nullable: false } + - column: + name: create_date + type: TIMESTAMP + constraints: { nullable: false } + - column: + name: modify_date + type: TIMESTAMP + constraints: { nullable: false } + - addUniqueConstraint: + tableName: ${cms.tablePrefix}blog_type + columnNames: name + constraintName: uq_${cms.tablePrefix}blog_type_name + - addUniqueConstraint: + tableName: ${cms.tablePrefix}blog_type + columnNames: code + constraintName: uq_${cms.tablePrefix}blog_type_code + + - changeSet: + id: 1.0.0-create-blog + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',BLOG,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - createTable: + tableName: ${cms.tablePrefix}blog + columns: + - column: + name: id + type: BIGINT + autoIncrement: true + constraints: { primaryKey: true, primaryKeyName: "pk_${cms.tablePrefix}blog", nullable: false } + - column: + name: short_name + type: VARCHAR(20) + constraints: { nullable: false } + - column: + name: name + type: VARCHAR(40) + constraints: { nullable: false } + - column: + name: description + type: VARCHAR(255) + - column: + name: slug + type: VARCHAR(40) + constraints: { nullable: false } + - column: + name: blog_type_id + type: BIGINT + constraints: { nullable: false } + - column: + name: meta_title + type: VARCHAR(255) + - column: + name: meta_description + type: VARCHAR(500) + - column: + name: meta_keywords + type: VARCHAR(255) + - column: + name: site_id + type: BIGINT + constraints: { nullable: false } + - column: + name: create_date + type: TIMESTAMP + constraints: { nullable: false } + - column: + name: modify_date + type: TIMESTAMP + constraints: { nullable: false } + - addUniqueConstraint: + tableName: ${cms.tablePrefix}blog + columnNames: name + constraintName: uq_${cms.tablePrefix}blog_name + - addUniqueConstraint: + tableName: ${cms.tablePrefix}blog + columnNames: slug, site_id + constraintName: uq_${cms.tablePrefix}blog_slug_site_id + - addUniqueConstraint: + tableName: ${cms.tablePrefix}blog + columnNames: short_name + constraintName: uq_${cms.tablePrefix}blog_short_name + + - changeSet: + id: 1.0.0-create-author + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',BLOG,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - createTable: + tableName: ${cms.tablePrefix}author + columns: + - column: + name: id + type: BIGINT + autoIncrement: true + constraints: { primaryKey: true, primaryKeyName: "pk_${cms.tablePrefix}author", nullable: false } + - column: + name: name + type: VARCHAR(40) + constraints: { nullable: false } + - column: + name: short_name + type: VARCHAR(20) + constraints: { nullable: false } + - column: + name: description + type: VARCHAR(255) + - column: + name: slug + type: VARCHAR(40) + constraints: { nullable: false } + - column: + name: email + type: VARCHAR(255) + - column: + name: profile_media_id + type: BIGINT + - column: + name: profile_image_url + type: VARCHAR(500) + - column: + name: website + type: VARCHAR(255) + - column: + name: social_links + type: TEXT + - column: + name: is_active + type: BOOLEAN + - column: + name: display_order + type: INT + - column: + name: create_date + type: TIMESTAMP + constraints: { nullable: false } + - column: + name: modify_date + type: TIMESTAMP + constraints: { nullable: false } + - addUniqueConstraint: + tableName: ${cms.tablePrefix}author + columnNames: name + constraintName: uq_${cms.tablePrefix}author_name + - addUniqueConstraint: + tableName: ${cms.tablePrefix}author + columnNames: slug + constraintName: uq_${cms.tablePrefix}author_slug + + - changeSet: + id: 1.0.0-create-blog_tag + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',BLOG,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - createTable: + tableName: ${cms.tablePrefix}blog_tag + columns: + - column: + name: id + type: BIGINT + autoIncrement: true + constraints: { primaryKey: true, primaryKeyName: "pk_${cms.tablePrefix}blog_tag", nullable: false } + - column: + name: name + type: VARCHAR(40) + constraints: { nullable: false } + - column: + name: slug + type: VARCHAR(40) + constraints: { nullable: false } + - column: + name: description + type: VARCHAR(255) + - column: + name: blog_id + type: BIGINT + constraints: { nullable: false } + - column: + name: create_date + type: TIMESTAMP + constraints: { nullable: false } + - column: + name: modify_date + type: TIMESTAMP + constraints: { nullable: false } + - addUniqueConstraint: + tableName: ${cms.tablePrefix}blog_tag + columnNames: name, blog_id + constraintName: uq_${cms.tablePrefix}blog_tag_name_blog_id + - addUniqueConstraint: + tableName: ${cms.tablePrefix}blog_tag + columnNames: slug, blog_id + constraintName: uq_${cms.tablePrefix}blog_tag_slug_blog_id + + - changeSet: + id: 1.0.0-create-blog_post + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',BLOG,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - createTable: + tableName: ${cms.tablePrefix}blog_post + columns: + - column: + name: id + type: BIGINT + autoIncrement: true + constraints: { primaryKey: true, primaryKeyName: "pk_${cms.tablePrefix}blog_post", nullable: false } + - column: + name: name + type: VARCHAR(40) + constraints: { nullable: false } + - column: + name: short_name + type: VARCHAR(20) + constraints: { nullable: false } + - column: + name: description + type: VARCHAR(255) + - column: + name: title + type: VARCHAR(100) + - column: + name: slug + type: VARCHAR(100) + constraints: { nullable: false } + - column: + name: content + type: TEXT + constraints: { nullable: false } + - column: + name: author_id + type: BIGINT + constraints: { nullable: false } + - column: + name: blog_id + type: BIGINT + constraints: { nullable: false } + - column: + name: is_published + type: BOOLEAN + - column: + name: publish_date + type: TIMESTAMP + - column: + name: featured_media_id + type: BIGINT + - column: + name: featured_image + type: VARCHAR(255) + - column: + name: meta_title + type: VARCHAR(255) + - column: + name: meta_description + type: VARCHAR(500) + - column: + name: meta_keywords + type: VARCHAR(255) + - column: + name: read_time + type: INT + - column: + name: view_count + type: BIGINT + - column: + name: is_featured + type: BOOLEAN + constraints: { nullable: false } + - column: + name: excerpt + type: TEXT + - column: + name: create_date + type: TIMESTAMP + constraints: { nullable: false } + - column: + name: modify_date + type: TIMESTAMP + constraints: { nullable: false } + - addUniqueConstraint: + tableName: ${cms.tablePrefix}blog_post + columnNames: name, blog_id + constraintName: uq_${cms.tablePrefix}blog_post_name_blog_id + - addUniqueConstraint: + tableName: ${cms.tablePrefix}blog_post + columnNames: short_name, blog_id + constraintName: uq_${cms.tablePrefix}blog_post_short_name_blog_id + - addUniqueConstraint: + tableName: ${cms.tablePrefix}blog_post + columnNames: slug, blog_id + constraintName: uq_${cms.tablePrefix}blog_post_slug_blog_id + + - changeSet: + id: 1.0.0-create-blog_post_tag_int + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',BLOG,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - createTable: + tableName: ${cms.tablePrefix}blog_post_tag_int + columns: + - column: + name: id + type: BIGINT + autoIncrement: true + constraints: { primaryKey: true, primaryKeyName: "pk_${cms.tablePrefix}blog_post_tag_int", nullable: false } + - column: + name: blog_post_id + type: BIGINT + constraints: { nullable: false } + - column: + name: blog_tag_id + type: BIGINT + constraints: { nullable: false } + - column: + name: create_date + type: TIMESTAMP + constraints: { nullable: false } + - column: + name: modify_date + type: TIMESTAMP + constraints: { nullable: false } + - addUniqueConstraint: + tableName: ${cms.tablePrefix}blog_post_tag_int + columnNames: blog_post_id, blog_tag_id + constraintName: uq_${cms.tablePrefix}blog_post_tag_int_blog_post_id_blog_tag_id + + - changeSet: + id: 1.0.0-create-blog_post_media + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',BLOG,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - createTable: + tableName: ${cms.tablePrefix}blog_post_media + columns: + - column: + name: id + type: BIGINT + autoIncrement: true + constraints: { primaryKey: true, primaryKeyName: "pk_${cms.tablePrefix}blog_post_media", nullable: false } + - column: + name: blog_post_id + type: BIGINT + constraints: { nullable: false } + - column: + name: media_id + type: BIGINT + constraints: { nullable: false } + - column: + name: sort_order + type: INT + constraints: { nullable: false } + - column: + name: alt_text + type: VARCHAR(1000) + - column: + name: caption + type: VARCHAR(2000) + - column: + name: url + type: VARCHAR(1000) + constraints: { nullable: false } + - column: + name: thumbnail_url + type: VARCHAR(1000) + - column: + name: width + type: INT + - column: + name: height + type: INT + - column: + name: create_date + type: TIMESTAMP + constraints: { nullable: false } + - column: + name: modify_date + type: TIMESTAMP + constraints: { nullable: false } + - addUniqueConstraint: + tableName: ${cms.tablePrefix}blog_post_media + columnNames: blog_post_id, media_id + constraintName: uq_${cms.tablePrefix}blog_post_media_blog_post_id_media_id + + - changeSet: + id: 1.0.0-create-blog_post_version + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',BLOG,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - createTable: + tableName: ${cms.tablePrefix}blog_post_version + columns: + - column: + name: id + type: BIGINT + autoIncrement: true + constraints: { primaryKey: true, primaryKeyName: "pk_${cms.tablePrefix}blog_post_version", nullable: false } + - column: + name: blog_post_id + type: BIGINT + - column: + name: project_id + type: BIGINT + - column: + name: project_update_id + type: BIGINT + - column: + name: name + type: VARCHAR(100) + constraints: { nullable: false } + - column: + name: variant_key + type: VARCHAR(100) + constraints: { nullable: false } + - column: + name: channel + type: VARCHAR(40) + constraints: { nullable: false } + - column: + name: title + type: VARCHAR(200) + - column: + name: content + type: TEXT + constraints: { nullable: false } + - column: + name: content_format + type: VARCHAR(20) + constraints: { nullable: false } + - column: + name: status + type: VARCHAR(20) + constraints: { nullable: false } + - column: + name: source_digest + type: VARCHAR(64) + - column: + name: source_commit + type: VARCHAR(64) + - column: + name: published_url + type: VARCHAR(2000) + - column: + name: published_date + type: TIMESTAMP + - column: + name: create_date + type: TIMESTAMP + constraints: { nullable: false } + - column: + name: modify_date + type: TIMESTAMP + constraints: { nullable: false } + - addUniqueConstraint: + tableName: ${cms.tablePrefix}blog_post_version + columnNames: blog_post_id, variant_key + constraintName: uq_${cms.tablePrefix}blog_post_version_blog_post_id_variant_key + - addUniqueConstraint: + tableName: ${cms.tablePrefix}blog_post_version + columnNames: project_id, variant_key + constraintName: uq_${cms.tablePrefix}blog_post_version_project_id_variant_key + - addUniqueConstraint: + tableName: ${cms.tablePrefix}blog_post_version + columnNames: project_update_id, variant_key + constraintName: uq_${cms.tablePrefix}blog_post_version_project_update_id_variant_key + + - changeSet: + id: 1.0.0-create-project_category + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',PROJECTS,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - createTable: + tableName: ${cms.tablePrefix}project_category + columns: + - column: + name: id + type: BIGINT + autoIncrement: true + constraints: { primaryKey: true, primaryKeyName: "pk_${cms.tablePrefix}project_category", nullable: false } + - column: + name: site_id + type: BIGINT + constraints: { nullable: false } + - column: + name: name + type: VARCHAR(100) + constraints: { nullable: false } + - column: + name: title + type: VARCHAR(200) + constraints: { nullable: false } + - column: + name: slug + type: VARCHAR(100) + constraints: { nullable: false } + - column: + name: section + type: VARCHAR(20) + - column: + name: description + type: VARCHAR(1000) + - column: + name: featured_media_id + type: BIGINT + - column: + name: featured_image + type: VARCHAR(500) + - column: + name: sort_order + type: INT + constraints: { nullable: false } + - column: + name: is_published + type: BOOLEAN + constraints: { nullable: false } + - column: + name: create_date + type: TIMESTAMP + constraints: { nullable: false } + - column: + name: modify_date + type: TIMESTAMP + constraints: { nullable: false } + - addUniqueConstraint: + tableName: ${cms.tablePrefix}project_category + columnNames: slug, site_id + constraintName: uq_${cms.tablePrefix}project_category_slug_site_id + + - changeSet: + id: 1.0.0-create-project + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',PROJECTS,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - createTable: + tableName: ${cms.tablePrefix}project + columns: + - column: + name: id + type: BIGINT + autoIncrement: true + constraints: { primaryKey: true, primaryKeyName: "pk_${cms.tablePrefix}project", nullable: false } + - column: + name: name + type: VARCHAR(100) + constraints: { nullable: false } + - column: + name: short_name + type: VARCHAR(20) + constraints: { nullable: false } + - column: + name: slug + type: VARCHAR(100) + constraints: { nullable: false } + - column: + name: title + type: VARCHAR(200) + constraints: { nullable: false } + - column: + name: description + type: TEXT + - column: + name: content + type: TEXT + - column: + name: project_status + type: VARCHAR(20) + constraints: { nullable: false } + - column: + name: github_url + type: VARCHAR(255) + - column: + name: live_url + type: VARCHAR(255) + - column: + name: featured_media_id + type: BIGINT + - column: + name: featured_image + type: VARCHAR(255) + - column: + name: image_alt + type: VARCHAR(500) + - column: + name: image_caption + type: VARCHAR(1000) + - column: + name: image_focal_x + type: INT + - column: + name: image_focal_y + type: INT + - column: + name: start_date + type: TIMESTAMP + - column: + name: end_date + type: TIMESTAMP + - column: + name: is_featured + type: BOOLEAN + constraints: { nullable: false } + - column: + name: sort_order + type: INT + constraints: { nullable: false } + - column: + name: site_id + type: BIGINT + constraints: { nullable: false } + - column: + name: category_id + type: BIGINT + constraints: { nullable: false } + - column: + name: is_published + type: BOOLEAN + constraints: { nullable: false } + - column: + name: publish_date + type: TIMESTAMP + - column: + name: create_date + type: TIMESTAMP + constraints: { nullable: false } + - column: + name: modify_date + type: TIMESTAMP + constraints: { nullable: false } + - addUniqueConstraint: + tableName: ${cms.tablePrefix}project + columnNames: slug, site_id + constraintName: uq_${cms.tablePrefix}project_slug_site_id + + - changeSet: + id: 1.0.0-create-project_update + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',PROJECTS,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - createTable: + tableName: ${cms.tablePrefix}project_update + columns: + - column: + name: id + type: BIGINT + autoIncrement: true + constraints: { primaryKey: true, primaryKeyName: "pk_${cms.tablePrefix}project_update", nullable: false } + - column: + name: project_id + type: BIGINT + constraints: { nullable: false } + - column: + name: slug + type: VARCHAR(100) + constraints: { nullable: false } + - column: + name: title + type: VARCHAR(200) + constraints: { nullable: false } + - column: + name: excerpt + type: VARCHAR(1000) + - column: + name: content + type: TEXT + constraints: { nullable: false } + - column: + name: update_date + type: TIMESTAMP + constraints: { nullable: false } + - column: + name: is_published + type: BOOLEAN + constraints: { nullable: false } + - column: + name: publish_date + type: TIMESTAMP + - column: + name: sort_order + type: INT + constraints: { nullable: false } + - column: + name: featured_media_id + type: BIGINT + - column: + name: featured_image + type: VARCHAR(500) + - column: + name: create_date + type: TIMESTAMP + constraints: { nullable: false } + - column: + name: modify_date + type: TIMESTAMP + constraints: { nullable: false } + - addUniqueConstraint: + tableName: ${cms.tablePrefix}project_update + columnNames: slug, project_id + constraintName: uq_${cms.tablePrefix}project_update_slug_project_id + + - changeSet: + id: 1.0.0-create-photo_album_folder + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',PHOTOS,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - createTable: + tableName: ${cms.tablePrefix}photo_album_folder + columns: + - column: + name: id + type: BIGINT + autoIncrement: true + constraints: { primaryKey: true, primaryKeyName: "pk_${cms.tablePrefix}photo_album_folder", nullable: false } + - column: + name: site_id + type: BIGINT + constraints: { nullable: false } + - column: + name: parent_id + type: BIGINT + - column: + name: name + type: VARCHAR(100) + constraints: { nullable: false } + - column: + name: slug + type: VARCHAR(100) + constraints: { nullable: false } + - column: + name: description + type: VARCHAR(500) + - column: + name: folder_image_url + type: VARCHAR(500) + - column: + name: is_published + type: BOOLEAN + constraints: { nullable: false } + - column: + name: sort_order + type: INT + constraints: { nullable: false } + - column: + name: meta_title + type: VARCHAR(255) + - column: + name: meta_description + type: VARCHAR(500) + - column: + name: create_date + type: TIMESTAMP + constraints: { nullable: false } + - column: + name: modify_date + type: TIMESTAMP + constraints: { nullable: false } + - addUniqueConstraint: + tableName: ${cms.tablePrefix}photo_album_folder + columnNames: slug, site_id + constraintName: uq_${cms.tablePrefix}photo_album_folder_slug_site_id + + - changeSet: + id: 1.0.0-create-photo_album + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',PHOTOS,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - createTable: + tableName: ${cms.tablePrefix}photo_album + columns: + - column: + name: id + type: BIGINT + autoIncrement: true + constraints: { primaryKey: true, primaryKeyName: "pk_${cms.tablePrefix}photo_album", nullable: false } + - column: + name: site_id + type: BIGINT + constraints: { nullable: false } + - column: + name: photo_album_folder_id + type: BIGINT + - column: + name: project_id + type: BIGINT + - column: + name: project_update_id + type: BIGINT + - column: + name: name + type: VARCHAR(100) + constraints: { nullable: false } + - column: + name: short_name + type: VARCHAR(40) + constraints: { nullable: false } + - column: + name: slug + type: VARCHAR(100) + constraints: { nullable: false } + - column: + name: title + type: VARCHAR(200) + - column: + name: description + type: VARCHAR(1000) + - column: + name: cover_photo_id + type: BIGINT + - column: + name: cover_image_url + type: VARCHAR(500) + - column: + name: is_published + type: BOOLEAN + constraints: { nullable: false } + - column: + name: publish_date + type: TIMESTAMP + - column: + name: sort_order + type: INT + constraints: { nullable: false } + - column: + name: location + type: VARCHAR(200) + - column: + name: location_latitude + type: DOUBLE + - column: + name: location_longitude + type: DOUBLE + - column: + name: album_date + type: TIMESTAMP + - column: + name: album_end_date + type: TIMESTAMP + - column: + name: primary_camera + type: VARCHAR(100) + - column: + name: primary_lens + type: VARCHAR(100) + - column: + name: weather + type: VARCHAR(100) + - column: + name: meta_title + type: VARCHAR(255) + - column: + name: meta_description + type: VARCHAR(500) + - column: + name: create_date + type: TIMESTAMP + constraints: { nullable: false } + - column: + name: modify_date + type: TIMESTAMP + constraints: { nullable: false } + - addUniqueConstraint: + tableName: ${cms.tablePrefix}photo_album + columnNames: slug, site_id + constraintName: uq_${cms.tablePrefix}photo_album_slug_site_id + - addUniqueConstraint: + tableName: ${cms.tablePrefix}photo_album + columnNames: short_name, site_id + constraintName: uq_${cms.tablePrefix}photo_album_short_name_site_id + + - changeSet: + id: 1.0.0-create-photo + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',PHOTOS,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - createTable: + tableName: ${cms.tablePrefix}photo + columns: + - column: + name: id + type: BIGINT + autoIncrement: true + constraints: { primaryKey: true, primaryKeyName: "pk_${cms.tablePrefix}photo", nullable: false } + - column: + name: photo_album_id + type: BIGINT + constraints: { nullable: false } + - column: + name: media_id + type: BIGINT + - column: + name: title + type: VARCHAR(200) + constraints: { nullable: false } + - column: + name: slug + type: VARCHAR(100) + constraints: { nullable: false } + - column: + name: caption + type: VARCHAR(500) + - column: + name: description + type: VARCHAR(1000) + - column: + name: score + type: INT + - column: + name: is_favorite + type: BOOLEAN + constraints: { nullable: false } + - column: + name: is_album_cover + type: BOOLEAN + constraints: { nullable: false } + - column: + name: sort_order + type: INT + constraints: { nullable: false } + - column: + name: is_published + type: BOOLEAN + constraints: { nullable: false } + - column: + name: publish_date + type: TIMESTAMP + - column: + name: original_url + type: VARCHAR(500) + - column: + name: gallery_url + type: VARCHAR(500) + - column: + name: slideshow_url + type: VARCHAR(500) + - column: + name: thumbnail_url + type: VARCHAR(500) + - column: + name: original_filename + type: VARCHAR(255) + - column: + name: storage_key + type: VARCHAR(500) + - column: + name: mime_type + type: VARCHAR(100) + - column: + name: file_size + type: BIGINT + - column: + name: width + type: INT + - column: + name: height + type: INT + - column: + name: exif_date_taken + type: TIMESTAMP + - column: + name: exif_camera_make + type: VARCHAR(100) + - column: + name: exif_camera_model + type: VARCHAR(100) + - column: + name: exif_lens_model + type: VARCHAR(200) + - column: + name: exif_focal_length + type: VARCHAR(20) + - column: + name: exif_aperture + type: VARCHAR(20) + - column: + name: exif_shutter_speed + type: VARCHAR(20) + - column: + name: exif_iso + type: INT + - column: + name: exif_white_balance + type: VARCHAR(50) + - column: + name: exif_flash + type: VARCHAR(50) + - column: + name: exif_gps_latitude + type: DOUBLE + - column: + name: exif_gps_longitude + type: DOUBLE + - column: + name: create_date + type: TIMESTAMP + constraints: { nullable: false } + - column: + name: modify_date + type: TIMESTAMP + constraints: { nullable: false } + - addUniqueConstraint: + tableName: ${cms.tablePrefix}photo + columnNames: slug, photo_album_id + constraintName: uq_${cms.tablePrefix}photo_slug_photo_album_id + + - changeSet: + id: 1.0.0-create-photo_tag + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',PHOTOS,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - createTable: + tableName: ${cms.tablePrefix}photo_tag + columns: + - column: + name: id + type: BIGINT + autoIncrement: true + constraints: { primaryKey: true, primaryKeyName: "pk_${cms.tablePrefix}photo_tag", nullable: false } + - column: + name: name + type: VARCHAR(100) + constraints: { nullable: false } + - column: + name: slug + type: VARCHAR(100) + constraints: { nullable: false } + - column: + name: description + type: VARCHAR(255) + - column: + name: create_date + type: TIMESTAMP + constraints: { nullable: false } + - column: + name: modify_date + type: TIMESTAMP + constraints: { nullable: false } + - addUniqueConstraint: + tableName: ${cms.tablePrefix}photo_tag + columnNames: slug + constraintName: uq_${cms.tablePrefix}photo_tag_slug + - addUniqueConstraint: + tableName: ${cms.tablePrefix}photo_tag + columnNames: name + constraintName: uq_${cms.tablePrefix}photo_tag_name + + - changeSet: + id: 1.0.0-create-photo_tag_int + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',PHOTOS,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - createTable: + tableName: ${cms.tablePrefix}photo_tag_int + columns: + - column: + name: id + type: BIGINT + autoIncrement: true + constraints: { primaryKey: true, primaryKeyName: "pk_${cms.tablePrefix}photo_tag_int", nullable: false } + - column: + name: photo_id + type: BIGINT + constraints: { nullable: false } + - column: + name: photo_tag_id + type: BIGINT + constraints: { nullable: false } + - column: + name: create_date + type: TIMESTAMP + constraints: { nullable: false } + - column: + name: modify_date + type: TIMESTAMP + constraints: { nullable: false } + - addUniqueConstraint: + tableName: ${cms.tablePrefix}photo_tag_int + columnNames: photo_id, photo_tag_id + constraintName: uq_${cms.tablePrefix}photo_tag_int_photo_id_photo_tag_id + + - changeSet: + id: 1.0.0-constraints-media + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - sql: + sql: ALTER TABLE ${cms.tablePrefix}media_type ADD CONSTRAINT ck_${cms.tablePrefix}media_type_thumbnail_format CHECK (thumbnail_format IN ('JPEG', 'PNG', 'WEBP')) + - sql: + sql: ALTER TABLE ${cms.tablePrefix}media_type ADD CONSTRAINT ck_${cms.tablePrefix}media_type_gallery_format CHECK (gallery_format IN ('JPEG', 'PNG', 'WEBP')) + - sql: + sql: ALTER TABLE ${cms.tablePrefix}media_type ADD CONSTRAINT ck_${cms.tablePrefix}media_type_slideshow_format CHECK (slideshow_format IN ('JPEG', 'PNG', 'WEBP')) + - sql: + sql: ALTER TABLE ${cms.tablePrefix}media_type ADD CONSTRAINT ck_${cms.tablePrefix}media_type_cache_class CHECK (cache_class IN ('IMMUTABLE', 'MUTABLE')) + - sql: + sql: ALTER TABLE ${cms.tablePrefix}media_type ADD CONSTRAINT ck_${cms.tablePrefix}media_type_max_file_size_mb CHECK (max_file_size_mb IS NULL OR max_file_size_mb > 0) + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}media + baseColumnNames: media_type_id + referencedTableName: ${cms.tablePrefix}media_type + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}media_media_type_id + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}media + baseColumnNames: site_id + referencedTableName: ${cms.tablePrefix}site + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}media_site_id + - createIndex: + tableName: ${cms.tablePrefix}media + indexName: idx_${cms.tablePrefix}media_site_id_name + columns: + - column: { name: site_id } + - column: { name: name } + - createIndex: + tableName: ${cms.tablePrefix}media + indexName: idx_${cms.tablePrefix}media_media_type_id + columns: + - column: { name: media_type_id } + + - changeSet: + id: 1.0.0-constraints-blog + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',BLOG,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}blog + baseColumnNames: blog_type_id + referencedTableName: ${cms.tablePrefix}blog_type + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}blog_blog_type_id + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}blog + baseColumnNames: site_id + referencedTableName: ${cms.tablePrefix}site + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}blog_site_id + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}author + baseColumnNames: profile_media_id + referencedTableName: ${cms.tablePrefix}media + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}author_profile_media_id + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}blog_tag + baseColumnNames: blog_id + referencedTableName: ${cms.tablePrefix}blog + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}blog_tag_blog_id + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}blog_post + baseColumnNames: author_id + referencedTableName: ${cms.tablePrefix}author + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}blog_post_author_id + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}blog_post + baseColumnNames: blog_id + referencedTableName: ${cms.tablePrefix}blog + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}blog_post_blog_id + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}blog_post + baseColumnNames: featured_media_id + referencedTableName: ${cms.tablePrefix}media + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}blog_post_featured_media_id + - createIndex: + tableName: ${cms.tablePrefix}blog_post + indexName: idx_${cms.tablePrefix}blog_post_blog_id_is_published + columns: + - column: { name: blog_id } + - column: { name: is_published } + - createIndex: + tableName: ${cms.tablePrefix}blog_post + indexName: idx_${cms.tablePrefix}blog_post_author_id + columns: + - column: { name: author_id } + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}blog_post_tag_int + baseColumnNames: blog_post_id + referencedTableName: ${cms.tablePrefix}blog_post + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}blog_post_tag_int_blog_post_id + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}blog_post_tag_int + baseColumnNames: blog_tag_id + referencedTableName: ${cms.tablePrefix}blog_tag + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}blog_post_tag_int_blog_tag_id + - createIndex: + tableName: ${cms.tablePrefix}blog_post_tag_int + indexName: idx_${cms.tablePrefix}blog_post_tag_int_blog_tag_id + columns: + - column: { name: blog_tag_id } + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}blog_post_media + baseColumnNames: blog_post_id + referencedTableName: ${cms.tablePrefix}blog_post + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}blog_post_media_blog_post_id + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}blog_post_media + baseColumnNames: media_id + referencedTableName: ${cms.tablePrefix}media + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}blog_post_media_media_id + - createIndex: + tableName: ${cms.tablePrefix}blog_post_media + indexName: idx_${cms.tablePrefix}blog_post_media_blog_post_id_sort_order + columns: + - column: { name: blog_post_id } + - column: { name: sort_order } + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}blog_post_version + baseColumnNames: blog_post_id + referencedTableName: ${cms.tablePrefix}blog_post + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}blog_post_version_blog_post_id + - createIndex: + tableName: ${cms.tablePrefix}blog_post_version + indexName: idx_${cms.tablePrefix}blog_post_version_blog_post_id_channel + columns: + - column: { name: blog_post_id } + - column: { name: channel } + - sql: + sql: ALTER TABLE ${cms.tablePrefix}blog_post_version ADD CONSTRAINT ck_${cms.tablePrefix}blog_post_version_channel CHECK (channel IN ('WEBSITE', 'LINKEDIN', 'MEDIUM', 'FACEBOOK', 'OTHER')) + - sql: + sql: ALTER TABLE ${cms.tablePrefix}blog_post_version ADD CONSTRAINT ck_${cms.tablePrefix}blog_post_version_content_format CHECK (content_format IN ('MARKDOWN', 'PLAIN_TEXT')) + - sql: + sql: ALTER TABLE ${cms.tablePrefix}blog_post_version ADD CONSTRAINT ck_${cms.tablePrefix}blog_post_version_status CHECK (status IN ('DRAFT', 'READY', 'PUBLISHED', 'ARCHIVED')) + + - changeSet: + id: 1.0.0-constraints-projects + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',PROJECTS,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}project_category + baseColumnNames: site_id + referencedTableName: ${cms.tablePrefix}site + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}project_category_site_id + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}project_category + baseColumnNames: featured_media_id + referencedTableName: ${cms.tablePrefix}media + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}project_category_featured_media_id + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}project + baseColumnNames: featured_media_id + referencedTableName: ${cms.tablePrefix}media + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}project_featured_media_id + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}project + baseColumnNames: site_id + referencedTableName: ${cms.tablePrefix}site + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}project_site_id + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}project + baseColumnNames: category_id + referencedTableName: ${cms.tablePrefix}project_category + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}project_category_id + - createIndex: + tableName: ${cms.tablePrefix}project + indexName: idx_${cms.tablePrefix}project_category_id_is_published_sort_order + columns: + - column: { name: category_id } + - column: { name: is_published } + - column: { name: sort_order } + - sql: + sql: ALTER TABLE ${cms.tablePrefix}project ADD CONSTRAINT ck_${cms.tablePrefix}project_project_status CHECK (project_status IN ('PLANNED', 'IN_PROGRESS', 'ACTIVE', 'ARCHIVED')) + - sql: + sql: ALTER TABLE ${cms.tablePrefix}project ADD CONSTRAINT ck_${cms.tablePrefix}project_image_focal_x CHECK (image_focal_x BETWEEN 0 AND 100) + - sql: + sql: ALTER TABLE ${cms.tablePrefix}project ADD CONSTRAINT ck_${cms.tablePrefix}project_image_focal_y CHECK (image_focal_y BETWEEN 0 AND 100) + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}project_update + baseColumnNames: project_id + referencedTableName: ${cms.tablePrefix}project + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}project_update_project_id + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}project_update + baseColumnNames: featured_media_id + referencedTableName: ${cms.tablePrefix}media + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}project_update_featured_media_id + - createIndex: + tableName: ${cms.tablePrefix}project_update + indexName: idx_${cms.tablePrefix}project_update_project_id_is_published_update_date + columns: + - column: { name: project_id } + - column: { name: is_published } + - column: { name: update_date } + + - changeSet: + id: 1.0.0-constraints-photos + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',PHOTOS,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}photo_album_folder + baseColumnNames: site_id + referencedTableName: ${cms.tablePrefix}site + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}photo_album_folder_site_id + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}photo_album_folder + baseColumnNames: parent_id + referencedTableName: ${cms.tablePrefix}photo_album_folder + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}photo_album_folder_parent_id + - createIndex: + tableName: ${cms.tablePrefix}photo_album_folder + indexName: idx_${cms.tablePrefix}photo_album_folder_parent_id + columns: + - column: { name: parent_id } + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}photo_album + baseColumnNames: site_id + referencedTableName: ${cms.tablePrefix}site + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}photo_album_site_id + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}photo_album + baseColumnNames: photo_album_folder_id + referencedTableName: ${cms.tablePrefix}photo_album_folder + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}photo_album_photo_album_folder_id + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}photo_album + baseColumnNames: cover_photo_id + referencedTableName: ${cms.tablePrefix}photo + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}photo_album_cover_photo_id + - createIndex: + tableName: ${cms.tablePrefix}photo_album + indexName: idx_${cms.tablePrefix}photo_album_photo_album_folder_id + columns: + - column: { name: photo_album_folder_id } + - createIndex: + tableName: ${cms.tablePrefix}photo_album + indexName: idx_${cms.tablePrefix}photo_album_is_published + columns: + - column: { name: is_published } + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}photo + baseColumnNames: photo_album_id + referencedTableName: ${cms.tablePrefix}photo_album + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}photo_photo_album_id + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}photo + baseColumnNames: media_id + referencedTableName: ${cms.tablePrefix}media + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}photo_media_id + - createIndex: + tableName: ${cms.tablePrefix}photo + indexName: idx_${cms.tablePrefix}photo_photo_album_id_sort_order + columns: + - column: { name: photo_album_id } + - column: { name: sort_order } + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}photo_tag_int + baseColumnNames: photo_id + referencedTableName: ${cms.tablePrefix}photo + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}photo_tag_int_photo_id + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}photo_tag_int + baseColumnNames: photo_tag_id + referencedTableName: ${cms.tablePrefix}photo_tag + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}photo_tag_int_photo_tag_id + - createIndex: + tableName: ${cms.tablePrefix}photo_tag_int + indexName: idx_${cms.tablePrefix}photo_tag_int_photo_tag_id + columns: + - column: { name: photo_tag_id } + + # Links between two features: created when both are installed. + - changeSet: + id: 1.0.0-constraints-blog-projects + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',BLOG,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',PROJECTS,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}blog_post_version + baseColumnNames: project_id + referencedTableName: ${cms.tablePrefix}project + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}blog_post_version_project_id + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}blog_post_version + baseColumnNames: project_update_id + referencedTableName: ${cms.tablePrefix}project_update + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}blog_post_version_project_update_id + + # Links between two features: created when both are installed. + - changeSet: + id: 1.0.0-constraints-photos-projects + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',PHOTOS,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',PROJECTS,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 THEN 1 ELSE 0 END + changes: + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}photo_album + baseColumnNames: project_id + referencedTableName: ${cms.tablePrefix}project + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}photo_album_project_id + - addForeignKeyConstraint: + baseTableName: ${cms.tablePrefix}photo_album + baseColumnNames: project_update_id + referencedTableName: ${cms.tablePrefix}project_update + referencedColumnNames: id + constraintName: fk_${cms.tablePrefix}photo_album_project_update_id + - createIndex: + tableName: ${cms.tablePrefix}photo_album + indexName: idx_${cms.tablePrefix}photo_album_project_id + columns: + - column: { name: project_id } + - createIndex: + tableName: ${cms.tablePrefix}photo_album + indexName: idx_${cms.tablePrefix}photo_album_project_update_id + columns: + - column: { name: project_update_id } + + # Generic reference data (never content); off with cms.seedReferenceData=false. + - changeSet: + id: 1.0.0-seed-media_type + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND LOWER('${cms.seedReferenceData}') = 'true' THEN 1 ELSE 0 END + changes: + - insert: + tableName: ${cms.tablePrefix}media_type + columns: + - column: { name: name, value: "Image" } + - column: { name: code, value: "IMAGE" } + - column: { name: description, value: "Image files (JPEG, PNG, GIF, etc.)" } + - column: { name: is_active, valueBoolean: true } + - column: { name: sort_order, valueNumeric: 1 } + - column: { name: allowed_mime_types, value: "image/jpeg,image/png,image/heic,image/heif" } + - column: { name: allowed_extensions, value: "jpg,jpeg,png,heic,heif" } + - column: { name: max_file_size_mb, valueNumeric: 25 } + - column: { name: thumbnail_enabled, valueBoolean: true } + - column: { name: thumbnail_format, value: "JPEG" } + - column: { name: thumbnail_quality, valueNumeric: 85 } + - column: { name: gallery_enabled, valueBoolean: true } + - column: { name: gallery_format, value: "JPEG" } + - column: { name: gallery_quality, valueNumeric: 85 } + - column: { name: slideshow_enabled, valueBoolean: true } + - column: { name: slideshow_format, value: "JPEG" } + - column: { name: slideshow_quality, valueNumeric: 85 } + - column: { name: strip_metadata, valueBoolean: true } + - column: { name: require_alt_text, valueBoolean: false } + - column: { name: require_caption, valueBoolean: false } + - column: { name: cache_class, value: "MUTABLE" } + - column: { name: storage_prefix, value: "media" } + - column: { name: create_date, valueComputed: CURRENT_TIMESTAMP } + - column: { name: modify_date, valueComputed: CURRENT_TIMESTAMP } + - insert: + tableName: ${cms.tablePrefix}media_type + columns: + - column: { name: name, value: "Video" } + - column: { name: code, value: "VIDEO" } + - column: { name: description, value: "Video files (MP4, WebM, etc.)" } + - column: { name: is_active, valueBoolean: true } + - column: { name: sort_order, valueNumeric: 2 } + - column: { name: thumbnail_enabled, valueBoolean: true } + - column: { name: thumbnail_format, value: "JPEG" } + - column: { name: thumbnail_quality, valueNumeric: 85 } + - column: { name: gallery_enabled, valueBoolean: true } + - column: { name: gallery_format, value: "JPEG" } + - column: { name: gallery_quality, valueNumeric: 85 } + - column: { name: slideshow_enabled, valueBoolean: true } + - column: { name: slideshow_format, value: "JPEG" } + - column: { name: slideshow_quality, valueNumeric: 85 } + - column: { name: strip_metadata, valueBoolean: false } + - column: { name: require_alt_text, valueBoolean: false } + - column: { name: require_caption, valueBoolean: false } + - column: { name: cache_class, value: "MUTABLE" } + - column: { name: storage_prefix, value: "media" } + - column: { name: create_date, valueComputed: CURRENT_TIMESTAMP } + - column: { name: modify_date, valueComputed: CURRENT_TIMESTAMP } + - insert: + tableName: ${cms.tablePrefix}media_type + columns: + - column: { name: name, value: "Audio" } + - column: { name: code, value: "AUDIO" } + - column: { name: description, value: "Audio files (MP3, WAV, etc.)" } + - column: { name: is_active, valueBoolean: true } + - column: { name: sort_order, valueNumeric: 3 } + - column: { name: thumbnail_enabled, valueBoolean: true } + - column: { name: thumbnail_format, value: "JPEG" } + - column: { name: thumbnail_quality, valueNumeric: 85 } + - column: { name: gallery_enabled, valueBoolean: true } + - column: { name: gallery_format, value: "JPEG" } + - column: { name: gallery_quality, valueNumeric: 85 } + - column: { name: slideshow_enabled, valueBoolean: true } + - column: { name: slideshow_format, value: "JPEG" } + - column: { name: slideshow_quality, valueNumeric: 85 } + - column: { name: strip_metadata, valueBoolean: false } + - column: { name: require_alt_text, valueBoolean: false } + - column: { name: require_caption, valueBoolean: false } + - column: { name: cache_class, value: "MUTABLE" } + - column: { name: storage_prefix, value: "media" } + - column: { name: create_date, valueComputed: CURRENT_TIMESTAMP } + - column: { name: modify_date, valueComputed: CURRENT_TIMESTAMP } + - insert: + tableName: ${cms.tablePrefix}media_type + columns: + - column: { name: name, value: "Document" } + - column: { name: code, value: "DOCUMENT" } + - column: { name: description, value: "Document files (PDF, DOCX, etc.)" } + - column: { name: is_active, valueBoolean: true } + - column: { name: sort_order, valueNumeric: 4 } + - column: { name: thumbnail_enabled, valueBoolean: true } + - column: { name: thumbnail_format, value: "JPEG" } + - column: { name: thumbnail_quality, valueNumeric: 85 } + - column: { name: gallery_enabled, valueBoolean: true } + - column: { name: gallery_format, value: "JPEG" } + - column: { name: gallery_quality, valueNumeric: 85 } + - column: { name: slideshow_enabled, valueBoolean: true } + - column: { name: slideshow_format, value: "JPEG" } + - column: { name: slideshow_quality, valueNumeric: 85 } + - column: { name: strip_metadata, valueBoolean: false } + - column: { name: require_alt_text, valueBoolean: false } + - column: { name: require_caption, valueBoolean: false } + - column: { name: cache_class, value: "MUTABLE" } + - column: { name: storage_prefix, value: "media" } + - column: { name: create_date, valueComputed: CURRENT_TIMESTAMP } + - column: { name: modify_date, valueComputed: CURRENT_TIMESTAMP } + - insert: + tableName: ${cms.tablePrefix}media_type + columns: + - column: { name: name, value: "Other" } + - column: { name: code, value: "OTHER" } + - column: { name: description, value: "Other file types" } + - column: { name: is_active, valueBoolean: true } + - column: { name: sort_order, valueNumeric: 5 } + - column: { name: thumbnail_enabled, valueBoolean: true } + - column: { name: thumbnail_format, value: "JPEG" } + - column: { name: thumbnail_quality, valueNumeric: 85 } + - column: { name: gallery_enabled, valueBoolean: true } + - column: { name: gallery_format, value: "JPEG" } + - column: { name: gallery_quality, valueNumeric: 85 } + - column: { name: slideshow_enabled, valueBoolean: true } + - column: { name: slideshow_format, value: "JPEG" } + - column: { name: slideshow_quality, valueNumeric: 85 } + - column: { name: strip_metadata, valueBoolean: false } + - column: { name: require_alt_text, valueBoolean: false } + - column: { name: require_caption, valueBoolean: false } + - column: { name: cache_class, value: "MUTABLE" } + - column: { name: storage_prefix, value: "media" } + - column: { name: create_date, valueComputed: CURRENT_TIMESTAMP } + - column: { name: modify_date, valueComputed: CURRENT_TIMESTAMP } + + # Generic reference data (never content); off with cms.seedReferenceData=false. + - changeSet: + id: 1.0.0-seed-blog_type + author: qbit-cms + logicalFilePath: qbit-cms/changelog + preConditions: + - onFail: CONTINUE + - sqlCheck: + expectedResult: 1 + sql: SELECT CASE WHEN POSITION(',CORE,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',MEDIA,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND POSITION(',BLOG,' IN CONCAT(',', REPLACE('${cms.features}', ' ', ''), ',')) > 0 AND LOWER('${cms.seedReferenceData}') = 'true' THEN 1 ELSE 0 END + changes: + - insert: + tableName: ${cms.tablePrefix}blog_type + columns: + - column: { name: name, value: "Site Blog" } + - column: { name: code, value: "SITE_BLOG" } + - column: { name: description, value: "A general blog for the site" } + - column: { name: is_active, valueBoolean: true } + - column: { name: sort_order, valueNumeric: 1 } + - column: { name: create_date, valueComputed: CURRENT_TIMESTAMP } + - column: { name: modify_date, valueComputed: CURRENT_TIMESTAMP } + - insert: + tableName: ${cms.tablePrefix}blog_type + columns: + - column: { name: name, value: "Project Update Blog" } + - column: { name: code, value: "PROJECT_UPDATE_BLOG" } + - column: { name: description, value: "A blog for project updates" } + - column: { name: is_active, valueBoolean: true } + - column: { name: sort_order, valueNumeric: 2 } + - column: { name: create_date, valueComputed: CURRENT_TIMESTAMP } + - column: { name: modify_date, valueComputed: CURRENT_TIMESTAMP } diff --git a/src/test/java/com/kingsrook/qbits/cms/CmsContentFeaturesTest.java b/src/test/java/com/kingsrook/qbits/cms/CmsContentFeaturesTest.java new file mode 100644 index 0000000..b0ba603 --- /dev/null +++ b/src/test/java/com/kingsrook/qbits/cms/CmsContentFeaturesTest.java @@ -0,0 +1,596 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms; + + +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.time.Instant; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Stream; +import com.kingsrook.qbits.cms.security.CmsRole; +import com.kingsrook.qbits.cms.security.CmsSecurity; +import com.kingsrook.qbits.cms.metadata.CmsValueListCheck; +import com.kingsrook.qqq.backend.core.actions.customizers.TableCustomizers; +import com.kingsrook.qqq.backend.core.actions.dashboard.RenderWidgetAction; +import com.kingsrook.qqq.backend.core.actions.tables.CountAction; +import com.kingsrook.qqq.backend.core.actions.tables.DeleteAction; +import com.kingsrook.qqq.backend.core.actions.tables.GetAction; +import com.kingsrook.qqq.backend.core.actions.tables.InsertAction; +import com.kingsrook.qqq.backend.core.actions.tables.QueryAction; +import com.kingsrook.qqq.backend.core.actions.tables.UpdateAction; +import com.kingsrook.qqq.backend.core.context.QContext; +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.core.exceptions.QPermissionDeniedException; +import com.kingsrook.qqq.backend.core.instances.QInstanceValidator; +import com.kingsrook.qqq.backend.core.model.actions.tables.count.CountInput; +import com.kingsrook.qqq.backend.core.model.actions.tables.delete.DeleteInput; +import com.kingsrook.qqq.backend.core.model.actions.tables.get.GetInput; +import com.kingsrook.qqq.backend.core.model.actions.tables.insert.InsertInput; +import com.kingsrook.qqq.backend.core.model.actions.tables.query.QCriteriaOperator; +import com.kingsrook.qqq.backend.core.model.actions.tables.query.QFilterCriteria; +import com.kingsrook.qqq.backend.core.model.actions.tables.query.QQueryFilter; +import com.kingsrook.qqq.backend.core.model.actions.tables.query.QueryInput; +import com.kingsrook.qqq.backend.core.model.actions.tables.update.UpdateInput; +import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetInput; +import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetOutput; +import com.kingsrook.qqq.backend.core.model.dashboard.widgets.RawHTML; +import com.kingsrook.qqq.backend.core.model.data.QRecord; +import com.kingsrook.qqq.backend.core.model.metadata.QInstance; +import com.kingsrook.qqq.backend.core.model.metadata.fields.AdornmentType; +import com.kingsrook.qqq.backend.core.model.metadata.fields.FieldAdornment; +import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldType; +import com.kingsrook.qqq.backend.core.model.metadata.layout.QAppMetaData; +import com.kingsrook.qqq.backend.core.model.metadata.permissions.PermissionLevel; +import com.kingsrook.qqq.backend.core.model.metadata.possiblevalues.QPossibleValueSourceType; +import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData; +import com.kingsrook.qqq.backend.core.utils.JsonUtils; +import com.kingsrook.qqq.backend.module.rdbms.jdbc.ConnectionManager; +import com.kingsrook.qqq.backend.module.rdbms.model.metadata.RDBMSBackendMetaData; +import com.kingsrook.qqq.backend.module.rdbms.model.metadata.RDBMSTableBackendDetails; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + + +/******************************************************************************* + ** The content features (MEDIA, BLOG, PROJECTS, PHOTOS): what they produce, + ** how they depend on each other, their install on H2 and content written + ** through QQQ's own actions. + *******************************************************************************/ +class CmsContentFeaturesTest +{ + private static final List CONTENT_TABLES = List.of("cms_media_type", "cms_media", "cms_blog_type", "cms_blog", "cms_author", "cms_blog_tag", "cms_blog_post", + "cms_blog_post_tag_int", "cms_blog_post_media", "cms_blog_post_version", "cms_project_category", "cms_project", "cms_project_update", "cms_photo_album_folder", + "cms_photo_album", "cms_photo", "cms_photo_tag", "cms_photo_tag_int"); + + private static final List VALUE_LISTS = List.of("cms_media_rendition_format", "cms_media_cache_class", "cms_content_channel", "cms_content_format", + "cms_content_version_status", "cms_project_status"); + + + + /******************************************************************************* + ** + *******************************************************************************/ + @AfterEach + void afterEach() + { + QContext.clear(); + } + + + + /******************************************************************************* + ** Every content table is a standard, visible table with its own + ** possible-value source; value lists, file previews, help text, + ** associations, areas and the nav are as designed; the instance is valid. + *******************************************************************************/ + @Test + void testProduce() throws Exception + { + QInstance qInstance = CmsTestSupport.blankInstance(CmsTestSupport.h2Backend()); + CmsQBitConfig config = config(); + new CmsQBitProducer().withQBitConfig(config).produce(qInstance); + new QInstanceValidator().validate(qInstance); + + assertThat(CmsTables.definitions()).hasSize(29); + assertThat(CmsTables.valueListNames()).hasSize(6).isSorted(); + for(String name : CONTENT_TABLES) + { + QTableMetaData table = qInstance.getTable(name); + assertThat(table).as(name).isNotNull(); + assertThat(((RDBMSTableBackendDetails) table.getBackendDetails()).getTableName()).isEqualTo(name); + assertThat(table.getPermissionRules().getLevel()).isEqualTo(PermissionLevel.READ_INSERT_EDIT_DELETE_PERMISSIONS); + assertThat(table.getIsHidden()).as(name + " is visible").isFalse(); + assertThat(table.getField("createDate").getBackendName()).isEqualTo("create_date"); + assertThat(table.getField("modifyDate").getIsEditable()).isFalse(); + assertThat(qInstance.getPossibleValueSource(name)).as(name + " PVS").isNotNull(); + } + for(String name : VALUE_LISTS) + { + assertThat(qInstance.getPossibleValueSource(name)).as(name).isNotNull(); + assertThat(qInstance.getPossibleValueSource(name).getType()).isEqualTo(QPossibleValueSourceType.ENUM); + } + assertThat(qInstance.getTable("cms_media_type").getField("thumbnailFormat").getPossibleValueSourceName()).isEqualTo("cms_media_rendition_format"); + assertThat(qInstance.getTable("cms_media_type").getField("cacheClass").getPossibleValueSourceName()).isEqualTo("cms_media_cache_class"); + assertThat(qInstance.getTable("cms_project").getField("projectStatus").getPossibleValueSourceName()).isEqualTo("cms_project_status"); + assertThat(qInstance.getTable("cms_blog_post_version").getField("channel").getPossibleValueSourceName()).isEqualTo("cms_content_channel"); + assertThat(qInstance.getTable("cms_blog_post").getField("featuredMediaId").getPossibleValueSourceName()).isEqualTo("cms_media"); + assertThat(qInstance.getTable("cms_blog_post").getField("content").getType()).isEqualTo(QFieldType.TEXT); + assertThat(qInstance.getTable("cms_author").getField("socialLinks").getType()).isEqualTo(QFieldType.TEXT); + assertThat(qInstance.getTable("cms_photo_album").getField("locationLatitude").getType()).isEqualTo(QFieldType.DECIMAL); + assertThat(qInstance.getTable("cms_photo_album").getField("photoAlbumFolderId").getBackendName()).isEqualTo("photo_album_folder_id"); + assertThat(qInstance.getTable("cms_blog_post").getRecordLabelFields()).containsExactly("title"); + assertThat(qInstance.getTable("cms_media").getLabel()).isEqualTo("Media"); + assertThat(qInstance.getTable("cms_blog_post_media").getLabel()).isEqualTo("Blog Post Media"); + assertThat(qInstance.getTable("cms_project_category").getLabel()).isEqualTo("Project Categories"); + + FieldAdornment stored = qInstance.getTable("cms_media").getField("publicUrl").getAdornment(AdornmentType.FILE_PREVIEW).orElseThrow(); + assertThat(stored.getValues()).containsEntry(AdornmentType.FilePreviewValues.THUMBNAIL_URL_FIELD, "thumbnailUrl") + .containsEntry(AdornmentType.FilePreviewValues.FILE_NAME_FIELD, "fileName").containsEntry(AdornmentType.FilePreviewValues.ALT_TEXT_FIELD, "altText"); + FieldAdornment image = qInstance.getTable("cms_blog_post").getField("featuredImage").getAdornment(AdornmentType.FILE_PREVIEW).orElseThrow(); + assertThat(image.getValues()).containsEntry(AdornmentType.FilePreviewValues.DEFAULT_MIME_TYPE, "image/*") + .containsEntry(AdornmentType.FilePreviewValues.ALT_TEXT_FIELD, "title").doesNotContainKey(AdornmentType.FilePreviewValues.THUMBNAIL_URL_FIELD); + assertThat(qInstance.getTable("cms_media_type").getField("allowedMimeTypes").getHelpContents()).hasSize(1); + + ////////////////////////////////////////////////////////////////// + // a table with a value-list field checks it on every write // + ////////////////////////////////////////////////////////////////// + for(String name : List.of("cms_media_type", "cms_blog_post_version", "cms_project")) + { + assertThat(qInstance.getTable(name).getCustomizer(TableCustomizers.PRE_INSERT_RECORD.getRole()).orElseThrow().getName()).isEqualTo(CmsValueListCheck.class.getName()); + assertThat(qInstance.getTable(name).getCustomizer(TableCustomizers.PRE_UPDATE_RECORD.getRole()).orElseThrow().getName()).isEqualTo(CmsValueListCheck.class.getName()); + } + assertThat(qInstance.getTable("cms_blog").getCustomizer(TableCustomizers.PRE_INSERT_RECORD.getRole())).isEmpty(); + + assertThat(qInstance.getTable("cms_blog").getAssociations()).extracting("name").containsExactly("tags"); + assertThat(qInstance.getTable("cms_blog_post").getAssociations()).extracting("name").containsExactly("tags", "media"); + assertThat(qInstance.getTable("cms_project").getAssociations()).extracting("name").containsExactly("updates"); + assertThat(qInstance.getTable("cms_photo_album").getAssociations()).extracting("name").containsExactly("photos"); + assertThat(qInstance.getTable("cms_project").getSections()).extracting("name") + .contains("cms_project_cms_project_update_projectId", "cms_project_cms_photo_album_projectId", "cms_project_cms_blog_post_version_projectId"); + + QAppMetaData top = qInstance.getApp("cms"); + assertThat(top.getChildren()).extracting("name").containsExactly("cmsSites", "cmsPages", "cmsNavigation", "cmsMedia", "cmsBlogs", "cmsProjects", "cmsPhotos"); + assertThat(qInstance.getApp("cmsBlogs").getWidgets()).containsExactly("cmsBlogsHome"); + assertThat(navTables(qInstance)).contains("cms_media", "cms_media_type", "cms_blog_post", "cms_blog", "cms_author", "cms_blog_type", "cms_project", + "cms_project_category", "cms_photo_album", "cms_photo_album_folder", "cms_photo_tag") + .doesNotContain("cms_blog_tag", "cms_blog_post_tag_int", "cms_blog_post_media", "cms_blog_post_version", "cms_project_update", "cms_photo", "cms_photo_tag_int"); + } + + + + /******************************************************************************* + ** A feature that is off produces nothing, and what refers to it loses its + ** lookup and its list; blogs, projects and photos need media. + *******************************************************************************/ + @Test + void testFeatureSubsets() throws Exception + { + QInstance blogs = CmsTestSupport.blankInstance(CmsTestSupport.h2Backend()); + new CmsQBitProducer().withQBitConfig(config().withFeatures(EnumSet.of(CmsFeature.CORE, CmsFeature.MEDIA, CmsFeature.BLOG))).produce(blogs); + new QInstanceValidator().validate(blogs); + assertThat(blogs.getTable("cms_project")).isNull(); + assertThat(blogs.getTable("cms_photo_album")).isNull(); + assertThat(blogs.getTable("cms_blog_post_version").getField("projectId").getPossibleValueSourceName()).isNull(); + assertThat(blogs.getPossibleValueSource("cms_project_status")).isNull(); + assertThat(blogs.getPossibleValueSource("cms_content_channel")).isNotNull(); + assertThat(blogs.getApp("cms").getChildren()).extracting("name").containsExactly("cmsSites", "cmsPages", "cmsNavigation", "cmsMedia", "cmsBlogs"); + + QInstance projects = CmsTestSupport.blankInstance(CmsTestSupport.h2Backend()); + new CmsQBitProducer().withQBitConfig(config().withFeatures(EnumSet.of(CmsFeature.CORE, CmsFeature.MEDIA, CmsFeature.PROJECTS))).produce(projects); + new QInstanceValidator().validate(projects); + assertThat(projects.getTable("cms_blog")).isNull(); + assertThat(projects.getTable("cms_project").getSections()).extracting("name").contains("cms_project_cms_project_update_projectId") + .doesNotContain("cms_project_cms_photo_album_projectId", "cms_project_cms_blog_post_version_projectId"); + assertThat(projects.getPossibleValueSource("cms_content_channel")).isNull(); + + QInstance media = CmsTestSupport.blankInstance(CmsTestSupport.h2Backend()); + new CmsQBitProducer().withQBitConfig(config().withFeatures(EnumSet.of(CmsFeature.CORE, CmsFeature.MEDIA))).produce(media); + new QInstanceValidator().validate(media); + assertThat(media.getTable("cms_media")).isNotNull(); + assertThat(media.getTable("cms_author")).isNull(); + + QInstance core = CmsTestSupport.blankInstance(CmsTestSupport.h2Backend()); + new CmsQBitProducer().withQBitConfig(config().withFeatures(EnumSet.of(CmsFeature.CORE))).produce(core); + assertThat(core.getTables().keySet()).noneMatch(CONTENT_TABLES::contains); + assertThat(core.getPossibleValueSources().keySet()).noneMatch(VALUE_LISTS::contains); + + for(CmsFeature feature : List.of(CmsFeature.BLOG, CmsFeature.PROJECTS, CmsFeature.PHOTOS)) + { + QInstance qInstance = CmsTestSupport.blankInstance(CmsTestSupport.h2Backend()); + assertThatThrownBy(() -> new CmsQBitProducer().withQBitConfig(config().withFeatures(EnumSet.of(CmsFeature.CORE, feature))).produce(qInstance)) + .hasMessageContaining("feature " + feature + " requires MEDIA"); + } + } + + + + /******************************************************************************* + ** Fresh install with every feature: the schema check passes, generic media + ** and blog types are seeded, and content round-trips with its defaults, + ** its children through associations and its unique keys. + *******************************************************************************/ + @Test + void testInstallAndContent() throws Exception + { + RDBMSBackendMetaData backend = CmsTestSupport.h2Backend(); + CmsTestSupport.migrate(backend, Map.of()); + QInstance qInstance = CmsTestSupport.blankInstance(backend); + CmsQBitConfig config = new CmsQBitConfig().withBackendName(CmsTestSupport.BACKEND); + new CmsQBitProducer().withQBitConfig(config).produce(qInstance); + new QInstanceValidator().validate(qInstance); + assertThat(config.getRuntime().getSchemaProblems()).isEmpty(); + + CmsTestSupport.session(qInstance, CmsSecurity.permissionsFor(config, Set.of(CmsRole.ADMIN))); + assertThat(count("cms_media_type")).isEqualTo(5); + assertThat(count("cms_blog_type")).isEqualTo(2); + QRecord imageType = one("cms_media_type", "code", "IMAGE"); + assertThat(imageType.getValueString("allowedExtensions")).isEqualTo("jpg,jpeg,png,heic,heif"); + assertThat(imageType.getValueInteger("maxFileSizeMb")).isEqualTo(25); + assertThat(imageType.getValueBoolean("stripMetadata")).isTrue(); + assertThat(imageType.getValueString("thumbnailFormat")).isEqualTo("JPEG"); + assertThat(one("cms_media_type", "code", "VIDEO").getValueBoolean("stripMetadata")).isFalse(); + + Integer siteId = insert("cms_site", new QRecord().withValue("name", "Example").withValue("shortName", "example")); + Integer mediaId = insert("cms_media", new QRecord().withValue("name", "Harbour at dawn").withValue("mediaTypeId", imageType.getValue("id")).withValue("siteId", siteId) + .withValue("publicUrl", "https://files.example.com/harbour.jpg").withValue("thumbnailUrl", "https://files.example.com/harbour-thumb.jpg") + .withValue("mimeType", "image/jpeg").withValue("altText", "Boats in a harbour at dawn")); + assertThat(get("cms_media", mediaId).getValueBoolean("isActive")).isTrue(); + + Integer blogId = insert("cms_blog", new QRecord().withValue("name", "News").withValue("shortName", "news").withValue("slug", "news") + .withValue("blogTypeId", one("cms_blog_type", "code", "SITE_BLOG").getValue("id")).withValue("siteId", siteId) + .withAssociatedRecord("tags", new QRecord().withValue("name", "Releases").withValue("slug", "releases"))); + Integer tagId = one("cms_blog_tag", "slug", "releases").getValueInteger("id"); + Integer authorId = insert("cms_author", new QRecord().withValue("name", "Ada Example").withValue("shortName", "ada").withValue("slug", "ada") + .withValue("profileMediaId", mediaId)); + assertThat(get("cms_author", authorId).getValueBoolean("isActive")).isTrue(); + + Integer postId = insert("cms_blog_post", post("first", blogId, authorId).withValue("content", "x".repeat(5000)).withValue("featuredMediaId", mediaId) + .withAssociatedRecord("tags", new QRecord().withValue("blogTagId", tagId)) + .withAssociatedRecord("media", new QRecord().withValue("mediaId", mediaId).withValue("url", "https://files.example.com/harbour.jpg"))); + QRecord post = new GetAction().execute(new GetInput("cms_blog_post").withPrimaryKey(postId).withIncludeAssociations(true)).getRecord(); + assertThat(post.getValueString("content")).hasSize(5000); + assertThat(post.getValueBoolean("isPublished")).isFalse(); + assertThat(post.getValueBoolean("isFeatured")).isFalse(); + assertThat(post.getValueInteger("readTime")).isEqualTo(4); + assertThat(post.getValueLong("viewCount")).isZero(); + assertThat(post.getValue("createDate")).isNotNull(); + assertThat(post.getAssociatedRecords().get("tags")).hasSize(1); + assertThat(post.getAssociatedRecords().get("media")).hasSize(1); + assertThat(post.getAssociatedRecords().get("media").get(0).getValueInteger("sortOrder")).isZero(); + + ////////////////////////////////////////////////////////////////// + // a slug is unique within its blog: the second insert is an // + // error on the record, not a second row // + ////////////////////////////////////////////////////////////////// + QRecord duplicate = new InsertAction().execute(new InsertInput("cms_blog_post").withRecord(post("first", blogId, authorId).withValue("name", "Other") + .withValue("shortName", "other"))).getRecords().get(0); + assertThat(duplicate.getErrors()).isNotEmpty(); + assertThat(count("cms_blog_post")).isEqualTo(1); + + Integer versionId = insert("cms_blog_post_version", new QRecord().withValue("blogPostId", postId).withValue("name", "LinkedIn").withValue("variantKey", "linkedin") + .withValue("channel", "LINKEDIN").withValue("content", "Short version")); + assertThat(get("cms_blog_post_version", versionId).getValueString("contentFormat")).isEqualTo("MARKDOWN"); + assertThat(get("cms_blog_post_version", versionId).getValueString("status")).isEqualTo("DRAFT"); + + Integer categoryId = insert("cms_project_category", new QRecord().withValue("siteId", siteId).withValue("name", "Software").withValue("title", "Software projects") + .withValue("slug", "software")); + Integer projectId = insert("cms_project", new QRecord().withValue("name", "Harbour").withValue("shortName", "harbour").withValue("slug", "harbour") + .withValue("title", "The Harbour Project").withValue("siteId", siteId).withValue("categoryId", categoryId) + .withAssociatedRecord("updates", new QRecord().withValue("slug", "kickoff").withValue("title", "Kickoff").withValue("content", "We started.") + .withValue("updateDate", Instant.parse("2026-11-01T12:00:00Z")))); + QRecord project = new GetAction().execute(new GetInput("cms_project").withPrimaryKey(projectId).withIncludeAssociations(true)).getRecord(); + assertThat(project.getValueString("projectStatus")).isEqualTo("ACTIVE"); + assertThat(project.getValueInteger("imageFocalX")).isEqualTo(50); + assertThat(project.getValueBoolean("isPublished")).isFalse(); + assertThat(project.getAssociatedRecords().get("updates")).hasSize(1); + + ////////////////////////////////////////////////////////////////// + // a value-list field takes only the values of its list: an // + // insert or an edit with another value is an error on the // + // record, and the database refuses it too // + ////////////////////////////////////////////////////////////////// + QRecord odd = new InsertAction().execute(new InsertInput("cms_project").withRecord(new QRecord().withValue("name", "Odd").withValue("shortName", "odd") + .withValue("slug", "odd").withValue("title", "Odd").withValue("siteId", siteId).withValue("categoryId", categoryId).withValue("projectStatus", "NO_SUCH_STATUS"))) + .getRecords().get(0); + assertThat(odd.getErrors()).extracting(Object::toString).anyMatch(e -> e.contains("must be one of: ACTIVE, ARCHIVED, IN_PROGRESS, PLANNED")); + assertThat(count("cms_project")).isEqualTo(1); + QRecord oddEdit = new UpdateAction().execute(new UpdateInput("cms_project").withRecord(new QRecord().withValue("id", projectId).withValue("projectStatus", "NOPE"))) + .getRecords().get(0); + assertThat(oddEdit.getErrors()).isNotEmpty(); + assertThat(get("cms_project", projectId).getValueString("projectStatus")).isEqualTo("ACTIVE"); + assertThat(new UpdateAction().execute(new UpdateInput("cms_project").withRecord(new QRecord().withValue("id", projectId).withValue("projectStatus", "ARCHIVED"))) + .getRecords().get(0).getErrors()).isEmpty(); + assertThat(new UpdateAction().execute(new UpdateInput("cms_project").withRecord(new QRecord().withValue("id", projectId).withValue("title", "The Harbour Project"))) + .getRecords().get(0).getErrors()).isEmpty(); + assertThat(get("cms_project", projectId).getValueString("projectStatus")).isEqualTo("ARCHIVED"); + try(Connection connection = ConnectionManager.getConnection(backend); Statement statement = connection.createStatement()) + { + assertThatThrownBy(() -> statement.execute("UPDATE cms_project SET project_status = 'NOPE'")).isInstanceOf(SQLException.class); + assertThatThrownBy(() -> statement.execute("UPDATE cms_project SET image_focal_x = 101")).isInstanceOf(SQLException.class); + assertThatThrownBy(() -> statement.execute("UPDATE cms_media_type SET thumbnail_format = 'GIF'")).isInstanceOf(SQLException.class); + assertThatThrownBy(() -> statement.execute("UPDATE cms_blog_post_version SET channel = 'FAX'")).isInstanceOf(SQLException.class); + } + + Integer folderId = insert("cms_photo_album_folder", new QRecord().withValue("siteId", siteId).withValue("name", "Travel").withValue("slug", "travel")); + Integer albumId = insert("cms_photo_album", new QRecord().withValue("siteId", siteId).withValue("photoAlbumFolderId", folderId).withValue("projectId", projectId) + .withValue("name", "Harbour mornings").withValue("shortName", "harbour").withValue("slug", "harbour").withValue("locationLatitude", new BigDecimal("41.878100")) + .withAssociatedRecord("photos", new QRecord().withValue("title", "First light").withValue("slug", "first-light").withValue("mediaId", mediaId))); + QRecord album = new GetAction().execute(new GetInput("cms_photo_album").withPrimaryKey(albumId).withIncludeAssociations(true)).getRecord(); + assertThat(album.getValueBigDecimal("locationLatitude")).isEqualByComparingTo("41.8781"); + assertThat(album.getAssociatedRecords().get("photos")).hasSize(1); + Integer photoId = album.getAssociatedRecords().get("photos").get(0).getValueInteger("id"); + Integer photoTagId = insert("cms_photo_tag", new QRecord().withValue("name", "Dawn").withValue("slug", "dawn")); + insert("cms_photo_tag_int", new QRecord().withValue("photoId", photoId).withValue("photoTagId", photoTagId)); + assertThat(new GetAction().execute(new GetInput("cms_photo").withPrimaryKey(photoId).withIncludeAssociations(true)).getRecord().getAssociatedRecords().get("tags")) + .hasSize(1); + + ///////////////////////////////////////////////////////////////// + // every child list of the content features renders for a row // + ///////////////////////////////////////////////////////////////// + Map lists = Map.ofEntries(Map.entry("cms_media_type_cms_media_mediaTypeId", imageType.getValueInteger("id")), + Map.entry("cms_blog_cms_blog_post_blogId", blogId), Map.entry("cms_blog_cms_blog_tag_blogId", blogId), Map.entry("cms_author_cms_blog_post_authorId", authorId), + Map.entry("cms_blog_tag_cms_blog_post_tag_int_blogTagId", tagId), Map.entry("cms_blog_post_cms_blog_post_tag_int_blogPostId", postId), + Map.entry("cms_blog_post_cms_blog_post_media_blogPostId", postId), Map.entry("cms_blog_post_cms_blog_post_version_blogPostId", postId), + Map.entry("cms_project_category_cms_project_categoryId", categoryId), Map.entry("cms_project_cms_project_update_projectId", projectId), + Map.entry("cms_project_cms_photo_album_projectId", projectId), Map.entry("cms_project_cms_blog_post_version_projectId", projectId), + Map.entry("cms_photo_album_folder_cms_photo_album_folder_parentId", folderId), Map.entry("cms_photo_album_folder_cms_photo_album_photoAlbumFolderId", folderId), + Map.entry("cms_photo_album_cms_photo_photoAlbumId", albumId), Map.entry("cms_photo_cms_photo_tag_int_photoId", photoId), + Map.entry("cms_photo_tag_cms_photo_tag_int_photoTagId", photoTagId)); + for(Map.Entry list : lists.entrySet()) + { + assertThat(qInstance.getWidget(list.getKey())).as(list.getKey()).isNotNull(); + RenderWidgetOutput output = new RenderWidgetAction().execute(new RenderWidgetInput().withWidgetMetaData(qInstance.getWidget(list.getKey())) + .withUrlParams(new HashMap<>(Map.of("id", String.valueOf(list.getValue()))))); + assertThat(JsonUtils.toJson(output.getWidgetData())).as(list.getKey()).isNotEmpty(); + } + + ///////////////////////////////////////////////////////////////// + // the homes count the new content and say what needs a look // + ///////////////////////////////////////////////////////////////// + String top = html(qInstance, "cmsHome"); + assertThat(top).contains("Media", "Blogs", "Projects", "Photos", "/app/cmsBlogs", "1 blog post"); + String blogsHome = html(qInstance, "cmsBlogsHome"); + assertThat(blogsHome).contains("Unpublished blog posts", "New blog post", "New author", "/app/cms_blog_post/"); + assertThat(html(qInstance, "cmsMediaHome")).contains("Harbour at dawn", "New media").doesNotContain("medias"); + assertThat(html(qInstance, "cmsProjectsHome")).contains("The Harbour Project", "Unpublished projects"); + assertThat(html(qInstance, "cmsPhotosHome")).contains("Unpublished photo albums", "New album folder"); + } + + + + /******************************************************************************* + ** Features can be installed later: a run that names a feature creates its + ** tables, and the links between two features appear when both are there. A + ** feature whose needs are not named installs nothing. + *******************************************************************************/ + @Test + void testFeaturesInstalledLater() throws Exception + { + RDBMSBackendMetaData backend = CmsTestSupport.h2Backend(); + CmsTestSupport.migrate(backend, Map.of("cms.features", "CORE,MEDIA,BLOG")); + CmsQBitConfig blogs = new CmsQBitConfig().withBackendName(CmsTestSupport.BACKEND).withFeatures(EnumSet.of(CmsFeature.CORE, CmsFeature.MEDIA, CmsFeature.BLOG)); + new CmsQBitProducer().withQBitConfig(blogs).produce(CmsTestSupport.blankInstance(backend)); + assertThat(blogs.getRuntime().getSchemaProblems()).isEmpty(); + assertThat(exists(backend, "TABLES", "TABLE_NAME", "cms_blog_post")).isTrue(); + assertThat(exists(backend, "TABLES", "TABLE_NAME", "cms_project")).isFalse(); + assertThat(exists(backend, "TABLE_CONSTRAINTS", "CONSTRAINT_NAME", "fk_cms_blog_post_version_project_id")).isFalse(); + + CmsQBitConfig all = new CmsQBitConfig().withBackendName(CmsTestSupport.BACKEND).withStartupMode(CmsStartupMode.DEGRADED); + new CmsQBitProducer().withQBitConfig(all).produce(CmsTestSupport.blankInstance(backend)); + assertThat(all.getRuntime().getSchemaProblems()).anyMatch(p -> p.contains("1.0.0-create-project") && p.contains("PROJECTS")) + .noneMatch(p -> p.contains("1.0.0-create-blog_post ")); + + CmsTestSupport.migrate(backend, Map.of()); + CmsQBitConfig later = new CmsQBitConfig().withBackendName(CmsTestSupport.BACKEND); + new CmsQBitProducer().withQBitConfig(later).produce(CmsTestSupport.blankInstance(backend)); + assertThat(later.getRuntime().getSchemaProblems()).isEmpty(); + assertThat(exists(backend, "TABLES", "TABLE_NAME", "cms_project")).isTrue(); + assertThat(exists(backend, "TABLE_CONSTRAINTS", "CONSTRAINT_NAME", "fk_cms_blog_post_version_project_id")).isTrue(); + assertThat(exists(backend, "TABLE_CONSTRAINTS", "CONSTRAINT_NAME", "fk_cms_photo_album_project_update_id")).isTrue(); + + RDBMSBackendMetaData incomplete = CmsTestSupport.h2Backend(); + CmsTestSupport.migrate(incomplete, Map.of("cms.features", "CORE,BLOG")); + assertThat(exists(incomplete, "TABLES", "TABLE_NAME", "cms_page")).isTrue(); + assertThat(exists(incomplete, "TABLES", "TABLE_NAME", "cms_blog")).isFalse(); + assertThat(exists(incomplete, "TABLES", "TABLE_NAME", "cms_media")).isFalse(); + } + + + + /******************************************************************************* + ** An existing table with a content-feature name halts the install; nothing + ** is overwritten. + *******************************************************************************/ + @Test + void testExistingContentTableHalts() throws Exception + { + RDBMSBackendMetaData backend = CmsTestSupport.h2Backend(); + try(Connection connection = ConnectionManager.getConnection(backend); Statement statement = connection.createStatement()) + { + statement.execute("CREATE TABLE cms_media (id INT PRIMARY KEY, name VARCHAR(10))"); + statement.execute("INSERT INTO cms_media VALUES (1, 'theirs')"); + } + assertThatThrownBy(() -> CmsTestSupport.migrate(backend, Map.of())).hasStackTraceContaining("was not created by qbit-cms"); + try(Connection connection = ConnectionManager.getConnection(backend); Statement statement = connection.createStatement(); + ResultSet resultSet = statement.executeQuery("SELECT name FROM cms_media WHERE id = 1")) + { + assertThat(resultSet.next()).isTrue(); + assertThat(resultSet.getString(1)).isEqualTo("theirs"); + } + assertThat(exists(backend, "TABLES", "TABLE_NAME", "cms_blog")).isFalse(); + } + + + + /******************************************************************************* + ** Role ceilings hold for content: editors write content and not the media + ** and blog types, drafters do not delete, viewers only read, and a feature + ** that is off grants nothing. + *******************************************************************************/ + @Test + void testRoleCeilings() throws Exception + { + CmsQBitConfig config = new CmsQBitConfig().withBackendName(CmsTestSupport.BACKEND); + Set editor = CmsSecurity.permissionsFor(config, Set.of(CmsRole.EDITOR)); + assertThat(editor).contains("cms_blog_post.insert", "cms_blog_post.delete", "cms_media.edit", "cms_photo.insert", "cms_project_update.edit", "cms_media_type.read") + .doesNotContain("cms_media_type.edit", "cms_blog_type.insert"); + assertThat(CmsSecurity.permissionsFor(config, Set.of(CmsRole.DRAFTER))).contains("cms_blog_post.insert").doesNotContain("cms_blog_post.delete"); + assertThat(CmsSecurity.permissionsFor(config, Set.of(CmsRole.VIEWER))).contains("cms_photo.read").allMatch(p -> p.endsWith(".read")); + CmsQBitConfig coreOnly = new CmsQBitConfig().withBackendName(CmsTestSupport.BACKEND).withFeatures(EnumSet.of(CmsFeature.CORE)); + assertThat(CmsSecurity.permissionsFor(coreOnly, Set.of(CmsRole.ADMIN))).noneMatch(p -> p.startsWith("cms_blog") || p.startsWith("cms_media")); + + RDBMSBackendMetaData backend = CmsTestSupport.h2Backend(); + CmsTestSupport.migrate(backend, Map.of()); + QInstance qInstance = CmsTestSupport.blankInstance(backend); + qInstance.setEnforcePermissionsInCoreActions(true); + new CmsQBitProducer().withQBitConfig(config).produce(qInstance); + + CmsTestSupport.session(qInstance, editor); + Integer siteId = insert("cms_site", new QRecord().withValue("name", "Example").withValue("shortName", "example")); + Integer mediaId = insert("cms_media", new QRecord().withValue("name", "Chart").withValue("mediaTypeId", 1).withValue("siteId", siteId)); + assertThatThrownBy(() -> new UpdateAction().execute(new UpdateInput("cms_media_type").withRecord(new QRecord().withValue("id", 1).withValue("name", "X")))) + .isInstanceOf(QPermissionDeniedException.class); + assertThatThrownBy(() -> new InsertAction().execute(new InsertInput("cms_blog_type").withRecord(new QRecord().withValue("name", "X").withValue("code", "X")))) + .isInstanceOf(QPermissionDeniedException.class); + + CmsTestSupport.session(qInstance, CmsSecurity.permissionsFor(config, Set.of(CmsRole.DRAFTER))); + assertThatThrownBy(() -> new DeleteAction().execute(new DeleteInput("cms_media").withPrimaryKey(mediaId))).isInstanceOf(QPermissionDeniedException.class); + + CmsTestSupport.session(qInstance, CmsSecurity.permissionsFor(config, Set.of(CmsRole.VIEWER))); + assertThat(new QueryAction().execute(new QueryInput("cms_media")).getRecords()).hasSize(1); + assertThatThrownBy(() -> new InsertAction().execute(new InsertInput("cms_photo_tag").withRecord(new QRecord().withValue("name", "X").withValue("slug", "x")))) + .isInstanceOf(QPermissionDeniedException.class); + + CmsTestSupport.session(qInstance, Set.of()); + assertThatThrownBy(() -> new QueryAction().execute(new QueryInput("cms_blog_post"))).isInstanceOf(QPermissionDeniedException.class); + assertThat(html(qInstance, "cmsBlogsHome")).contains("do not have access to Blogs"); + } + + + + /******************************************************************************* + ** The configuration without a database check. + *******************************************************************************/ + private static CmsQBitConfig config() + { + return (new CmsQBitConfig().withBackendName(CmsTestSupport.BACKEND).withStartupMode(CmsStartupMode.SKIP)); + } + + + + /******************************************************************************* + ** A post of a blog. + *******************************************************************************/ + private static QRecord post(String slug, Integer blogId, Integer authorId) + { + return (new QRecord().withValue("name", slug).withValue("shortName", slug).withValue("title", "Post " + slug).withValue("slug", slug) + .withValue("content", "Text").withValue("authorId", authorId).withValue("blogId", blogId)); + } + + + + /******************************************************************************* + ** The tables in the nav. + *******************************************************************************/ + private static List navTables(QInstance qInstance) + { + return (qInstance.getApps().values().stream().filter(a -> a.getSections() != null).flatMap(a -> a.getSections().stream()) + .flatMap(s -> s.getTables() == null ? Stream.empty() : s.getTables().stream()).toList()); + } + + + + /******************************************************************************* + ** Whether the database catalog lists a name (H2 folds unquoted names to + ** upper case). + *******************************************************************************/ + private static boolean exists(RDBMSBackendMetaData backend, String catalogTable, String column, String name) throws Exception + { + try(Connection connection = ConnectionManager.getConnection(backend); Statement statement = connection.createStatement(); + ResultSet resultSet = statement.executeQuery("SELECT COUNT(*) FROM INFORMATION_SCHEMA." + catalogTable + " WHERE LOWER(" + column + ") = '" + name + "'")) + { + resultSet.next(); + return (resultSet.getInt(1) > 0); + } + } + + + + /******************************************************************************* + ** A home widget's HTML. + *******************************************************************************/ + private static String html(QInstance qInstance, String widgetName) throws QException + { + RawHTML html = (RawHTML) new RenderWidgetAction().execute(new RenderWidgetInput().withWidgetMetaData(qInstance.getWidget(widgetName))).getWidgetData(); + return (html.getHtml()); + } + + + + /******************************************************************************* + ** Insert a record that must be accepted. + *******************************************************************************/ + private static Integer insert(String table, QRecord record) throws QException + { + List records = new InsertAction().execute(new InsertInput(table).withRecord(record)).getRecords(); + assertThat(records.get(0).getErrors()).as(table).isEmpty(); + return (records.get(0).getValueInteger("id")); + } + + + + /******************************************************************************* + ** One record by primary key. + *******************************************************************************/ + private static QRecord get(String table, Integer id) throws QException + { + return (new GetAction().execute(new GetInput(table).withPrimaryKey(id)).getRecord()); + } + + + + /******************************************************************************* + ** The one record with a field value. + *******************************************************************************/ + private static QRecord one(String table, String field, String value) throws QException + { + List records = new QueryAction().execute(new QueryInput(table).withFilter(new QQueryFilter(new QFilterCriteria(field, QCriteriaOperator.EQUALS, value)))) + .getRecords(); + assertThat(records).as(table + " " + field + " " + value).hasSize(1); + return (records.get(0)); + } + + + + /******************************************************************************* + ** The number of records of a table. + *******************************************************************************/ + private static Integer count(String table) throws QException + { + return (new CountAction().execute(new CountInput(table)).getCount()); + } +} diff --git a/src/test/java/com/kingsrook/qbits/cms/CmsEntitiesTest.java b/src/test/java/com/kingsrook/qbits/cms/CmsEntitiesTest.java index 1b2325e..b560655 100644 --- a/src/test/java/com/kingsrook/qbits/cms/CmsEntitiesTest.java +++ b/src/test/java/com/kingsrook/qbits/cms/CmsEntitiesTest.java @@ -21,6 +21,7 @@ import java.io.Serializable; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; +import java.math.BigDecimal; import java.time.Instant; import com.kingsrook.qbits.cms.metadata.CmsTableDefinition; import com.kingsrook.qqq.backend.core.model.data.QRecord; @@ -96,6 +97,10 @@ class CmsEntitiesTest { return (true); } + if(type == BigDecimal.class) + { + return (new BigDecimal("41.5")); + } if(type == Instant.class) { return (Instant.parse("2026-10-12T00:00:00Z")); diff --git a/src/test/java/com/kingsrook/qbits/cms/CmsFeatureTest.java b/src/test/java/com/kingsrook/qbits/cms/CmsFeatureTest.java index 4ca8bbf..5137866 100644 --- a/src/test/java/com/kingsrook/qbits/cms/CmsFeatureTest.java +++ b/src/test/java/com/kingsrook/qbits/cms/CmsFeatureTest.java @@ -34,14 +34,16 @@ class CmsFeatureTest @Test void testFeatures() { - assertThat(CmsFeature.allAvailable()).containsExactly(CmsFeature.CORE); + assertThat(CmsFeature.allAvailable()).containsExactly(CmsFeature.CORE, CmsFeature.MEDIA, CmsFeature.BLOG, CmsFeature.PROJECTS, CmsFeature.PHOTOS); assertThat(CmsFeature.validate(CmsFeature.allAvailable())).isEmpty(); assertThat(CmsFeature.validate(null)).containsExactly("features must include CORE"); assertThat(CmsFeature.BLOG.getRequires()).containsExactly(CmsFeature.MEDIA); assertThat(CmsFeature.CORE.isAvailable()).isTrue(); - assertThat(CmsFeature.validate(EnumSet.of(CmsFeature.CORE, CmsFeature.BLOG))) - .contains("feature BLOG requires MEDIA", "feature BLOG is not available in this version of qbit-cms"); + assertThat(CmsFeature.validate(EnumSet.of(CmsFeature.CORE, CmsFeature.BLOG))).containsExactly("feature BLOG requires MEDIA"); + assertThat(CmsFeature.validate(EnumSet.of(CmsFeature.CORE, CmsFeature.MEDIA, CmsFeature.BLOG, CmsFeature.PROJECTS, CmsFeature.PHOTOS))).isEmpty(); + assertThat(CmsFeature.validate(EnumSet.of(CmsFeature.CORE, CmsFeature.STREAM))) + .contains("feature STREAM requires BLOG", "feature STREAM is not available in this version of qbit-cms"); assertThat(CmsFeature.validate(EnumSet.of(CmsFeature.CORE, CmsFeature.PUBLISHING))) .contains("feature PUBLISHING requires BLOG or PROJECTS"); assertThat(CmsFeature.validate(EnumSet.of(CmsFeature.CORE, CmsFeature.MEDIA, CmsFeature.BLOG, CmsFeature.STREAM, CmsFeature.PUBLISHING))) diff --git a/src/test/java/com/kingsrook/qbits/cms/CmsHelpTest.java b/src/test/java/com/kingsrook/qbits/cms/CmsHelpTest.java new file mode 100644 index 0000000..20e341e --- /dev/null +++ b/src/test/java/com/kingsrook/qbits/cms/CmsHelpTest.java @@ -0,0 +1,128 @@ +/* + * Copyright 2026 Kingsrook, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.kingsrook.qbits.cms; + + +import java.util.EnumSet; +import java.util.List; +import com.kingsrook.qqq.backend.core.model.metadata.QInstance; +import com.kingsrook.qqq.backend.core.model.metadata.help.bundles.HelpBundles; +import com.kingsrook.qqq.backend.core.testing.HelpBundleAssertions; +import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; + + +/******************************************************************************* + ** The qbit ships its own help (help/qbit-cms.yaml): a host gets it with the + ** jar and writes none of it. It covers every app, table, field, home, child + ** list and value list of the qbit, names nothing that does not exist, and is + ** registered only under the default names it is written for. + *******************************************************************************/ +class CmsHelpTest +{ + + /******************************************************************************* + ** With every feature: registered once as a QBIT layer bundle of this version, + ** complete by the core's own gate, and every home, child list and value list + ** has its text. + *******************************************************************************/ + @Test + void testHelpCoversTheQBit() throws Exception + { + QInstance qInstance = CmsTestSupport.blankInstance(CmsTestSupport.h2Backend()); + new CmsQBitProducer().withQBitConfig(new CmsQBitConfig().withBackendName(CmsTestSupport.BACKEND).withStartupMode(CmsStartupMode.SKIP)).produce(qInstance); + + assertThat(HelpBundles.of(qInstance).getBundles()).singleElement().satisfies(bundle -> + { + assertThat(bundle.getId()).isEqualTo("qbit-cms"); + assertThat(bundle.getVersion()).isEqualTo(CmsQBitProducer.VERSION); + assertThat(bundle.getLayer().name()).isEqualTo("QBIT"); + }); + HelpBundleAssertions.forInstance(qInstance) + .bundles(CmsQBitProducer.HELP_BUNDLE) + .owning(target -> target.name().equals("cms") || target.name().startsWith("cms")) + .assertComplete(); + + var entries = HelpBundles.of(qInstance).resolveWinningEntries(); + List widgets = qInstance.getWidgets().keySet().stream().filter(name -> name.startsWith("cms")).sorted().toList(); + assertThat(widgets).hasSizeGreaterThan(30); + for(String name : widgets) + { + assertThat(entries).as("the card " + name).containsKey(new HelpBundles.EntryKey("widget:" + name + ";slot:label", "ALL_SCREENS")); + } + List sources = qInstance.getPossibleValueSources().keySet().stream().filter(name -> name.startsWith("cms_")).sorted().toList(); + assertThat(sources).hasSize(36); + for(String name : sources) + { + assertThat(entries).as("the value source " + name).containsKey(new HelpBundles.EntryKey("possibleValueSource:" + name + ";slot:help", "ALL_SCREENS")); + } + } + + + + /******************************************************************************* + ** Every section of every table has its text too (the core's gate leaves + ** sections optional). + *******************************************************************************/ + @Test + void testEverySectionHasHelp() throws Exception + { + QInstance qInstance = CmsTestSupport.blankInstance(CmsTestSupport.h2Backend()); + new CmsQBitProducer().withQBitConfig(new CmsQBitConfig().withBackendName(CmsTestSupport.BACKEND).withStartupMode(CmsStartupMode.SKIP)).produce(qInstance); + var entries = HelpBundles.of(qInstance).resolveWinningEntries(); + int sections = 0; + for(var table : qInstance.getTables().values()) + { + if(!table.getName().startsWith("cms_")) + { + continue; + } + for(var section : table.getSections()) + { + sections++; + assertThat(entries).as(table.getName() + " section " + section.getName()) + .containsKey(new HelpBundles.EntryKey("table:" + table.getName() + ";section:" + section.getName(), "ALL_SCREENS")); + } + } + assertThat(sections).isGreaterThan(100); + } + + + + /******************************************************************************* + ** The text is written for the default names: an install under other + ** prefixes does not register it, and with a feature off the entries of its + ** tables are simply unused (the gate still passes for what is there). + *******************************************************************************/ + @Test + void testOtherNamesAndFeatureSubsets() throws Exception + { + QInstance renamed = CmsTestSupport.blankInstance(CmsTestSupport.h2Backend()); + new CmsQBitProducer().withQBitConfig(new CmsQBitConfig().withBackendName(CmsTestSupport.BACKEND).withStartupMode(CmsStartupMode.SKIP) + .withTableNamePrefix("acme_cms_")).produce(renamed); + assertThat(HelpBundles.of(renamed).getBundles()).isEmpty(); + + QInstance core = CmsTestSupport.blankInstance(CmsTestSupport.h2Backend()); + new CmsQBitProducer().withQBitConfig(new CmsQBitConfig().withBackendName(CmsTestSupport.BACKEND).withStartupMode(CmsStartupMode.SKIP) + .withFeatures(EnumSet.of(CmsFeature.CORE))).produce(core); + assertThat(HelpBundles.of(core).getBundles()).hasSize(1); + assertThat(HelpBundleAssertions.forInstance(core).bundles(CmsQBitProducer.HELP_BUNDLE) + .owning(target -> target.name().equals("cms") || target.name().startsWith("cms")).report()) + .as("with CORE alone nothing of CORE is missing; entries of the other features have no object and are reported as such") + .noneMatch(line -> line.toLowerCase(java.util.Locale.ROOT).contains("missing")); + } +} diff --git a/src/test/java/com/kingsrook/qbits/cms/CmsInstallTest.java b/src/test/java/com/kingsrook/qbits/cms/CmsInstallTest.java index bcbf94b..55d9439 100644 --- a/src/test/java/com/kingsrook/qbits/cms/CmsInstallTest.java +++ b/src/test/java/com/kingsrook/qbits/cms/CmsInstallTest.java @@ -19,6 +19,7 @@ package com.kingsrook.qbits.cms; import java.sql.Connection; import java.sql.Statement; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; @@ -137,15 +138,28 @@ class CmsInstallTest /******************************************************************************* - ** Running the changelog again changes nothing (the guard runs every time - ** and passes for tables this changelog created). + ** Running the changelog again changes nothing, the migration history + ** included: a host whose migrations must be repeatable can include it. An + ** install recorded by the earlier version, whose guard ran on every + ** migration, migrates on without complaint. *******************************************************************************/ @Test void testRerunIsNoop() throws Exception { RDBMSBackendMetaData backend = CmsTestSupport.h2Backend(); CmsTestSupport.migrate(backend, Map.of()); + List history = history(backend); CmsTestSupport.migrate(backend, Map.of()); + assertThat(history(backend)).as("the migration history after a second run").isEqualTo(history); + assertThat(history).hasSizeGreaterThan(40).anyMatch(row -> row.startsWith("1.0.0-guard-existing-tables|")); + + try(Connection connection = ConnectionManager.getConnection(backend); Statement statement = connection.createStatement()) + { + statement.execute("UPDATE DATABASECHANGELOG SET MD5SUM = '9:00000000000000000000000000000000', EXECTYPE = 'RERAN' WHERE ID = '1.0.0-guard-existing-tables'"); + } + List earlier = history(backend); + CmsTestSupport.migrate(backend, Map.of()); + assertThat(history(backend)).as("the history of an install the earlier version recorded").isEqualTo(earlier); QInstance qInstance = CmsTestSupport.blankInstance(backend); CmsQBitConfig config = new CmsQBitConfig().withBackendName(CmsTestSupport.BACKEND); @@ -229,6 +243,25 @@ class CmsInstallTest + /******************************************************************************* + ** The migration history: one line per recorded changeset, in the order run. + *******************************************************************************/ + private static List history(RDBMSBackendMetaData backend) throws Exception + { + List rows = new ArrayList<>(); + try(Connection connection = ConnectionManager.getConnection(backend); Statement statement = connection.createStatement(); + var resultSet = statement.executeQuery("SELECT ID, ORDEREXECUTED, DATEEXECUTED, MD5SUM, EXECTYPE FROM DATABASECHANGELOG ORDER BY ORDEREXECUTED, ID")) + { + while(resultSet.next()) + { + rows.add(resultSet.getString(1) + "|" + resultSet.getString(2) + "|" + resultSet.getString(3) + "|" + resultSet.getString(4) + "|" + resultSet.getString(5)); + } + } + return (rows); + } + + + /******************************************************************************* ** *******************************************************************************/ diff --git a/src/test/java/com/kingsrook/qbits/cms/CmsPostgresInstallTest.java b/src/test/java/com/kingsrook/qbits/cms/CmsPostgresInstallTest.java index 0d813e9..d775236 100644 --- a/src/test/java/com/kingsrook/qbits/cms/CmsPostgresInstallTest.java +++ b/src/test/java/com/kingsrook/qbits/cms/CmsPostgresInstallTest.java @@ -101,6 +101,41 @@ class CmsPostgresInstallTest assertThat(resultSet.getString(1)).isEqualTo("public.cms_page_id_seq"); assertThat(resultSet.getInt(2)).isEqualTo(3); } + + //////////////////////////////////////////////////////////////////// + // the content features: column types, and the links between two // + // features (versions and albums of projects) // + //////////////////////////////////////////////////////////////////// + assertThat(columns(statement, "cms_media")).contains( + "id bigint NO", "name character varying(200) NO", "media_type_id bigint NO", "public_url character varying(500) YES", "file_size bigint YES", + "is_active boolean NO", "site_id bigint NO"); + assertThat(columns(statement, "cms_media_type")).contains("thumbnail_format character varying(10) NO", "max_file_size_mb integer YES", "strip_metadata boolean NO"); + assertThat(columns(statement, "cms_blog_post")).contains( + "title character varying(100) YES", "content text NO", "excerpt text YES", "is_published boolean YES", "is_featured boolean NO", "view_count bigint YES"); + assertThat(columns(statement, "cms_photo_album")).contains("location_latitude double precision YES", "album_date timestamp without time zone YES"); + assertThat(columns(statement, "cms_project_update")).contains("update_date timestamp without time zone NO", "content text NO"); + try(ResultSet resultSet = statement.executeQuery("SELECT table_name || ':' || COUNT(*) FROM information_schema.table_constraints " + + "WHERE constraint_type = 'FOREIGN KEY' AND table_name IN ('cms_blog_post', 'cms_blog_post_version', 'cms_photo_album', 'cms_media') " + + "GROUP BY table_name ORDER BY table_name")) + { + List foreignKeys = new ArrayList<>(); + while(resultSet.next()) + { + foreignKeys.add(resultSet.getString(1)); + } + assertThat(foreignKeys).containsExactly("cms_blog_post:3", "cms_blog_post_version:3", "cms_media:2", "cms_photo_album:5"); + } + try(ResultSet resultSet = statement.executeQuery("SELECT COUNT(*) FROM information_schema.table_constraints WHERE constraint_type = 'CHECK' " + + "AND constraint_name LIKE 'ck_cms_%'")) + { + assertThat(resultSet.next()).isTrue(); + assertThat(resultSet.getInt(1)).isEqualTo(11); + } + try(ResultSet resultSet = statement.executeQuery("SELECT COUNT(*) FROM cms_media_type")) + { + assertThat(resultSet.next()).isTrue(); + assertThat(resultSet.getInt(1)).isEqualTo(5); + } } CmsTestSupport.session(qInstance, CmsSecurity.permissionsFor(config, Set.of(CmsRole.ADMIN))); diff --git a/src/test/java/com/kingsrook/qbits/cms/CmsQBitProducerTest.java b/src/test/java/com/kingsrook/qbits/cms/CmsQBitProducerTest.java index 7ef044e..f2b20b3 100644 --- a/src/test/java/com/kingsrook/qbits/cms/CmsQBitProducerTest.java +++ b/src/test/java/com/kingsrook/qbits/cms/CmsQBitProducerTest.java @@ -47,7 +47,7 @@ class CmsQBitProducerTest /******************************************************************************* - ** The CORE feature: eleven standard tables named per the owner rule, a + ** The CORE feature alone: eleven standard tables named per the owner rule, a ** possible-value source each, child lists, apps with homes, and a valid ** instance. *******************************************************************************/ @@ -55,7 +55,7 @@ class CmsQBitProducerTest void testProduceCore() throws Exception { QInstance qInstance = CmsTestSupport.blankInstance(CmsTestSupport.h2Backend()); - CmsQBitConfig config = config(); + CmsQBitConfig config = config().withFeatures(EnumSet.of(CmsFeature.CORE)); CmsQBitProducer producer = new CmsQBitProducer().withQBitConfig(config); assertThat(producer.isEnabled()).isTrue(); assertThat(producer.getQBitConfig()).isSameAs(config); @@ -128,7 +128,7 @@ class CmsQBitProducerTest assertThatThrownBy(() -> produce(qInstance, config().withNamePrefix("9x"))).hasMessageContaining("namePrefix"); assertThatThrownBy(() -> produce(qInstance, config().withPermissionBaseName(""))).hasMessageContaining("permissionBaseName"); assertThatThrownBy(() -> produce(qInstance, config().withParentAppName("content"))).hasMessageContaining("parentAppName content"); - assertThatThrownBy(() -> produce(qInstance, config().withFeatures(EnumSet.of(CmsFeature.CORE, CmsFeature.MEDIA)))).hasMessageContaining("MEDIA is not available"); + assertThatThrownBy(() -> produce(qInstance, config().withFeatures(EnumSet.of(CmsFeature.CORE, CmsFeature.PUBLISHING)))).hasMessageContaining("PUBLISHING is not available"); assertThatThrownBy(() -> produce(qInstance, config().withFeatures(Set.of()))).hasMessageContaining("must include CORE"); assertThatThrownBy(() -> produce(qInstance, config().withRoleMapping(null))).hasMessageContaining("roleMapping"); assertThatThrownBy(() -> produce(qInstance, config().withStartupMode(null))).hasMessageContaining("startupMode"); diff --git a/src/test/java/com/kingsrook/qbits/cms/home/CmsHomeRendererTest.java b/src/test/java/com/kingsrook/qbits/cms/home/CmsHomeRendererTest.java index 2cd8ec7..ea060fa 100644 --- a/src/test/java/com/kingsrook/qbits/cms/home/CmsHomeRendererTest.java +++ b/src/test/java/com/kingsrook/qbits/cms/home/CmsHomeRendererTest.java @@ -146,6 +146,9 @@ class CmsHomeRendererTest assertThat(CmsHomeRenderer.plural(2, "Page Type")).isEqualTo("2 page types"); assertThat(CmsTableDefinition.pluralize("Category")).isEqualTo("Categories"); assertThat(CmsTableDefinition.pluralize("Key")).isEqualTo("Keys"); + assertThat(CmsTableDefinition.pluralize("Media")).isEqualTo("Media"); + assertThat(CmsTableDefinition.pluralize("Blog Post Media")).isEqualTo("Blog Post Media"); + assertThat(CmsHomeRenderer.plural(2, "Media")).isEqualTo("2 media"); assertThat(CmsHtml.escape(null)).isEmpty(); assertThat(CmsHtml.escape("&\"")).isEqualTo("<a href='x'>&""); }