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]>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Saved cover letters (the `CoverLetter` GraphQL type) for the /cv Cover
|
||||
* Letter tab — full CRUD, built on createCrudStore().
|
||||
*
|
||||
* `body` is the whole letter as a JSON string; views/CV/coverLetter.js owns
|
||||
* its shape (parseBody / serialize), the server only checks it is an object.
|
||||
*
|
||||
* Admin only, so nothing fetches it until views/CV/CoverLetters.vue sees an
|
||||
* admin signed in.
|
||||
*/
|
||||
|
||||
import { createCrudStore } from "@/stores/createCrudStore";
|
||||
|
||||
const COVER_LETTER_FIELDS = `
|
||||
id
|
||||
name
|
||||
body
|
||||
updatedAt
|
||||
`;
|
||||
|
||||
export const useCoverLettersStore = createCrudStore("coverLetters", {
|
||||
type: "CoverLetter",
|
||||
list: "coverLetters",
|
||||
fields: COVER_LETTER_FIELDS,
|
||||
// The list query is most recently updated first, so a new letter goes on top.
|
||||
insert: "prepend",
|
||||
deleteReturns: "object",
|
||||
});
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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",
|
||||
});
|
||||
Reference in New Issue
Block a user