Files
stpweb/vue/src/stores/coverSnippets.js
T
adamfandClaude Opus 5.5 89aaf8d79e
Test and deploy / test (push) Successful in 2m17s
Test and deploy / deploy (push) Successful in 13m45s
Weekly Maintenance / maintenance (push) Successful in 14m27s
Renovate / renovate (push) Successful in 5m54s
Save cover letters, split them into draggable sections, add a paragraph bank
The /cv Cover Letter tab kept nothing across a refresh and was one flat list
of paragraphs. Letters are now saved as CoverLetter rows (body is the
frontend's JSON, checked only for being an object of sane size), split into
named sections whose paragraphs drag within and between them, with a bank of
reusable CoverSnippet paragraphs beside the page to drag in as copies.
Everything stored is @admin; visitors still get the blank template, and
section titles never print.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 16:03:48 +00:00

30 lines
846 B
JavaScript

/**
* The cover-letter paragraph bank (the `CoverSnippet` GraphQL type): reusable
* paragraphs dragged into a letter as copies — full CRUD, built on
* createCrudStore().
*
* `section` is the title of the section a snippet was written for and only
* groups the bank (views/CV/CoverSnippetBank.vue); editing a snippet never
* changes letters it was already dropped into.
*
* Admin only, like stores/coverLetters.js.
*/
import { createCrudStore } from "@/stores/createCrudStore";
const COVER_SNIPPET_FIELDS = `
id
text
section
createdAt
`;
export const useCoverSnippetsStore = createCrudStore("coverSnippets", {
type: "CoverSnippet",
list: "coverSnippets",
fields: COVER_SNIPPET_FIELDS,
// The bank groups by section itself, so where a new one lands doesn't matter.
insert: "prepend",
deleteReturns: "object",
});