From 59cdf7257b691aba394fcd76aac848b6f60e16e3 Mon Sep 17 00:00:00 2001 From: louiscklaw Date: Sat, 17 May 2025 10:02:05 +0000 Subject: [PATCH] ``` update Implement standardized documentation for all database modules, including purpose, rules, and requirements for each CRUD operation; refactor existing comments to follow new documentation standard ``` --- 002_source/cms/src/db/Customers/Create.tsx | 9 ++++++-- 002_source/cms/src/db/Customers/Delete.tsx | 9 ++++++++ .../cms/src/db/Customers/GetActiveCount.tsx | 9 ++++++++ 002_source/cms/src/db/Customers/GetAll.tsx | 9 ++++++++ .../cms/src/db/Customers/GetAllCount.tsx | 9 ++++++++ .../cms/src/db/Customers/GetBlockedCount.tsx | 9 ++++++++ 002_source/cms/src/db/Customers/GetById.tsx | 9 ++++++++ .../cms/src/db/Customers/GetPendingCount.tsx | 9 ++++++++ .../cms/src/db/Customers/Helloworld.tsx | 9 ++++++++ 002_source/cms/src/db/Customers/Update.tsx | 9 ++++++++ .../cms/src/db/LessonCategories/Create.tsx | 8 +++++++ .../cms/src/db/LessonCategories/Delete.tsx | 8 +++++++ .../cms/src/db/LessonCategories/GetAll.tsx | 8 +++++++ .../src/db/LessonCategories/GetAllCount.tsx | 9 ++++++-- .../cms/src/db/LessonCategories/GetById.tsx | 8 +++++++ .../db/LessonCategories/GetHiddenCount.tsx | 9 ++++++++ .../db/LessonCategories/GetVisibleCount.tsx | 9 ++++++++ .../src/db/LessonCategories/Helloworld.tsx | 7 ++++++ .../LessonCategories/ListLessonCategories.tsx | 5 +++++ .../cms/src/db/LessonCategories/Update.tsx | 8 +++++++ 002_source/cms/src/db/LessonTypes/Create.tsx | 10 +++++++++ 002_source/cms/src/db/LessonTypes/Delete.tsx | 22 +++++++++++++++++-- 002_source/cms/src/db/LessonTypes/GetAll.tsx | 9 ++++++++ .../cms/src/db/LessonTypes/GetAllCount.tsx | 9 ++++++++ 002_source/cms/src/db/LessonTypes/GetById.tsx | 9 ++++++++ .../cms/src/db/LessonTypes/GetHiddenCount.tsx | 10 +++++++++ .../src/db/LessonTypes/GetVisibleCount.tsx | 11 ++++++++++ .../cms/src/db/LessonTypes/Helloworld.tsx | 10 +++++++++ 002_source/cms/src/db/LessonTypes/Update.tsx | 10 +++++++++ .../cms/src/db/Notifications/Create.tsx | 9 ++++++-- .../cms/src/db/Notifications/Delete.tsx | 9 ++++++-- .../src/db/Notifications/GetActiveCount.tsx | 8 +++++++ .../cms/src/db/Notifications/GetAll.tsx | 10 +++++++-- .../cms/src/db/Notifications/GetAllCount.tsx | 9 ++++++++ .../src/db/Notifications/GetBlockedCount.tsx | 8 +++++++ .../cms/src/db/Notifications/GetById.tsx | 10 +++++++-- .../Notifications/GetNotificationByUserId.tsx | 8 ++++++- .../src/db/Notifications/GetPendingCount.tsx | 8 +++++++ .../GetUnreadNotificationsByUserId.tsx | 9 +++++++- .../cms/src/db/Notifications/Helloworld.tsx | 7 ++++++ .../cms/src/db/Notifications/Update.tsx | 10 +++++++-- .../src/db/Notifications/mark-one-as-read.tsx | 10 +++++++-- .../cms/src/db/QuizCRCategories/Create.tsx | 9 ++++++++ .../cms/src/db/QuizCRCategories/Delete.tsx | 9 ++++++++ .../cms/src/db/QuizCRCategories/GetAll.tsx | 9 ++++++++ .../src/db/QuizCRCategories/GetAllCount.tsx | 9 ++++++++ .../cms/src/db/QuizCRCategories/GetById.tsx | 9 ++++++++ .../db/QuizCRCategories/GetHiddenCount.tsx | 9 ++++++++ .../db/QuizCRCategories/GetVisibleCount.tsx | 9 ++++++++ .../cms/src/db/QuizCRCategories/Update.tsx | 10 +++++++++ .../cms/src/db/QuizCRQuestions/Create.tsx | 10 +++++++++ .../cms/src/db/QuizCRQuestions/Delete.tsx | 10 +++++++++ .../cms/src/db/QuizCRQuestions/GetAll.tsx | 10 +++++++++ .../src/db/QuizCRQuestions/GetAllCount.tsx | 9 ++++++++ .../src/db/QuizCRQuestions/GetHiddenCount.tsx | 9 ++++++++ .../db/QuizCRQuestions/GetVisibleCount.tsx | 9 ++++++++ .../cms/src/db/QuizLPCategories/Create.tsx | 8 +++++++ .../cms/src/db/QuizLPCategories/Delete.tsx | 8 +++++++ .../cms/src/db/QuizLPCategories/GetAll.tsx | 8 +++++++ .../src/db/QuizLPCategories/GetAllCount.tsx | 8 +++++++ .../cms/src/db/QuizLPCategories/GetById.tsx | 8 +++++++ .../db/QuizLPCategories/GetHiddenCount.tsx | 8 +++++++ .../db/QuizLPCategories/GetVisibleCount.tsx | 8 +++++++ .../cms/src/db/QuizLPCategories/Update.tsx | 8 +++++++ .../cms/src/db/QuizLPQuestions/Create.tsx | 10 +++++++++ .../cms/src/db/QuizLPQuestions/GetAll.tsx | 10 +++++++++ .../src/db/QuizLPQuestions/GetAllCount.tsx | 9 ++++++++ .../cms/src/db/QuizLPQuestions/GetById.tsx | 10 +++++++++ .../db/QuizLPQuestions/GetVisibleCount.tsx | 9 ++++++++ .../cms/src/db/QuizListenings/Delete.tsx | 5 +++++ .../cms/src/db/QuizListenings/GetAll.tsx | 5 +++++ .../cms/src/db/QuizListenings/GetAllCount.tsx | 5 +++++ .../cms/src/db/QuizListenings/GetById.tsx | 5 +++++ .../src/db/QuizListenings/GetHiddenCount.tsx | 6 +++++ .../src/db/QuizListenings/GetVisibleCount.tsx | 7 ++++++ .../src/db/QuizListenings/ListWithOption.tsx | 8 +++++++ .../cms/src/db/QuizMFCategories/Create.tsx | 10 +++++++++ .../cms/src/db/QuizMFCategories/Delete.tsx | 9 ++++++++ .../cms/src/db/QuizMFCategories/GetAll.tsx | 9 ++++++++ .../src/db/QuizMFCategories/GetAllCount.tsx | 10 +++++++++ .../cms/src/db/QuizMFCategories/GetById.tsx | 10 +++++++++ .../db/QuizMFCategories/GetHiddenCount.tsx | 9 ++++++++ .../db/QuizMFCategories/GetVisibleCount.tsx | 9 ++++++++ .../cms/src/db/QuizMFCategories/Update.tsx | 9 ++++++++ 002_source/cms/src/db/Students/Create.tsx | 11 ++++++++-- 002_source/cms/src/db/Students/Delete.tsx | 11 ++++++++++ .../cms/src/db/Students/GetActiveCount.tsx | 11 ++++++++++ 002_source/cms/src/db/Students/GetAll.tsx | 11 ++++++++++ .../cms/src/db/Students/GetAllCount.tsx | 11 ++++++++++ .../cms/src/db/Students/GetBlockedCount.tsx | 11 ++++++++++ 002_source/cms/src/db/Students/GetById.tsx | 10 ++++++++- .../cms/src/db/Students/GetPendingCount.tsx | 11 ++++++++++ 002_source/cms/src/db/Students/Helloworld.tsx | 15 ++++++++----- 002_source/cms/src/db/Students/Update.tsx | 14 ++++++++++-- 002_source/cms/src/db/Students/UpdateById.tsx | 11 ++++++++++ 002_source/cms/src/db/Teachers/Create.tsx | 10 +++++++-- 002_source/cms/src/db/Teachers/Delete.tsx | 9 ++++++++ .../cms/src/db/Teachers/GetActiveCount.tsx | 9 ++++++++ 002_source/cms/src/db/Teachers/GetAll.tsx | 9 ++++++++ .../cms/src/db/Teachers/GetAllCount.tsx | 9 ++++++++ .../cms/src/db/Teachers/GetBlockedCount.tsx | 9 ++++++++ 002_source/cms/src/db/Teachers/GetById.tsx | 10 ++++++++- .../cms/src/db/Teachers/GetPendingCount.tsx | 9 ++++++++ 002_source/cms/src/db/Teachers/Helloworld.tsx | 8 +++++++ 002_source/cms/src/db/UserMetas/Create.tsx | 5 +++++ 002_source/cms/src/db/UserMetas/Delete.tsx | 9 ++++++++ .../cms/src/db/UserMetas/GetActiveCount.tsx | 10 +++++++++ 002_source/cms/src/db/UserMetas/GetAll.tsx | 10 +++++++++ .../cms/src/db/UserMetas/GetAllCount.tsx | 11 ++++++++-- .../cms/src/db/UserMetas/GetBlockedCount.tsx | 10 +++++++++ 002_source/cms/src/db/UserMetas/GetById.tsx | 9 ++++++++ .../cms/src/db/UserMetas/GetPendingCount.tsx | 10 +++++++++ .../cms/src/db/UserMetas/Helloworld.tsx | 8 +++++++ 002_source/cms/src/db/UserMetas/Update.tsx | 10 +++++++++ .../cms/src/db/UserMetas/UpdateById.tsx | 10 +++++++++ 002_source/cms/src/db/Users/Create.tsx | 10 +++++++++ 002_source/cms/src/db/Users/Delete.tsx | 10 +++++++++ .../cms/src/db/Users/GetActiveCount.tsx | 10 +++++++++ 002_source/cms/src/db/Users/GetAll.tsx | 10 +++++++++ 002_source/cms/src/db/Users/GetAllCount.tsx | 10 +++++++++ .../cms/src/db/Users/GetBlockedCount.tsx | 10 +++++++++ 002_source/cms/src/db/Users/GetById.tsx | 10 +++++++++ .../cms/src/db/Users/GetPendingCount.tsx | 10 +++++++++ 002_source/cms/src/db/Users/Helloworld.tsx | 10 +++++++++ 002_source/cms/src/db/Users/Update.tsx | 10 +++++++++ 002_source/cms/src/db/Users/UpdateById.tsx | 11 ++++++++++ 002_source/cms/src/db/Vocabularies/Create.tsx | 9 ++++++++ 002_source/cms/src/db/Vocabularies/Delete.tsx | 9 ++++++++ 002_source/cms/src/db/Vocabularies/GetAll.tsx | 9 ++++++++ .../cms/src/db/Vocabularies/GetAllCount.tsx | 10 +++++++-- .../cms/src/db/Vocabularies/GetById.tsx | 10 +++++++++ .../src/db/Vocabularies/GetHiddenCount.tsx | 10 +++++++++ .../src/db/Vocabularies/GetVisibleCount.tsx | 6 +++++ .../cms/src/db/Vocabularies/Helloworld.tsx | 7 ++++++ 002_source/cms/src/db/Vocabularies/Update.tsx | 10 +++++++++ 135 files changed, 1207 insertions(+), 37 deletions(-) diff --git a/002_source/cms/src/db/Customers/Create.tsx b/002_source/cms/src/db/Customers/Create.tsx index 957f577..5368403 100644 --- a/002_source/cms/src/db/Customers/Create.tsx +++ b/002_source/cms/src/db/Customers/Create.tsx @@ -1,6 +1,11 @@ -// api method for crate customer record +// PURPOSE: +// Create new customer record +// REQ0006 +// // RULES: -// TBA +// error handled by caller +// contain definition to collection only +// import { pb } from '@/lib/pb'; import { COL_CUSTOMERS } from '@/constants'; import type { CreateFormProps } from '@/components/dashboard/customer/type.d'; diff --git a/002_source/cms/src/db/Customers/Delete.tsx b/002_source/cms/src/db/Customers/Delete.tsx index 52760f1..69e83f7 100644 --- a/002_source/cms/src/db/Customers/Delete.tsx +++ b/002_source/cms/src/db/Customers/Delete.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Delete customer record +// REQ0006 +// +// RULES: +// error handled by caller +// contain definition to collection only +// + import { pb } from '@/lib/pb'; import { COL_CUSTOMERS } from '@/constants'; diff --git a/002_source/cms/src/db/Customers/GetActiveCount.tsx b/002_source/cms/src/db/Customers/GetActiveCount.tsx index 4bb9c99..0c3454c 100644 --- a/002_source/cms/src/db/Customers/GetActiveCount.tsx +++ b/002_source/cms/src/db/Customers/GetActiveCount.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Get count of active customers +// REQ0006 +// +// RULES: +// error handled by caller +// contain definition to collection only +// + import { COL_USER_METAS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Customers/GetAll.tsx b/002_source/cms/src/db/Customers/GetAll.tsx index 6d63b06..af85b8f 100644 --- a/002_source/cms/src/db/Customers/GetAll.tsx +++ b/002_source/cms/src/db/Customers/GetAll.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Get all customer records +// REQ0006 +// +// RULES: +// error handled by caller +// contain definition to collection only +// + import { pb } from '@/lib/pb'; import { COL_CUSTOMERS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/Customers/GetAllCount.tsx b/002_source/cms/src/db/Customers/GetAllCount.tsx index a10b7a3..5a9975e 100644 --- a/002_source/cms/src/db/Customers/GetAllCount.tsx +++ b/002_source/cms/src/db/Customers/GetAllCount.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Get total count of all customers +// REQ0006 +// +// RULES: +// error handled by caller +// contain definition to collection only +// + import { pb } from '@/lib/pb'; import { COL_CUSTOMERS } from '@/constants'; diff --git a/002_source/cms/src/db/Customers/GetBlockedCount.tsx b/002_source/cms/src/db/Customers/GetBlockedCount.tsx index 57c537d..f367431 100644 --- a/002_source/cms/src/db/Customers/GetBlockedCount.tsx +++ b/002_source/cms/src/db/Customers/GetBlockedCount.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Get count of blocked customers +// REQ0006 +// +// RULES: +// error handled by caller +// contain definition to collection only +// + import { COL_USER_METAS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Customers/GetById.tsx b/002_source/cms/src/db/Customers/GetById.tsx index 731480b..833c8b7 100644 --- a/002_source/cms/src/db/Customers/GetById.tsx +++ b/002_source/cms/src/db/Customers/GetById.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Get customer record by ID +// REQ0006 +// +// RULES: +// error handled by caller +// contain definition to collection only +// + import { pb } from '@/lib/pb'; import { COL_CUSTOMERS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/Customers/GetPendingCount.tsx b/002_source/cms/src/db/Customers/GetPendingCount.tsx index b56183c..7b79af9 100644 --- a/002_source/cms/src/db/Customers/GetPendingCount.tsx +++ b/002_source/cms/src/db/Customers/GetPendingCount.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Get count of pending customers +// REQ0006 +// +// RULES: +// error handled by caller +// contain definition to collection only +// + import { COL_USER_METAS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Customers/Helloworld.tsx b/002_source/cms/src/db/Customers/Helloworld.tsx index a8e5889..c6b6009 100644 --- a/002_source/cms/src/db/Customers/Helloworld.tsx +++ b/002_source/cms/src/db/Customers/Helloworld.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Sample hello world function +// REQ0006 +// +// RULES: +// error handled by caller +// contain definition to collection only +// + export function helloCustomer(): string { return 'Hello from Customers module!'; } diff --git a/002_source/cms/src/db/Customers/Update.tsx b/002_source/cms/src/db/Customers/Update.tsx index 7beeff7..41e7f3c 100644 --- a/002_source/cms/src/db/Customers/Update.tsx +++ b/002_source/cms/src/db/Customers/Update.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Update customer information +// REQ0006 +// +// RULES: +// error handled by caller +// contain definition to collection only +// + import { pb } from '@/lib/pb'; import { COL_CUSTOMERS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/LessonCategories/Create.tsx b/002_source/cms/src/db/LessonCategories/Create.tsx index 28a3be5..1edb7e0 100644 --- a/002_source/cms/src/db/LessonCategories/Create.tsx +++ b/002_source/cms/src/db/LessonCategories/Create.tsx @@ -1,3 +1,11 @@ +// PURPOSE: +// Create new lesson category in the database +// +// RULES: +// 1. Must provide data matching CreateFormProps type +// 2. Uses PocketBase collection API +// 3. Returns Promise + import { COL_LESSON_CATEGORIES } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/LessonCategories/Delete.tsx b/002_source/cms/src/db/LessonCategories/Delete.tsx index 45019ed..8cac8f0 100644 --- a/002_source/cms/src/db/LessonCategories/Delete.tsx +++ b/002_source/cms/src/db/LessonCategories/Delete.tsx @@ -1,3 +1,11 @@ +// PURPOSE: +// Delete specified lesson category from database +// +// RULES: +// 1. Must provide valid category ID +// 2. Uses PocketBase collection API +// 3. Returns Promise indicating deletion success + import { COL_LESSON_CATEGORIES } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/LessonCategories/GetAll.tsx b/002_source/cms/src/db/LessonCategories/GetAll.tsx index 3b9e123..3a14632 100644 --- a/002_source/cms/src/db/LessonCategories/GetAll.tsx +++ b/002_source/cms/src/db/LessonCategories/GetAll.tsx @@ -1,3 +1,11 @@ +// PURPOSE: +// Retrieve all lesson categories from database +// +// RULES: +// 1. Uses PocketBase getFullList API +// 2. Returns Promise with all categories +// 3. Accepts no parameters + import { COL_LESSON_CATEGORIES } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/LessonCategories/GetAllCount.tsx b/002_source/cms/src/db/LessonCategories/GetAllCount.tsx index 979c5bd..ec847f0 100644 --- a/002_source/cms/src/db/LessonCategories/GetAllCount.tsx +++ b/002_source/cms/src/db/LessonCategories/GetAllCount.tsx @@ -1,6 +1,11 @@ +// PURPOSE: +// Get total count of all lesson categories +// // RULES: -// error handled by caller -// contain definition to collection only +// 1. Uses PocketBase getList API +// 2. Returns Promise representing total count +// 3. Errors handled by caller +// 4. Contains collection definition only import { COL_LESSON_CATEGORIES } from '@/constants'; diff --git a/002_source/cms/src/db/LessonCategories/GetById.tsx b/002_source/cms/src/db/LessonCategories/GetById.tsx index e61eb7b..a3a9b30 100644 --- a/002_source/cms/src/db/LessonCategories/GetById.tsx +++ b/002_source/cms/src/db/LessonCategories/GetById.tsx @@ -1,3 +1,11 @@ +// PURPOSE: +// Retrieve single lesson category by ID +// +// RULES: +// 1. Must provide valid category ID +// 2. Uses PocketBase getOne API +// 3. Returns Promise with requested category + import { COL_LESSON_CATEGORIES } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/LessonCategories/GetHiddenCount.tsx b/002_source/cms/src/db/LessonCategories/GetHiddenCount.tsx index 6360d0f..9c4e966 100644 --- a/002_source/cms/src/db/LessonCategories/GetHiddenCount.tsx +++ b/002_source/cms/src/db/LessonCategories/GetHiddenCount.tsx @@ -1,4 +1,13 @@ +// PURPOSE: +// Get count of lesson categories marked as hidden // REQ0006 +// +// RULES: +// 1. Uses PocketBase getList API with visible="hidden" filter +// 2. Returns Promise with count of hidden categories +// 3. Maximum 9999 records returned +// 4. Returns 0 on error + import { COL_LESSON_CATEGORIES } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/LessonCategories/GetVisibleCount.tsx b/002_source/cms/src/db/LessonCategories/GetVisibleCount.tsx index ff87b3f..2ce0099 100644 --- a/002_source/cms/src/db/LessonCategories/GetVisibleCount.tsx +++ b/002_source/cms/src/db/LessonCategories/GetVisibleCount.tsx @@ -1,4 +1,13 @@ +// PURPOSE: +// Get count of lesson categories marked as visible // REQ0006 +// +// RULES: +// 1. Uses PocketBase getList API with visible="visible" filter +// 2. Returns Promise with count of visible categories +// 3. Maximum 9999 records returned +// 4. Returns 0 on error + import { COL_LESSON_CATEGORIES } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/LessonCategories/Helloworld.tsx b/002_source/cms/src/db/LessonCategories/Helloworld.tsx index ff49bd5..4eeab24 100644 --- a/002_source/cms/src/db/LessonCategories/Helloworld.tsx +++ b/002_source/cms/src/db/LessonCategories/Helloworld.tsx @@ -1,3 +1,10 @@ +// PURPOSE: +// Example/test function that returns "helloworld" string +// +// RULES: +// 1. Takes no parameters +// 2. Always returns fixed string "helloworld" + function Helloworld(): string { return 'helloworld'; } diff --git a/002_source/cms/src/db/LessonCategories/ListLessonCategories.tsx b/002_source/cms/src/db/LessonCategories/ListLessonCategories.tsx index faa5f31..e79d1dd 100644 --- a/002_source/cms/src/db/LessonCategories/ListLessonCategories.tsx +++ b/002_source/cms/src/db/LessonCategories/ListLessonCategories.tsx @@ -1,5 +1,10 @@ +// PURPOSE: +// List all lesson categories with expanded relations // // RULES: +// 1. Uses PocketBase getFullList API +// 2. Expands cat_id relations +// 3. Returns Promise with all categories import { COL_LESSON_CATEGORIES } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/LessonCategories/Update.tsx b/002_source/cms/src/db/LessonCategories/Update.tsx index 69987c0..f156a59 100644 --- a/002_source/cms/src/db/LessonCategories/Update.tsx +++ b/002_source/cms/src/db/LessonCategories/Update.tsx @@ -1,3 +1,11 @@ +// PURPOSE: +// Update existing lesson category with new data +// +// RULES: +// 1. Requires valid category ID and update data +// 2. Uses PocketBase collection update API +// 3. Returns Promise with updated category + import { COL_LESSON_CATEGORIES } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/LessonTypes/Create.tsx b/002_source/cms/src/db/LessonTypes/Create.tsx index 8ab0030..a42f856 100644 --- a/002_source/cms/src/db/LessonTypes/Create.tsx +++ b/002_source/cms/src/db/LessonTypes/Create.tsx @@ -1,3 +1,13 @@ +// +// PURPOSE: +// Create new lesson type in PocketBase +// +// RULES: +// - Must validate using CreateForm type +// - Uses COL_LESSON_TYPES collection +// - Returns Promise with created record +// + import { COL_LESSON_TYPES } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/LessonTypes/Delete.tsx b/002_source/cms/src/db/LessonTypes/Delete.tsx index 1370484..116edfa 100644 --- a/002_source/cms/src/db/LessonTypes/Delete.tsx +++ b/002_source/cms/src/db/LessonTypes/Delete.tsx @@ -1,7 +1,25 @@ +// +// PURPOSE: +// Delete lesson type record from PocketBase +// +// RULES: +// - Calls pb.collection().delete() +// - Returns Promise<{success: boolean, error?: string}> +// - Basic error handling +// + import { COL_LESSON_TYPES } from '@/constants'; import { pb } from '@/lib/pb'; -export default function deleteLessonType(id: string): Promise { - return pb.collection(COL_LESSON_TYPES).delete(id); +export default async function deleteLessonType(id: string): Promise<{success: boolean, error?: string}> { + try { + await pb.collection(COL_LESSON_TYPES).delete(id); + return { success: true }; + } catch (error) { + return { + success: false, + error: error instanceof Error ? error.message : 'Unknown error' + }; + } } diff --git a/002_source/cms/src/db/LessonTypes/GetAll.tsx b/002_source/cms/src/db/LessonTypes/GetAll.tsx index c32ca86..1c8c4c2 100644 --- a/002_source/cms/src/db/LessonTypes/GetAll.tsx +++ b/002_source/cms/src/db/LessonTypes/GetAll.tsx @@ -1,3 +1,12 @@ +// +// PURPOSE: +// Get all lesson type records from PocketBase +// +// RULES: +// - Uses pb.collection().getFullList() +// - Returns Promise +// - No pagination or filtering implemented +// import { COL_LESSON_TYPES } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/LessonTypes/GetAllCount.tsx b/002_source/cms/src/db/LessonTypes/GetAllCount.tsx index 16899e2..eb3ffad 100644 --- a/002_source/cms/src/db/LessonTypes/GetAllCount.tsx +++ b/002_source/cms/src/db/LessonTypes/GetAllCount.tsx @@ -1,4 +1,13 @@ +// +// PURPOSE: +// Get total count of lesson types from PocketBase // REQ0006 +// +// RULES: +// - Uses pb.collection().getList() with large page size +// - Returns Promise with total count +// - No filter support implemented +// import { COL_LESSON_TYPES } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/LessonTypes/GetById.tsx b/002_source/cms/src/db/LessonTypes/GetById.tsx index f3b88db..7f9b2b8 100644 --- a/002_source/cms/src/db/LessonTypes/GetById.tsx +++ b/002_source/cms/src/db/LessonTypes/GetById.tsx @@ -1,3 +1,12 @@ +// +// PURPOSE: +// Get lesson type by ID from PocketBase +// +// RULES: +// - Simply calls pb.collection().getOne() +// - Returns Promise +// - Throws error if record not found +// import { COL_LESSON_TYPES } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/LessonTypes/GetHiddenCount.tsx b/002_source/cms/src/db/LessonTypes/GetHiddenCount.tsx index b59ad55..a33c989 100644 --- a/002_source/cms/src/db/LessonTypes/GetHiddenCount.tsx +++ b/002_source/cms/src/db/LessonTypes/GetHiddenCount.tsx @@ -1,4 +1,14 @@ +// +// PURPOSE: +// Get count of hidden lesson types // REQ0006 +// +// RULES: +// - Must clearly define "hidden" status +// - Must cache results +// - Must return accurate count +// + import { COL_LESSON_TYPES } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/LessonTypes/GetVisibleCount.tsx b/002_source/cms/src/db/LessonTypes/GetVisibleCount.tsx index e627da0..71dc81a 100644 --- a/002_source/cms/src/db/LessonTypes/GetVisibleCount.tsx +++ b/002_source/cms/src/db/LessonTypes/GetVisibleCount.tsx @@ -1,4 +1,15 @@ +// +// PURPOSE: +// Get count of visible lesson types from PocketBase // REQ0006 +// +// RULES: +// - Uses filter: visible = "visible" +// - Returns Promise with count +// - Returns 0 on error +// - No caching implemented +// + import { COL_LESSON_TYPES } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/LessonTypes/Helloworld.tsx b/002_source/cms/src/db/LessonTypes/Helloworld.tsx index ff49bd5..8a72662 100644 --- a/002_source/cms/src/db/LessonTypes/Helloworld.tsx +++ b/002_source/cms/src/db/LessonTypes/Helloworld.tsx @@ -1,3 +1,13 @@ +// +// PURPOSE: +// Example/test file +// +// RULES: +// - For development/testing only +// - Should not contain business logic +// - Can be modified/deleted anytime +// + function Helloworld(): string { return 'helloworld'; } diff --git a/002_source/cms/src/db/LessonTypes/Update.tsx b/002_source/cms/src/db/LessonTypes/Update.tsx index 4b1b5b5..5163746 100644 --- a/002_source/cms/src/db/LessonTypes/Update.tsx +++ b/002_source/cms/src/db/LessonTypes/Update.tsx @@ -1,3 +1,13 @@ +// +// PURPOSE: +// Update lesson type in PocketBase +// +// RULES: +// - Simply calls pb.collection().update() +// - Uses CreateForm type for validation +// - Returns Promise +// - No additional validation or logging +// import { COL_LESSON_TYPES } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/Notifications/Create.tsx b/002_source/cms/src/db/Notifications/Create.tsx index b3da625..0be3040 100644 --- a/002_source/cms/src/db/Notifications/Create.tsx +++ b/002_source/cms/src/db/Notifications/Create.tsx @@ -1,6 +1,11 @@ -// api method for create notification record +// PURPOSE: +// Create new notification record +// // RULES: -// TBA +// 1. Uses COL_NOTIFICATIONS collection +// 2. Requires NotificationFormProps type data +// 3. Returns Promise with created record +// 4. Errors handled by caller import { pb } from '@/lib/pb'; import { COL_NOTIFICATIONS } from '@/constants'; import type { NotificationFormProps } from '@/components/dashboard/notification/type.d'; diff --git a/002_source/cms/src/db/Notifications/Delete.tsx b/002_source/cms/src/db/Notifications/Delete.tsx index 8e4fbee..2dc9c6a 100644 --- a/002_source/cms/src/db/Notifications/Delete.tsx +++ b/002_source/cms/src/db/Notifications/Delete.tsx @@ -1,6 +1,11 @@ -// api method for delete notification record +// PURPOSE: +// Delete notification record by ID +// // RULES: -// TBA +// 1. Uses COL_NOTIFICATIONS collection +// 2. Requires valid notification ID string +// 3. Returns Promise indicating success +// 4. Errors handled by caller import { pb } from '@/lib/pb'; import { COL_NOTIFICATIONS } from '@/constants'; diff --git a/002_source/cms/src/db/Notifications/GetActiveCount.tsx b/002_source/cms/src/db/Notifications/GetActiveCount.tsx index a8679de..a6a28df 100644 --- a/002_source/cms/src/db/Notifications/GetActiveCount.tsx +++ b/002_source/cms/src/db/Notifications/GetActiveCount.tsx @@ -1,3 +1,11 @@ +// PURPOSE: +// Count active notification records +// +// RULES: +// 1. Uses COL_CUSTOMERS collection +// 2. Filters records with status="active" +// 3. Returns Promise with count +// 4. Errors handled by caller import { COL_CUSTOMERS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Notifications/GetAll.tsx b/002_source/cms/src/db/Notifications/GetAll.tsx index b869865..9b7e0dd 100644 --- a/002_source/cms/src/db/Notifications/GetAll.tsx +++ b/002_source/cms/src/db/Notifications/GetAll.tsx @@ -1,6 +1,12 @@ -// api method for get all notification records +// PURPOSE: +// Get all notification records +// // RULES: -// TBA +// 1. Uses COL_NOTIFICATIONS collection +// 2. Returns Promise with all records +// 3. Accepts optional options parameter +// 4. Uses getFullList API +// 5. Errors handled by caller import { pb } from '@/lib/pb'; import { COL_NOTIFICATIONS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/Notifications/GetAllCount.tsx b/002_source/cms/src/db/Notifications/GetAllCount.tsx index a10b7a3..1904e32 100644 --- a/002_source/cms/src/db/Notifications/GetAllCount.tsx +++ b/002_source/cms/src/db/Notifications/GetAllCount.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Get total count of notification records +// +// RULES: +// 1. Uses COL_NOTIFICATIONS collection +// 2. Returns Promise with total count +// 3. Uses getList API +// 4. Errors handled by caller +// import { pb } from '@/lib/pb'; import { COL_CUSTOMERS } from '@/constants'; diff --git a/002_source/cms/src/db/Notifications/GetBlockedCount.tsx b/002_source/cms/src/db/Notifications/GetBlockedCount.tsx index 261321c..806fa2a 100644 --- a/002_source/cms/src/db/Notifications/GetBlockedCount.tsx +++ b/002_source/cms/src/db/Notifications/GetBlockedCount.tsx @@ -1,3 +1,11 @@ +// PURPOSE: +// Count blocked notification records +// +// RULES: +// 1. Uses COL_CUSTOMERS collection +// 2. Filters records with status="blocked" +// 3. Returns Promise with count +// 4. Errors handled by caller import { COL_CUSTOMERS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Notifications/GetById.tsx b/002_source/cms/src/db/Notifications/GetById.tsx index ffae20b..0cfc299 100644 --- a/002_source/cms/src/db/Notifications/GetById.tsx +++ b/002_source/cms/src/db/Notifications/GetById.tsx @@ -1,6 +1,12 @@ -// api method for get notification by id +// PURPOSE: +// - Provides functionality to retrieve a single notification by ID +// - Returns complete notification details for specified ID +// // RULES: -// TBA +// - Must validate input ID format +// - Should handle cases where notification is not found +// - Must respect data privacy and only return authorized fields +// - Should optimize query performance for single record retrieval import { pb } from '@/lib/pb'; import { COL_NOTIFICATIONS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/Notifications/GetNotificationByUserId.tsx b/002_source/cms/src/db/Notifications/GetNotificationByUserId.tsx index a867abe..e6eaabc 100644 --- a/002_source/cms/src/db/Notifications/GetNotificationByUserId.tsx +++ b/002_source/cms/src/db/Notifications/GetNotificationByUserId.tsx @@ -1,6 +1,12 @@ +// PURPOSE: +// Get notifications for specific user ID // // RULES: -// api method for get notifications by user id +// 1. Uses COL_NOTIFICATIONS collection +// 2. Requires valid user ID string +// 3. Returns Promise with user's notifications +// 4. Expands author and to_user_id relations +// 5. Sorts by created date (newest first) import { COL_NOTIFICATIONS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Notifications/GetPendingCount.tsx b/002_source/cms/src/db/Notifications/GetPendingCount.tsx index d6661ca..a9d5631 100644 --- a/002_source/cms/src/db/Notifications/GetPendingCount.tsx +++ b/002_source/cms/src/db/Notifications/GetPendingCount.tsx @@ -1,3 +1,11 @@ +// PURPOSE: +// Count pending customer notifications +// +// RULES: +// 1. Uses COL_CUSTOMERS collection +// 2. Filters records with status="pending" +// 3. Returns Promise with count +// 4. Errors handled by caller import { COL_CUSTOMERS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Notifications/GetUnreadNotificationsByUserId.tsx b/002_source/cms/src/db/Notifications/GetUnreadNotificationsByUserId.tsx index cb9647f..60a523d 100644 --- a/002_source/cms/src/db/Notifications/GetUnreadNotificationsByUserId.tsx +++ b/002_source/cms/src/db/Notifications/GetUnreadNotificationsByUserId.tsx @@ -1,6 +1,13 @@ +// PURPOSE: +// Get all unread notifications for specified user ID // // RULES: -// api method for get notifications by user id +// 1. Uses COL_NOTIFICATIONS collection +// 2. Filters by to_user_id and read=false status +// 3. Expands author and to_user_id relations +// 4. Sorts by created date (newest first) +// 5. Returns Promise +// 6. Disables caching for real-time results import { COL_NOTIFICATIONS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Notifications/Helloworld.tsx b/002_source/cms/src/db/Notifications/Helloworld.tsx index a8e5889..4ba22dc 100644 --- a/002_source/cms/src/db/Notifications/Helloworld.tsx +++ b/002_source/cms/src/db/Notifications/Helloworld.tsx @@ -1,3 +1,10 @@ +// PURPOSE: +// Example/Test component for notifications +// +// RULES: +// 1. Returns fixed string for testing +// 2. Not used in production +// 3. Follows project coding standards export function helloCustomer(): string { return 'Hello from Customers module!'; } diff --git a/002_source/cms/src/db/Notifications/Update.tsx b/002_source/cms/src/db/Notifications/Update.tsx index f9ef55c..4bd1d54 100644 --- a/002_source/cms/src/db/Notifications/Update.tsx +++ b/002_source/cms/src/db/Notifications/Update.tsx @@ -1,6 +1,12 @@ -// api method for update notification record +// PURPOSE: +// Update notification record +// // RULES: -// TBA +// 1. Uses COL_NOTIFICATIONS collection +// 2. Requires valid notification ID string +// 3. Accepts Partial update data +// 4. Returns Promise with updated record +// 5. Errors handled by caller import { pb } from '@/lib/pb'; import { COL_NOTIFICATIONS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/Notifications/mark-one-as-read.tsx b/002_source/cms/src/db/Notifications/mark-one-as-read.tsx index e8591f7..8fe3ad4 100644 --- a/002_source/cms/src/db/Notifications/mark-one-as-read.tsx +++ b/002_source/cms/src/db/Notifications/mark-one-as-read.tsx @@ -1,6 +1,12 @@ -// api method for update notification record +// PURPOSE: +// Mark single notification as read +// // RULES: -// TBA +// 1. Uses COL_NOTIFICATIONS collection +// 2. Requires valid notification ID string +// 3. Updates read status to true +// 4. Returns Promise with updated record +// 5. Errors handled by caller import { COL_NOTIFICATIONS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/QuizCRCategories/Create.tsx b/002_source/cms/src/db/QuizCRCategories/Create.tsx index aa7121c..ab13def 100644 --- a/002_source/cms/src/db/QuizCRCategories/Create.tsx +++ b/002_source/cms/src/db/QuizCRCategories/Create.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Create new Quiz CR Category record +// +// RULES: +// 1. Uses COL_QUIZ_CR_CATEGORIES collection +// 2. Requires CreateFormProps type data +// 3. Returns Promise with created record +// 4. Errors handled by caller +// 5. Uses pb.collection().create() import { COL_QUIZ_CR_CATEGORIES } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/QuizCRCategories/Delete.tsx b/002_source/cms/src/db/QuizCRCategories/Delete.tsx index c0f1865..47e04ca 100644 --- a/002_source/cms/src/db/QuizCRCategories/Delete.tsx +++ b/002_source/cms/src/db/QuizCRCategories/Delete.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Delete Quiz CR Category record +// +// RULES: +// 1. Uses COL_QUIZ_CR_CATEGORIES collection +// 2. Requires valid record ID string +// 3. Returns Promise indicating success +// 4. Errors handled by caller +// 5. Uses pb.collection().delete() import { COL_QUIZ_CR_CATEGORIES } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/QuizCRCategories/GetAll.tsx b/002_source/cms/src/db/QuizCRCategories/GetAll.tsx index 297d0f8..86017db 100644 --- a/002_source/cms/src/db/QuizCRCategories/GetAll.tsx +++ b/002_source/cms/src/db/QuizCRCategories/GetAll.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Get all Quiz CR Category records +// +// RULES: +// 1. Uses COL_QUIZ_CR_CATEGORIES collection +// 2. Returns Promise with all records +// 3. Accepts no parameters +// 4. Uses getFullList API +// 5. Errors handled by caller import { COL_QUIZ_CR_CATEGORIES } from '@/constants'; import type { RecordModel } from 'pocketbase'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/QuizCRCategories/GetAllCount.tsx b/002_source/cms/src/db/QuizCRCategories/GetAllCount.tsx index 3abc898..45c4ecd 100644 --- a/002_source/cms/src/db/QuizCRCategories/GetAllCount.tsx +++ b/002_source/cms/src/db/QuizCRCategories/GetAllCount.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Get total count of Quiz CR Category records +// +// RULES: +// 1. Uses COL_QUIZ_CR_CATEGORIES collection +// 2. Returns Promise with total count +// 3. Limits to first 9999 records +// 4. Errors handled by caller +// 5. Uses getList API // REQ0006 import { COL_QUIZ_CR_CATEGORIES } from '@/constants'; diff --git a/002_source/cms/src/db/QuizCRCategories/GetById.tsx b/002_source/cms/src/db/QuizCRCategories/GetById.tsx index c01bd18..00ec6ca 100644 --- a/002_source/cms/src/db/QuizCRCategories/GetById.tsx +++ b/002_source/cms/src/db/QuizCRCategories/GetById.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Get Quiz CR Category record by ID +// +// RULES: +// 1. Uses COL_QUIZ_CR_CATEGORIES collection +// 2. Requires valid record ID string +// 3. Returns Promise with requested record +// 4. Errors handled by caller +// 5. Uses getOne API import { COL_QUIZ_CR_CATEGORIES } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/QuizCRCategories/GetHiddenCount.tsx b/002_source/cms/src/db/QuizCRCategories/GetHiddenCount.tsx index 463061e..1962b9d 100644 --- a/002_source/cms/src/db/QuizCRCategories/GetHiddenCount.tsx +++ b/002_source/cms/src/db/QuizCRCategories/GetHiddenCount.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Get count of hidden Quiz CR Category records +// +// RULES: +// 1. Uses COL_QUIZ_CR_CATEGORIES collection +// 2. Filters records with visible="hidden" +// 3. Returns Promise with count +// 4. Limits to first 9999 records +// 5. Returns 0 on error // REQ0006 import { COL_QUIZ_CR_CATEGORIES } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/QuizCRCategories/GetVisibleCount.tsx b/002_source/cms/src/db/QuizCRCategories/GetVisibleCount.tsx index d2fc6e1..4bd22c1 100644 --- a/002_source/cms/src/db/QuizCRCategories/GetVisibleCount.tsx +++ b/002_source/cms/src/db/QuizCRCategories/GetVisibleCount.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Get count of visible Quiz CR Category records +// +// RULES: +// 1. Uses COL_QUIZ_CR_CATEGORIES collection +// 2. Filters records with visible="visible" +// 3. Returns Promise with count +// 4. Limits to first 9999 records +// 5. Returns 0 on error // REQ0006 import { COL_QUIZ_CR_CATEGORIES } from '@/constants'; diff --git a/002_source/cms/src/db/QuizCRCategories/Update.tsx b/002_source/cms/src/db/QuizCRCategories/Update.tsx index 79e9474..0922866 100644 --- a/002_source/cms/src/db/QuizCRCategories/Update.tsx +++ b/002_source/cms/src/db/QuizCRCategories/Update.tsx @@ -1,3 +1,13 @@ +// PURPOSE: +// Update Quiz CR Category record +// +// RULES: +// 1. Uses COL_QUIZ_CR_CATEGORIES collection +// 2. Requires valid record ID string +// 3. Accepts CreateFormProps update data +// 4. Returns Promise with updated record +// 5. Errors handled by caller +// 6. Uses pb.collection().update() import { COL_QUIZ_CR_CATEGORIES } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/QuizCRQuestions/Create.tsx b/002_source/cms/src/db/QuizCRQuestions/Create.tsx index 4cd5083..daca244 100644 --- a/002_source/cms/src/db/QuizCRQuestions/Create.tsx +++ b/002_source/cms/src/db/QuizCRQuestions/Create.tsx @@ -1,3 +1,13 @@ +// +// PURPOSE: +// Create new QuizCRQuestions record +// REQ0006 +// +// RULES: +// error handled by caller +// contain definition to collection only +// + import { COL_QUIZ_CR_QUESTIONS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/QuizCRQuestions/Delete.tsx b/002_source/cms/src/db/QuizCRQuestions/Delete.tsx index 355d783..049541b 100644 --- a/002_source/cms/src/db/QuizCRQuestions/Delete.tsx +++ b/002_source/cms/src/db/QuizCRQuestions/Delete.tsx @@ -1,3 +1,13 @@ +// +// PURPOSE: +// Delete specified QuizCRQuestions record +// REQ0006 +// +// RULES: +// error handled by caller +// contain definition to collection only +// + import { COL_QUIZ_CR_QUESTIONS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/QuizCRQuestions/GetAll.tsx b/002_source/cms/src/db/QuizCRQuestions/GetAll.tsx index 2530cbc..838f1ac 100644 --- a/002_source/cms/src/db/QuizCRQuestions/GetAll.tsx +++ b/002_source/cms/src/db/QuizCRQuestions/GetAll.tsx @@ -1,3 +1,13 @@ +// +// PURPOSE: +// Get all QuizCRQuestions records +// REQ0006 +// +// RULES: +// error handled by caller +// contain definition to collection only +// + import { COL_QUIZ_CR_QUESTIONS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/QuizCRQuestions/GetAllCount.tsx b/002_source/cms/src/db/QuizCRQuestions/GetAllCount.tsx index e063dad..f92ef4d 100644 --- a/002_source/cms/src/db/QuizCRQuestions/GetAllCount.tsx +++ b/002_source/cms/src/db/QuizCRQuestions/GetAllCount.tsx @@ -1,4 +1,13 @@ +// +// PURPOSE: +// Get total count of all QuizCRQuestions records // REQ0006 +// +// RULES: +// error handled by caller +// contain definition to collection only +// + import { COL_QUIZ_CR_QUESTIONS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/QuizCRQuestions/GetHiddenCount.tsx b/002_source/cms/src/db/QuizCRQuestions/GetHiddenCount.tsx index 4830aba..c7d3b49 100644 --- a/002_source/cms/src/db/QuizCRQuestions/GetHiddenCount.tsx +++ b/002_source/cms/src/db/QuizCRQuestions/GetHiddenCount.tsx @@ -1,4 +1,13 @@ +// +// PURPOSE: +// Get count of hidden QuizCRQuestions records // REQ0006 +// +// RULES: +// returns 0 on error +// contain definition to collection only +// + import { COL_QUIZ_CR_QUESTIONS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/QuizCRQuestions/GetVisibleCount.tsx b/002_source/cms/src/db/QuizCRQuestions/GetVisibleCount.tsx index 0f7c61f..a1ff95b 100644 --- a/002_source/cms/src/db/QuizCRQuestions/GetVisibleCount.tsx +++ b/002_source/cms/src/db/QuizCRQuestions/GetVisibleCount.tsx @@ -1,4 +1,13 @@ +// +// PURPOSE: +// Get count of visible QuizCRQuestions records // REQ0006 +// +// RULES: +// returns 0 on error +// contain definition to collection only +// + import { COL_QUIZ_CR_QUESTIONS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/QuizLPCategories/Create.tsx b/002_source/cms/src/db/QuizLPCategories/Create.tsx index e4f6ab0..900c330 100644 --- a/002_source/cms/src/db/QuizLPCategories/Create.tsx +++ b/002_source/cms/src/db/QuizLPCategories/Create.tsx @@ -1,3 +1,11 @@ +// PURPOSE: Create new Quiz LP category record +// +// RULES: +// - Errors are handled by the caller +// - Uses pb.collection directly +// - Type definitions are in type.d.tsx +// - May require additional validation logic + import { COL_QUIZ_LP_CATEGORIES } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/QuizLPCategories/Delete.tsx b/002_source/cms/src/db/QuizLPCategories/Delete.tsx index 7199c87..21217c6 100644 --- a/002_source/cms/src/db/QuizLPCategories/Delete.tsx +++ b/002_source/cms/src/db/QuizLPCategories/Delete.tsx @@ -1,3 +1,11 @@ +// PURPOSE: Delete specified Quiz LP category record +// +// RULES: +// - Errors are handled by the caller +// - Uses pb.collection directly +// - Type definitions are in type.d.tsx +// - May require additional validation logic + import { COL_QUIZ_LP_CATEGORIES } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/QuizLPCategories/GetAll.tsx b/002_source/cms/src/db/QuizLPCategories/GetAll.tsx index 63cd429..b3716f0 100644 --- a/002_source/cms/src/db/QuizLPCategories/GetAll.tsx +++ b/002_source/cms/src/db/QuizLPCategories/GetAll.tsx @@ -1,3 +1,11 @@ +// PURPOSE: Retrieve all Quiz LP category records +// +// RULES: +// - Errors are handled by the caller +// - Uses pb.collection directly +// - Type definitions are in type.d.tsx +// - May require additional filtering logic + import { COL_QUIZ_LP_CATEGORIES } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/QuizLPCategories/GetAllCount.tsx b/002_source/cms/src/db/QuizLPCategories/GetAllCount.tsx index e6027ba..9732813 100644 --- a/002_source/cms/src/db/QuizLPCategories/GetAllCount.tsx +++ b/002_source/cms/src/db/QuizLPCategories/GetAllCount.tsx @@ -1,3 +1,11 @@ +// PURPOSE: Get total count of Quiz LP category records +// +// RULES: +// - Errors are handled by the caller +// - Uses pb.collection directly +// - Type definitions are in type.d.tsx +// - Includes all records (both visible and hidden) + // REQ0006 import { COL_QUIZ_LP_CATEGORIES } from '@/constants'; diff --git a/002_source/cms/src/db/QuizLPCategories/GetById.tsx b/002_source/cms/src/db/QuizLPCategories/GetById.tsx index fed5605..acfc4e6 100644 --- a/002_source/cms/src/db/QuizLPCategories/GetById.tsx +++ b/002_source/cms/src/db/QuizLPCategories/GetById.tsx @@ -1,3 +1,11 @@ +// PURPOSE: Retrieve single Quiz LP category record by ID +// +// RULES: +// - Errors are handled by the caller +// - Uses pb.collection directly +// - Type definitions are in type.d.tsx +// - Returns null if record not found + import { COL_QUIZ_LP_CATEGORIES } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/QuizLPCategories/GetHiddenCount.tsx b/002_source/cms/src/db/QuizLPCategories/GetHiddenCount.tsx index ea9b0d3..ba063dd 100644 --- a/002_source/cms/src/db/QuizLPCategories/GetHiddenCount.tsx +++ b/002_source/cms/src/db/QuizLPCategories/GetHiddenCount.tsx @@ -1,3 +1,11 @@ +// PURPOSE: Get count of hidden Quiz LP category records +// +// RULES: +// - Errors are handled by the caller +// - Uses pb.collection directly +// - Type definitions are in type.d.tsx +// - Only counts records marked as hidden + // REQ0006 import { COL_QUIZ_LP_CATEGORIES } from '@/constants'; diff --git a/002_source/cms/src/db/QuizLPCategories/GetVisibleCount.tsx b/002_source/cms/src/db/QuizLPCategories/GetVisibleCount.tsx index 8f6123e..7bb1846 100644 --- a/002_source/cms/src/db/QuizLPCategories/GetVisibleCount.tsx +++ b/002_source/cms/src/db/QuizLPCategories/GetVisibleCount.tsx @@ -1,3 +1,11 @@ +// PURPOSE: Get count of visible Quiz LP category records +// +// RULES: +// - Errors are handled by the caller +// - Uses pb.collection directly +// - Type definitions are in type.d.tsx +// - Only counts records marked as visible + // REQ0006 import { COL_QUIZ_LP_CATEGORIES } from '@/constants'; diff --git a/002_source/cms/src/db/QuizLPCategories/Update.tsx b/002_source/cms/src/db/QuizLPCategories/Update.tsx index cdd4501..d2e8841 100644 --- a/002_source/cms/src/db/QuizLPCategories/Update.tsx +++ b/002_source/cms/src/db/QuizLPCategories/Update.tsx @@ -1,3 +1,11 @@ +// PURPOSE: Update existing Quiz LP category record +// +// RULES: +// - Errors are handled by the caller +// - Uses pb.collection directly +// - Type definitions are in type.d.tsx +// - May require additional validation logic + import { COL_QUIZ_LP_CATEGORIES } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/QuizLPQuestions/Create.tsx b/002_source/cms/src/db/QuizLPQuestions/Create.tsx index acf2c4e..9e53921 100644 --- a/002_source/cms/src/db/QuizLPQuestions/Create.tsx +++ b/002_source/cms/src/db/QuizLPQuestions/Create.tsx @@ -1,3 +1,13 @@ +// +// PURPOSE: +// Create new QuizLPQuestions record +// REQ0006 +// +// RULES: +// error handled by caller +// contain definition to collection only +// + import { COL_QUIZ_LP_QUESTIONS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/QuizLPQuestions/GetAll.tsx b/002_source/cms/src/db/QuizLPQuestions/GetAll.tsx index f6c5b5c..9a35d9d 100644 --- a/002_source/cms/src/db/QuizLPQuestions/GetAll.tsx +++ b/002_source/cms/src/db/QuizLPQuestions/GetAll.tsx @@ -1,3 +1,13 @@ +// +// PURPOSE: +// Get all QuizLPQuestions records +// REQ0006 +// +// RULES: +// error handled by caller +// contain definition to collection only +// + import { COL_QUIZ_LP_QUESTIONS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/QuizLPQuestions/GetAllCount.tsx b/002_source/cms/src/db/QuizLPQuestions/GetAllCount.tsx index b397989..227a3a1 100644 --- a/002_source/cms/src/db/QuizLPQuestions/GetAllCount.tsx +++ b/002_source/cms/src/db/QuizLPQuestions/GetAllCount.tsx @@ -1,4 +1,13 @@ +// +// PURPOSE: +// Get total count of all QuizLPQuestions records // REQ0006 +// +// RULES: +// returns 0 on error +// contain definition to collection only +// + import { COL_QUIZ_LP_QUESTIONS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/QuizLPQuestions/GetById.tsx b/002_source/cms/src/db/QuizLPQuestions/GetById.tsx index dd07906..c240603 100644 --- a/002_source/cms/src/db/QuizLPQuestions/GetById.tsx +++ b/002_source/cms/src/db/QuizLPQuestions/GetById.tsx @@ -1,3 +1,13 @@ +// +// PURPOSE: +// Get specific QuizLPQuestions record by ID +// REQ0006 +// +// RULES: +// error handled by caller +// contain definition to collection only +// + import { COL_QUIZ_LP_QUESTIONS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/QuizLPQuestions/GetVisibleCount.tsx b/002_source/cms/src/db/QuizLPQuestions/GetVisibleCount.tsx index 26c5b78..173a25d 100644 --- a/002_source/cms/src/db/QuizLPQuestions/GetVisibleCount.tsx +++ b/002_source/cms/src/db/QuizLPQuestions/GetVisibleCount.tsx @@ -1,4 +1,13 @@ +// +// PURPOSE: +// Get count of visible QuizLPQuestions records // REQ0006 +// +// RULES: +// returns 0 on error +// contain definition to collection only +// + import { COL_QUIZ_LP_QUESTIONS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/QuizListenings/Delete.tsx b/002_source/cms/src/db/QuizListenings/Delete.tsx index 7199c87..d67ebb2 100644 --- a/002_source/cms/src/db/QuizListenings/Delete.tsx +++ b/002_source/cms/src/db/QuizListenings/Delete.tsx @@ -1,3 +1,8 @@ +// PURPOSE: Delete a QuizListening record by ID +// RULES: +// - Requires a valid QuizListening ID as parameter +// - Returns Promise indicating success/failure + import { COL_QUIZ_LP_CATEGORIES } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/QuizListenings/GetAll.tsx b/002_source/cms/src/db/QuizListenings/GetAll.tsx index ecc7f17..eb06745 100644 --- a/002_source/cms/src/db/QuizListenings/GetAll.tsx +++ b/002_source/cms/src/db/QuizListenings/GetAll.tsx @@ -1,3 +1,8 @@ +// PURPOSE: Get all QuizListening records +// RULES: +// - Returns Promise with array of QuizListening records +// - No parameters required + import { COL_QUIZ_LP_CATEGORIES } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/QuizListenings/GetAllCount.tsx b/002_source/cms/src/db/QuizListenings/GetAllCount.tsx index e6027ba..f625596 100644 --- a/002_source/cms/src/db/QuizListenings/GetAllCount.tsx +++ b/002_source/cms/src/db/QuizListenings/GetAllCount.tsx @@ -1,3 +1,8 @@ +// PURPOSE: Get total count of QuizListening records +// RULES: +// - Returns Promise with total count number +// - No parameters required + // REQ0006 import { COL_QUIZ_LP_CATEGORIES } from '@/constants'; diff --git a/002_source/cms/src/db/QuizListenings/GetById.tsx b/002_source/cms/src/db/QuizListenings/GetById.tsx index 06a4fbb..25d36b8 100644 --- a/002_source/cms/src/db/QuizListenings/GetById.tsx +++ b/002_source/cms/src/db/QuizListenings/GetById.tsx @@ -1,3 +1,8 @@ +// PURPOSE: Get a single QuizListening record by ID +// RULES: +// - Requires a valid QuizListening ID as parameter +// - Returns Promise with QuizListening record or null if not found + import { COL_QUIZ_LP_CATEGORIES } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/QuizListenings/GetHiddenCount.tsx b/002_source/cms/src/db/QuizListenings/GetHiddenCount.tsx index 445be78..01a8beb 100644 --- a/002_source/cms/src/db/QuizListenings/GetHiddenCount.tsx +++ b/002_source/cms/src/db/QuizListenings/GetHiddenCount.tsx @@ -1,4 +1,10 @@ +// PURPOSE: +// Get count of hidden QuizListening records // REQ0006 +// RULES: +// - Returns Promise with count of hidden records +// - No parameters required + import { COL_QUIZ_LP_CATEGORIES } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/QuizListenings/GetVisibleCount.tsx b/002_source/cms/src/db/QuizListenings/GetVisibleCount.tsx index 73f2399..292ea28 100644 --- a/002_source/cms/src/db/QuizListenings/GetVisibleCount.tsx +++ b/002_source/cms/src/db/QuizListenings/GetVisibleCount.tsx @@ -1,4 +1,11 @@ +// PURPOSE: +// Get count of visible QuizListening records // REQ0006 +// +// RULES: +// - Returns Promise with count of visible records +// - No parameters required + import { COL_QUIZ_LP_CATEGORIES } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/QuizListenings/ListWithOption.tsx b/002_source/cms/src/db/QuizListenings/ListWithOption.tsx index f305836..cf049aa 100644 --- a/002_source/cms/src/db/QuizListenings/ListWithOption.tsx +++ b/002_source/cms/src/db/QuizListenings/ListWithOption.tsx @@ -1,3 +1,11 @@ +// PURPOSE: +// Get paginated QuizListening records with filtering/sorting options +// +// RULES: +// - Requires currentPage and rowsPerPage parameters +// - Optional listOption parameter for filtering/sorting +// - Returns Promise with paginated ListResult + import { COL_QUIZ_LP_CATEGORIES } from '@/constants'; import type { ListResult, RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/QuizMFCategories/Create.tsx b/002_source/cms/src/db/QuizMFCategories/Create.tsx index 28ad64f..1edb385 100644 --- a/002_source/cms/src/db/QuizMFCategories/Create.tsx +++ b/002_source/cms/src/db/QuizMFCategories/Create.tsx @@ -1,3 +1,13 @@ +// PURPOSE: +// - Creates a new Quiz Multiple-Factor Category record in PocketBase +// - Handles the creation of category records for quiz multi-factor system +// +// RULES: +// - Uses pb.collection().create() without error handling (errors handled by caller) +// - Requires valid CreateFormProps as input +// - Returns Promise with created record +// - Collection ID defined in COL_QUIZ_MF_CATEGORIES constant +// import { COL_QUIZ_MF_CATEGORIES } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/QuizMFCategories/Delete.tsx b/002_source/cms/src/db/QuizMFCategories/Delete.tsx index 751573a..b565c78 100644 --- a/002_source/cms/src/db/QuizMFCategories/Delete.tsx +++ b/002_source/cms/src/db/QuizMFCategories/Delete.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// - Deletes a Quiz Multiple-Factor Category record from PocketBase +// - Handles removal of category records from quiz multi-factor system +// +// RULES: +// - Uses pb.collection().delete() without error handling (errors handled by caller) +// - Requires valid record ID as input +// - Returns Promise indicating deletion success +// - Collection ID defined in COL_QUIZ_MF_CATEGORIES constant import { COL_QUIZ_MF_CATEGORIES } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/QuizMFCategories/GetAll.tsx b/002_source/cms/src/db/QuizMFCategories/GetAll.tsx index 8aedafc..08d728d 100644 --- a/002_source/cms/src/db/QuizMFCategories/GetAll.tsx +++ b/002_source/cms/src/db/QuizMFCategories/GetAll.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// - Retrieves all Quiz Multiple-Factor Category records from PocketBase +// - Used for listing all available categories in quiz multi-factor system +// +// RULES: +// - Uses pb.collection().getFullList() without error handling +// - Returns Promise with all category records +// - Collection ID defined in COL_QUIZ_MF_CATEGORIES constant +// - No filtering parameters required import { COL_QUIZ_MF_CATEGORIES } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/QuizMFCategories/GetAllCount.tsx b/002_source/cms/src/db/QuizMFCategories/GetAllCount.tsx index 56b84d9..ee11112 100644 --- a/002_source/cms/src/db/QuizMFCategories/GetAllCount.tsx +++ b/002_source/cms/src/db/QuizMFCategories/GetAllCount.tsx @@ -1,4 +1,14 @@ +// PURPOSE: +// - Counts all Quiz Multiple-Factor Category records in PocketBase +// - Provides total count of categories for quiz multi-factor system // REQ0006 +// +// RULES: +// - Uses pb.collection().getList() with large page size to count all records +// - Returns Promise with total count +// - Collection ID defined in COL_QUIZ_MF_CATEGORIES constant +// - No filtering parameters applied +// import { COL_QUIZ_MF_CATEGORIES } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/QuizMFCategories/GetById.tsx b/002_source/cms/src/db/QuizMFCategories/GetById.tsx index 609b579..1a59e13 100644 --- a/002_source/cms/src/db/QuizMFCategories/GetById.tsx +++ b/002_source/cms/src/db/QuizMFCategories/GetById.tsx @@ -1,3 +1,13 @@ +// PURPOSE: +// - Retrieves a single Quiz Multiple-Factor Category record by ID from PocketBase +// - Used when detailed information about a specific category is needed +// +// RULES: +// - Uses pb.collection().getOne() to fetch single record +// - Requires valid record ID as input +// - Returns Promise with the category data +// - Collection ID defined in COL_QUIZ_MF_CATEGORIES constant + import { COL_QUIZ_MF_CATEGORIES } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/QuizMFCategories/GetHiddenCount.tsx b/002_source/cms/src/db/QuizMFCategories/GetHiddenCount.tsx index 22b2e04..346b8f8 100644 --- a/002_source/cms/src/db/QuizMFCategories/GetHiddenCount.tsx +++ b/002_source/cms/src/db/QuizMFCategories/GetHiddenCount.tsx @@ -1,4 +1,13 @@ +// PURPOSE: +// - Counts hidden Quiz Multiple-Factor Category records in PocketBase +// - Provides count of hidden categories for quiz multi-factor system // REQ0006 +// +// RULES: +// - Uses pb.collection().getList() with filter for hidden records +// - Returns Promise with count of hidden records +// - Includes error handling (returns 0 on error) +// - Collection ID defined in COL_QUIZ_MF_CATEGORIES constant import { COL_QUIZ_MF_CATEGORIES } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/QuizMFCategories/GetVisibleCount.tsx b/002_source/cms/src/db/QuizMFCategories/GetVisibleCount.tsx index b5e6054..4ae5cb7 100644 --- a/002_source/cms/src/db/QuizMFCategories/GetVisibleCount.tsx +++ b/002_source/cms/src/db/QuizMFCategories/GetVisibleCount.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// - Counts visible Quiz Multiple-Factor Category records in PocketBase +// - Provides count of visible categories for quiz multi-factor system +// +// RULES: +// - Uses pb.collection().getList() with filter for visible records +// - Returns Promise with count of visible records +// - Includes error handling (returns 0 on error) +// - Collection ID defined in COL_QUIZ_MF_CATEGORIES constant // REQ0006 import { COL_QUIZ_MF_CATEGORIES } from '@/constants'; diff --git a/002_source/cms/src/db/QuizMFCategories/Update.tsx b/002_source/cms/src/db/QuizMFCategories/Update.tsx index 7b9ac31..d6f9a6a 100644 --- a/002_source/cms/src/db/QuizMFCategories/Update.tsx +++ b/002_source/cms/src/db/QuizMFCategories/Update.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// - Updates an existing Quiz Multiple-Factor Category record in PocketBase +// - Handles modifications to category records in quiz multi-factor system +// +// RULES: +// - Uses pb.collection().update() without error handling (errors handled by caller) +// - Requires valid record ID and CreateFormProps as input +// - Returns Promise with updated record +// - Collection ID defined in COL_QUIZ_MF_CATEGORIES constant import { COL_QUIZ_MF_CATEGORIES } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/Students/Create.tsx b/002_source/cms/src/db/Students/Create.tsx index 3a46b3c..71ad641 100644 --- a/002_source/cms/src/db/Students/Create.tsx +++ b/002_source/cms/src/db/Students/Create.tsx @@ -1,6 +1,13 @@ -// api method for crate student record +// +// PURPOSE: +// Create a new student record in the database +// // RULES: -// TBA +// 1. Uses PocketBase collection COL_USER_METAS +// 2. Input data must conform to CreateFormProps type +// 3. Returns Promise from PocketBase +// 4. Automatically sets role to 'student' +// import { COL_USER_METAS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/Students/Delete.tsx b/002_source/cms/src/db/Students/Delete.tsx index e3d42a6..2b302dd 100644 --- a/002_source/cms/src/db/Students/Delete.tsx +++ b/002_source/cms/src/db/Students/Delete.tsx @@ -1,3 +1,14 @@ +// +// PURPOSE: +// Delete a student record from the database by ID +// +// RULES: +// 1. Uses PocketBase collection COL_USER_METAS +// 2. Requires valid student ID as input +// 3. Returns Promise indicating deletion success +// 4. Does not verify if record exists before deletion +// + import { COL_USER_METAS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Students/GetActiveCount.tsx b/002_source/cms/src/db/Students/GetActiveCount.tsx index 3be4a14..10288a4 100644 --- a/002_source/cms/src/db/Students/GetActiveCount.tsx +++ b/002_source/cms/src/db/Students/GetActiveCount.tsx @@ -1,3 +1,14 @@ +// +// PURPOSE: +// Count active student records in the database +// +// RULES: +// 1. Uses PocketBase collection COL_USER_METAS with role='student' +// 2. Only counts records with status='active' +// 3. Returns Promise with the count +// 4. Uses PocketBase's getList with filter +// + import { COL_USER_METAS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Students/GetAll.tsx b/002_source/cms/src/db/Students/GetAll.tsx index b6b23fc..51ff3ed 100644 --- a/002_source/cms/src/db/Students/GetAll.tsx +++ b/002_source/cms/src/db/Students/GetAll.tsx @@ -1,3 +1,14 @@ +// +// PURPOSE: +// Retrieve all student records from the database +// +// RULES: +// 1. Uses PocketBase collection COL_STUDENTS +// 2. Returns Promise with full list of students +// 3. Accepts optional query parameters via options object +// 4. Uses PocketBase's getFullList method +// + import { pb } from '@/lib/pb'; import { COL_STUDENTS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/Students/GetAllCount.tsx b/002_source/cms/src/db/Students/GetAllCount.tsx index 1bcae29..9cca6f1 100644 --- a/002_source/cms/src/db/Students/GetAllCount.tsx +++ b/002_source/cms/src/db/Students/GetAllCount.tsx @@ -1,3 +1,14 @@ +// +// PURPOSE: +// Count all student records in the database +// +// RULES: +// 1. Uses PocketBase collection COL_USER_METAS with role='student' +// 2. Returns Promise with total count +// 3. Uses PocketBase's getList with minimal page size for counting +// 4. Includes all statuses (active, pending, blocked) +// + import { pb } from '@/lib/pb'; import { COL_USER_METAS } from '@/constants'; diff --git a/002_source/cms/src/db/Students/GetBlockedCount.tsx b/002_source/cms/src/db/Students/GetBlockedCount.tsx index 0dbceb6..f6de019 100644 --- a/002_source/cms/src/db/Students/GetBlockedCount.tsx +++ b/002_source/cms/src/db/Students/GetBlockedCount.tsx @@ -1,3 +1,14 @@ +// +// PURPOSE: +// Count blocked student records in the database +// +// RULES: +// 1. Uses PocketBase collection COL_USER_METAS with role='student' +// 2. Only counts records with status='blocked' +// 3. Returns Promise with the count +// 4. Uses PocketBase's getList with filter +// + import { COL_USER_METAS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Students/GetById.tsx b/002_source/cms/src/db/Students/GetById.tsx index 7fda666..db0efba 100644 --- a/002_source/cms/src/db/Students/GetById.tsx +++ b/002_source/cms/src/db/Students/GetById.tsx @@ -1,4 +1,12 @@ -// src/db/Students/GetById.tsx +// +// PURPOSE: +// Retrieve a single student record by ID from the database +// +// RULES: +// 1. Uses PocketBase collection COL_USER_METAS +// 2. Requires valid student record ID +// 3. Returns Promise with expanded billingAddress and helloworld +// 4. Transforms DBStudent to Student type // import { COL_USER_METAS } from '@/constants'; diff --git a/002_source/cms/src/db/Students/GetPendingCount.tsx b/002_source/cms/src/db/Students/GetPendingCount.tsx index 29bfd09..868bee0 100644 --- a/002_source/cms/src/db/Students/GetPendingCount.tsx +++ b/002_source/cms/src/db/Students/GetPendingCount.tsx @@ -1,3 +1,14 @@ +// +// PURPOSE: +// Count pending student records in the database +// +// RULES: +// 1. Uses PocketBase collection COL_USER_METAS with role='student' +// 2. Only counts records with status='pending' +// 3. Returns Promise with the count +// 4. Uses PocketBase's getList with filter +// + import { COL_USER_METAS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Students/Helloworld.tsx b/002_source/cms/src/db/Students/Helloworld.tsx index c6b9ffa..74532c7 100644 --- a/002_source/cms/src/db/Students/Helloworld.tsx +++ b/002_source/cms/src/db/Students/Helloworld.tsx @@ -1,7 +1,12 @@ -// src/db/Students/Helloworld.tsx -// RULES: -// T.B.A. // -export function helloCustomer(): string { - return 'Hello from Customers module!'; +// PURPOSE: +// Provide a simple greeting function for students module +// +// RULES: +// 1. Returns a fixed greeting string +// 2. Outputs 'Hello from Students module!' +// + +export function helloStudent(): string { + return 'Hello from Students module!'; } diff --git a/002_source/cms/src/db/Students/Update.tsx b/002_source/cms/src/db/Students/Update.tsx index 7beeff7..6ffe9ca 100644 --- a/002_source/cms/src/db/Students/Update.tsx +++ b/002_source/cms/src/db/Students/Update.tsx @@ -1,8 +1,18 @@ +// PURPOSE: +// Update student record in database +// +// RULES: +// 1. Uses COL_USER_METAS collection with role='student' +// 2. Requires valid student ID string +// 3. Accepts Partial update data +// 4. Returns Promise with updated record +// 5. Throws error if update fails + import { pb } from '@/lib/pb'; -import { COL_CUSTOMERS } from '@/constants'; +import { COL_USER_METAS } from '@/constants'; import type { RecordModel } from 'pocketbase'; import type { EditFormProps } from '@/components/dashboard/customer/type.d'; export async function updateCustomer(id: string, data: Partial): Promise { - return pb.collection(COL_CUSTOMERS).update(id, data); + return pb.collection(COL_USER_METAS).update(id, data); } diff --git a/002_source/cms/src/db/Students/UpdateById.tsx b/002_source/cms/src/db/Students/UpdateById.tsx index 0a408b3..cdd8a31 100644 --- a/002_source/cms/src/db/Students/UpdateById.tsx +++ b/002_source/cms/src/db/Students/UpdateById.tsx @@ -1,3 +1,14 @@ +// PURPOSE: +// Update student record by ID in database +// +// RULES: +// 1. Uses COL_USER_METAS collection with role='student' +// 2. Requires valid student ID string +// 3. Accepts Partial update data +// 4. Returns Promise with updated record +// 5. Throws error if update fails +// 6. For direct ID-based updates (not query-based) + import { COL_USER_METAS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/Teachers/Create.tsx b/002_source/cms/src/db/Teachers/Create.tsx index 04fd5d0..86d26e7 100644 --- a/002_source/cms/src/db/Teachers/Create.tsx +++ b/002_source/cms/src/db/Teachers/Create.tsx @@ -1,6 +1,12 @@ -// api method for crate teacher record +// PURPOSE: +// Create new teacher record in the database +// // RULES: -// TBA +// 1. Uses PocketBase API for database operations +// 2. Operates on COL_USER_METAS collection +// 3. Automatically sets role field to 'teacher' +// 4. Requires valid CreateFormProps data +// 5. Returns Promise import { COL_USER_METAS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/Teachers/Delete.tsx b/002_source/cms/src/db/Teachers/Delete.tsx index 73c83ae..977155d 100644 --- a/002_source/cms/src/db/Teachers/Delete.tsx +++ b/002_source/cms/src/db/Teachers/Delete.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Delete teacher record from database by ID +// +// RULES: +// 1. Uses PocketBase API for database operations +// 2. Operates on COL_USER_METAS collection +// 3. Requires valid record ID +// 4. Returns Promise indicating success +// import { pb } from '@/lib/pb'; import { COL_USER_METAS } from '@/constants'; diff --git a/002_source/cms/src/db/Teachers/GetActiveCount.tsx b/002_source/cms/src/db/Teachers/GetActiveCount.tsx index d43a207..75233d2 100644 --- a/002_source/cms/src/db/Teachers/GetActiveCount.tsx +++ b/002_source/cms/src/db/Teachers/GetActiveCount.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Get count of active teacher records +// +// RULES: +// 1. Uses COL_USER_METAS collection +// 2. Filters records with status = "active" +// 3. Returns Promise with count +// + import { COL_USER_METAS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Teachers/GetAll.tsx b/002_source/cms/src/db/Teachers/GetAll.tsx index f37b099..3729e9f 100644 --- a/002_source/cms/src/db/Teachers/GetAll.tsx +++ b/002_source/cms/src/db/Teachers/GetAll.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Get all teacher records from database +// +// RULES: +// 1. Uses COL_TEACHERS collection +// 2. Accepts optional query options +// 3. Returns Promise with all records +// + import { COL_TEACHERS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/Teachers/GetAllCount.tsx b/002_source/cms/src/db/Teachers/GetAllCount.tsx index 3cf566e..e2ac3c6 100644 --- a/002_source/cms/src/db/Teachers/GetAllCount.tsx +++ b/002_source/cms/src/db/Teachers/GetAllCount.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Get total count of all teacher records +// +// RULES: +// 1. Uses COL_USER_METAS collection +// 2. Filters records with role = "teacher" +// 3. Returns Promise with total count +// + import { pb } from '@/lib/pb'; import { COL_USER_METAS } from '@/constants'; diff --git a/002_source/cms/src/db/Teachers/GetBlockedCount.tsx b/002_source/cms/src/db/Teachers/GetBlockedCount.tsx index 54875c4..5339e19 100644 --- a/002_source/cms/src/db/Teachers/GetBlockedCount.tsx +++ b/002_source/cms/src/db/Teachers/GetBlockedCount.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Get count of blocked teacher records +// +// RULES: +// 1. Uses COL_USER_METAS collection +// 2. Filters records with status = "blocked" +// 3. Returns Promise with count +// + import { COL_USER_METAS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Teachers/GetById.tsx b/002_source/cms/src/db/Teachers/GetById.tsx index 560d429..5a0d14d 100644 --- a/002_source/cms/src/db/Teachers/GetById.tsx +++ b/002_source/cms/src/db/Teachers/GetById.tsx @@ -1,5 +1,13 @@ -// src/db/Teachers/GetById.tsx +// PURPOSE: +// Get single teacher record by ID with expanded fields // +// RULES: +// 1. Uses COL_USER_METAS collection +// 2. Requires valid record ID +// 3. Expands billingAddress and helloworld fields +// 4. Returns Promise with formatted teacher data +// + import { COL_USER_METAS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Teachers/GetPendingCount.tsx b/002_source/cms/src/db/Teachers/GetPendingCount.tsx index 8b286a1..f2cc424 100644 --- a/002_source/cms/src/db/Teachers/GetPendingCount.tsx +++ b/002_source/cms/src/db/Teachers/GetPendingCount.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Get count of pending teacher records awaiting approval +// +// RULES: +// 1. Uses COL_USER_METAS collection +// 2. Filters records with status = "pending" and role = "teacher" +// 3. Returns Promise with count +// + import { COL_USER_METAS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Teachers/Helloworld.tsx b/002_source/cms/src/db/Teachers/Helloworld.tsx index a8e5889..5f8e04d 100644 --- a/002_source/cms/src/db/Teachers/Helloworld.tsx +++ b/002_source/cms/src/db/Teachers/Helloworld.tsx @@ -1,3 +1,11 @@ +// PURPOSE: +// Example function demonstrating module functionality +// +// RULES: +// 1. Returns a greeting string +// 2. For demonstration purposes only +// + export function helloCustomer(): string { return 'Hello from Customers module!'; } diff --git a/002_source/cms/src/db/UserMetas/Create.tsx b/002_source/cms/src/db/UserMetas/Create.tsx index 0b2ebea..102576f 100644 --- a/002_source/cms/src/db/UserMetas/Create.tsx +++ b/002_source/cms/src/db/UserMetas/Create.tsx @@ -3,6 +3,11 @@ // PURPOSE: // create user meta // +// RULES: +// 1. Use COL_USER_METAS constant for collection name +// 2. Follow CreateFormProps type for data structure +// 3. Create record via pb.collection().create() method +// import { COL_USER_METAS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/UserMetas/Delete.tsx b/002_source/cms/src/db/UserMetas/Delete.tsx index 9236b17..660d3de 100644 --- a/002_source/cms/src/db/UserMetas/Delete.tsx +++ b/002_source/cms/src/db/UserMetas/Delete.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Delete user meta by ID +// +// RULES: +// 1. Use COL_USER_METAS constant for collection name +// 2. Delete record via pb.collection().delete() method +// 3. Must provide valid record ID +// + import { pb } from '@/lib/pb'; import { COL_USER_METAS } from '@/constants'; diff --git a/002_source/cms/src/db/UserMetas/GetActiveCount.tsx b/002_source/cms/src/db/UserMetas/GetActiveCount.tsx index 9bb17f8..b6b6096 100644 --- a/002_source/cms/src/db/UserMetas/GetActiveCount.tsx +++ b/002_source/cms/src/db/UserMetas/GetActiveCount.tsx @@ -1,3 +1,13 @@ +// PURPOSE: +// Get count of user metas with "active" status +// +// RULES: +// 1. Use COL_USER_METAS constant for collection name +// 2. Query via pb.collection().getList() method +// 3. Filter records with status="active" +// 4. Return type is number +// + import { COL_USER_METAS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/UserMetas/GetAll.tsx b/002_source/cms/src/db/UserMetas/GetAll.tsx index 673b9a1..6890d7a 100644 --- a/002_source/cms/src/db/UserMetas/GetAll.tsx +++ b/002_source/cms/src/db/UserMetas/GetAll.tsx @@ -1,3 +1,13 @@ +// PURPOSE: +// Get all user meta records +// +// RULES: +// 1. Use COL_USER_METAS constant for collection name +// 2. Query via pb.collection().getFullList() method +// 3. Accepts options parameter for filtering/sorting +// 4. Returns array of RecordModel +// + import { pb } from '@/lib/pb'; import { COL_USER_METAS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/UserMetas/GetAllCount.tsx b/002_source/cms/src/db/UserMetas/GetAllCount.tsx index bea65db..c7731b4 100644 --- a/002_source/cms/src/db/UserMetas/GetAllCount.tsx +++ b/002_source/cms/src/db/UserMetas/GetAllCount.tsx @@ -1,6 +1,13 @@ +// PURPOSE: +// Get total count of all user meta records +// // RULES: -// error handled by caller -// contain definition to collection only +// 1. Use COL_USER_METAS constant for collection name +// 2. Query via pb.collection().getList() method +// 3. Returns total count as number +// 4. Errors are handled by caller +// 5. Contains collection definition only +// import { COL_USER_METAS } from '@/constants'; diff --git a/002_source/cms/src/db/UserMetas/GetBlockedCount.tsx b/002_source/cms/src/db/UserMetas/GetBlockedCount.tsx index 54875c4..b0905ca 100644 --- a/002_source/cms/src/db/UserMetas/GetBlockedCount.tsx +++ b/002_source/cms/src/db/UserMetas/GetBlockedCount.tsx @@ -1,3 +1,13 @@ +// PURPOSE: +// Get count of user metas with "blocked" status +// +// RULES: +// 1. Use COL_USER_METAS constant for collection name +// 2. Query via pb.collection().getList() method +// 3. Filter records with status="blocked" +// 4. Return type is number +// + import { COL_USER_METAS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/UserMetas/GetById.tsx b/002_source/cms/src/db/UserMetas/GetById.tsx index c93d543..73f0e8d 100644 --- a/002_source/cms/src/db/UserMetas/GetById.tsx +++ b/002_source/cms/src/db/UserMetas/GetById.tsx @@ -1,5 +1,14 @@ // src/db/UserMetas/GetById.tsx +// PURPOSE: +// Get user meta by ID and format for frontend use // +// RULES: +// 1. Use COL_USER_METAS constant for collection name +// 2. Query via pb.collection().getOne() method +// 3. Expand billingAddress and helloworld relations +// 4. Convert DBUserMeta to UserMeta type +// + import { COL_USER_METAS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/UserMetas/GetPendingCount.tsx b/002_source/cms/src/db/UserMetas/GetPendingCount.tsx index dc117d4..8908499 100644 --- a/002_source/cms/src/db/UserMetas/GetPendingCount.tsx +++ b/002_source/cms/src/db/UserMetas/GetPendingCount.tsx @@ -1,3 +1,13 @@ +// PURPOSE: +// Get count of user metas with "pending" status +// +// RULES: +// 1. Use COL_USER_METAS constant for collection name +// 2. Query via pb.collection().getList() method +// 3. Filter records with status="pending" +// 4. Return type is number +// + import { COL_USER_METAS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/UserMetas/Helloworld.tsx b/002_source/cms/src/db/UserMetas/Helloworld.tsx index a8e5889..342ab67 100644 --- a/002_source/cms/src/db/UserMetas/Helloworld.tsx +++ b/002_source/cms/src/db/UserMetas/Helloworld.tsx @@ -1,3 +1,11 @@ +// PURPOSE: +// Test/demo function for Customers module +// +// RULES: +// 1. For testing/demonstration only +// 2. Returns fixed greeting string +// + export function helloCustomer(): string { return 'Hello from Customers module!'; } diff --git a/002_source/cms/src/db/UserMetas/Update.tsx b/002_source/cms/src/db/UserMetas/Update.tsx index 509a102..ad5e72a 100644 --- a/002_source/cms/src/db/UserMetas/Update.tsx +++ b/002_source/cms/src/db/UserMetas/Update.tsx @@ -1,3 +1,13 @@ +// PURPOSE: +// Update user meta by ID with provided data +// +// RULES: +// 1. Use COL_USER_METAS constant for collection name +// 2. Update record via pb.collection().update() method +// 3. Requires valid record ID and update data +// 4. Data must conform to EditFormProps type +// + import { pb } from '@/lib/pb'; import { COL_USER_METAS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/UserMetas/UpdateById.tsx b/002_source/cms/src/db/UserMetas/UpdateById.tsx index 61131d5..c9e2fea 100644 --- a/002_source/cms/src/db/UserMetas/UpdateById.tsx +++ b/002_source/cms/src/db/UserMetas/UpdateById.tsx @@ -1,3 +1,13 @@ +// PURPOSE: +// Update user meta data by ID with provided partial data +// +// RULES: +// 1. Use COL_USER_METAS constant for collection name +// 2. Update record via pb.collection().update() method +// 3. Requires valid record ID and update data +// 4. Data must conform to UpdateUserMeta type +// + import { COL_USER_METAS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/Users/Create.tsx b/002_source/cms/src/db/Users/Create.tsx index c6bdf7a..f62ba57 100644 --- a/002_source/cms/src/db/Users/Create.tsx +++ b/002_source/cms/src/db/Users/Create.tsx @@ -1,3 +1,13 @@ +// PURPOSE: +// - Provides functionality to create new user records in the database +// - Handles user input validation and submission +// +// RULES: +// - Must validate all required fields before submission +// - Should follow the user schema defined in type.d.ts +// - Must handle errors gracefully and provide user feedback +// - Should integrate with the authentication system +// import { pb } from '@/lib/pb'; import { COL_USERS } from '@/constants'; import type { User } from '@/types/user'; diff --git a/002_source/cms/src/db/Users/Delete.tsx b/002_source/cms/src/db/Users/Delete.tsx index d1a0b73..fcc4516 100644 --- a/002_source/cms/src/db/Users/Delete.tsx +++ b/002_source/cms/src/db/Users/Delete.tsx @@ -1,3 +1,13 @@ +// PURPOSE: +// - Provides functionality to delete user records from the database +// - Handles confirmation and deletion process +// +// RULES: +// - Must require confirmation before deletion +// - Should prevent deletion of currently logged-in user +// - Must handle errors gracefully and provide user feedback +// - Should maintain referential integrity +// import { pb } from '@/lib/pb'; import { COL_USERS } from '@/constants'; diff --git a/002_source/cms/src/db/Users/GetActiveCount.tsx b/002_source/cms/src/db/Users/GetActiveCount.tsx index a8679de..ed2ccf8 100644 --- a/002_source/cms/src/db/Users/GetActiveCount.tsx +++ b/002_source/cms/src/db/Users/GetActiveCount.tsx @@ -1,3 +1,13 @@ +// PURPOSE: +// - Provides functionality to count active users in the database +// - Returns the number of users with active status +// +// RULES: +// - Must accurately filter users by active status +// - Should cache results when appropriate +// - Must handle errors gracefully +// - Should follow performance best practices for counting operations +// import { COL_CUSTOMERS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Users/GetAll.tsx b/002_source/cms/src/db/Users/GetAll.tsx index 6d63b06..e5dc5e5 100644 --- a/002_source/cms/src/db/Users/GetAll.tsx +++ b/002_source/cms/src/db/Users/GetAll.tsx @@ -1,3 +1,13 @@ +// PURPOSE: +// - Provides functionality to retrieve all user records from the database +// - Supports filtering, sorting and pagination +// +// RULES: +// - Must implement proper pagination to handle large datasets +// - Should support filtering by user attributes +// - Must respect data privacy and only return authorized fields +// - Should optimize queries for performance +// import { pb } from '@/lib/pb'; import { COL_CUSTOMERS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/Users/GetAllCount.tsx b/002_source/cms/src/db/Users/GetAllCount.tsx index 701ba1e..7342c8b 100644 --- a/002_source/cms/src/db/Users/GetAllCount.tsx +++ b/002_source/cms/src/db/Users/GetAllCount.tsx @@ -1,3 +1,13 @@ +// PURPOSE: +// - Provides functionality to count all user records in the database +// - Returns the total number of users regardless of status +// +// RULES: +// - Must provide accurate count of all users +// - Should implement caching for frequent queries +// - Must handle errors gracefully +// - Should follow performance best practices for counting operations +// import { pb } from '@/lib/pb'; import { COL_USERS } from '@/constants'; diff --git a/002_source/cms/src/db/Users/GetBlockedCount.tsx b/002_source/cms/src/db/Users/GetBlockedCount.tsx index 261321c..f429d89 100644 --- a/002_source/cms/src/db/Users/GetBlockedCount.tsx +++ b/002_source/cms/src/db/Users/GetBlockedCount.tsx @@ -1,3 +1,13 @@ +// PURPOSE: +// - Provides functionality to count all blocked user records in the database +// - Returns the number of users with 'blocked' status +// +// RULES: +// - Must filter users by 'blocked' status +// - Should implement caching for frequent queries +// - Must handle errors gracefully +// - Should follow performance best practices for counting operations +// import { COL_CUSTOMERS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Users/GetById.tsx b/002_source/cms/src/db/Users/GetById.tsx index aa8c2cf..cbf5063 100644 --- a/002_source/cms/src/db/Users/GetById.tsx +++ b/002_source/cms/src/db/Users/GetById.tsx @@ -1,3 +1,13 @@ +// PURPOSE: +// - Provides functionality to retrieve a single user record by ID +// - Returns complete user details for the specified ID +// +// RULES: +// - Must validate input ID format +// - Should handle cases where user is not found +// - Must respect data privacy and only return authorized fields +// - Should optimize query performance for single record retrieval +// import { COL_USERS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Users/GetPendingCount.tsx b/002_source/cms/src/db/Users/GetPendingCount.tsx index 186c743..b469ad6 100644 --- a/002_source/cms/src/db/Users/GetPendingCount.tsx +++ b/002_source/cms/src/db/Users/GetPendingCount.tsx @@ -1,3 +1,13 @@ +// PURPOSE: +// - Provides functionality to count pending user accounts in the database +// - Returns the number of users with pending approval status +// +// RULES: +// - Must accurately filter users by pending status +// - Should implement proper access control for this operation +// - Must handle errors gracefully +// - Should follow security best practices +// import { COL_USERS } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Users/Helloworld.tsx b/002_source/cms/src/db/Users/Helloworld.tsx index 0714592..6beda40 100644 --- a/002_source/cms/src/db/Users/Helloworld.tsx +++ b/002_source/cms/src/db/Users/Helloworld.tsx @@ -1,3 +1,13 @@ +// PURPOSE: +// - Example/Test component demonstrating basic functionality +// - May be used for development testing or as a template +// +// RULES: +// - Should be kept simple and clean as reference code +// - Must not contain production business logic +// - Should follow project coding standards +// - May be updated or removed during code cleanup +// export function helloUser(): string { return 'Hello from Users module!'; } diff --git a/002_source/cms/src/db/Users/Update.tsx b/002_source/cms/src/db/Users/Update.tsx index 8a4bf79..77f89e9 100644 --- a/002_source/cms/src/db/Users/Update.tsx +++ b/002_source/cms/src/db/Users/Update.tsx @@ -1,3 +1,13 @@ +// PURPOSE: +// - Provides functionality to update existing user records in the database +// - Handles partial and full updates of user attributes +// +// RULES: +// - Must validate all input fields before update +// - Should implement proper version control/optimistic locking +// - Must handle concurrent updates safely +// - Should provide clear feedback on update results +// import { pb } from '@/lib/pb'; import { COL_USERS } from '@/constants'; import type { User } from '@/types/user'; diff --git a/002_source/cms/src/db/Users/UpdateById.tsx b/002_source/cms/src/db/Users/UpdateById.tsx index 53cc3d4..1a1b131 100644 --- a/002_source/cms/src/db/Users/UpdateById.tsx +++ b/002_source/cms/src/db/Users/UpdateById.tsx @@ -1,3 +1,14 @@ +// PURPOSE: +// - Provides functionality to update a specific user record by ID +// - Handles partial updates of user attributes for a given user ID +// +// RULES: +// - Must validate the user ID before update +// - Should handle cases where user is not found +// - Must validate input data against schema +// - Should implement proper error handling +// - Must maintain data consistency +// import { COL_USERS } from '@/constants'; import type { RecordModel } from 'pocketbase'; diff --git a/002_source/cms/src/db/Vocabularies/Create.tsx b/002_source/cms/src/db/Vocabularies/Create.tsx index 58a76e4..80fe666 100644 --- a/002_source/cms/src/db/Vocabularies/Create.tsx +++ b/002_source/cms/src/db/Vocabularies/Create.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Create new vocabulary entry in database +// +// RULES: +// 1. Uses COL_VOCABULARIES collection +// 2. Requires VocabularyCreate type data +// 3. Returns Promise with created record +// 4. Throws error if creation fails + import { COL_VOCABULARIES } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Vocabularies/Delete.tsx b/002_source/cms/src/db/Vocabularies/Delete.tsx index 8e20b07..04a4d54 100644 --- a/002_source/cms/src/db/Vocabularies/Delete.tsx +++ b/002_source/cms/src/db/Vocabularies/Delete.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Delete specified vocabulary entry from database +// +// RULES: +// 1. Uses COL_VOCABULARIES collection +// 2. Requires valid vocabulary ID string +// 3. Returns Promise indicating success +// 4. Throws error if deletion fails + import { COL_VOCABULARIES } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Vocabularies/GetAll.tsx b/002_source/cms/src/db/Vocabularies/GetAll.tsx index d52fa41..2a33c59 100644 --- a/002_source/cms/src/db/Vocabularies/GetAll.tsx +++ b/002_source/cms/src/db/Vocabularies/GetAll.tsx @@ -1,3 +1,12 @@ +// PURPOSE: +// Retrieve all vocabulary entries from the database +// +// RULES: +// - Uses PocketBase getFullList API +// - Returns Promise with all vocabularies +// - Accepts no parameters +// + import { COL_VOCABULARIES } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Vocabularies/GetAllCount.tsx b/002_source/cms/src/db/Vocabularies/GetAllCount.tsx index 1f7f7bf..773fa0e 100644 --- a/002_source/cms/src/db/Vocabularies/GetAllCount.tsx +++ b/002_source/cms/src/db/Vocabularies/GetAllCount.tsx @@ -1,6 +1,12 @@ +// PURPOSE: +// Get total count of vocabulary entries +// // RULES: -// error handled by caller -// contain definition to collection only +// - Uses PocketBase getList API +// - Returns Promise with total count +// - Errors are handled by caller +// - Contains collection definition only +// import { COL_VOCABULARIES } from '@/constants'; diff --git a/002_source/cms/src/db/Vocabularies/GetById.tsx b/002_source/cms/src/db/Vocabularies/GetById.tsx index d4015a1..686570b 100644 --- a/002_source/cms/src/db/Vocabularies/GetById.tsx +++ b/002_source/cms/src/db/Vocabularies/GetById.tsx @@ -1,3 +1,13 @@ +// PURPOSE: +// Retrieve single vocabulary entry by ID +// +// RULES: +// 1. Uses COL_VOCABULARIES collection +// 2. Requires valid vocabulary ID string +// 3. Returns Promise with requested entry +// 4. Uses getOne API +// 5. Throws error if retrieval fails + import { COL_VOCABULARIES } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Vocabularies/GetHiddenCount.tsx b/002_source/cms/src/db/Vocabularies/GetHiddenCount.tsx index 4203026..a08049c 100644 --- a/002_source/cms/src/db/Vocabularies/GetHiddenCount.tsx +++ b/002_source/cms/src/db/Vocabularies/GetHiddenCount.tsx @@ -1,3 +1,13 @@ +// PURPOSE: +// Get count of vocabulary entries marked as hidden +// +// RULES: +// 1. Uses COL_VOCABULARIES collection +// 2. Filters records with visible="hidden" +// 3. Returns Promise with count +// 4. Limits to first 9999 records +// 5. Returns 0 on error + import { COL_VOCABULARIES } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Vocabularies/GetVisibleCount.tsx b/002_source/cms/src/db/Vocabularies/GetVisibleCount.tsx index a208af1..62a7a5a 100644 --- a/002_source/cms/src/db/Vocabularies/GetVisibleCount.tsx +++ b/002_source/cms/src/db/Vocabularies/GetVisibleCount.tsx @@ -1,3 +1,9 @@ +// PURPOSE: Get count of visible vocabulary entries +// RULES: +// - Uses PocketBase getList API with visible="visible" filter +// - Returns Promise with count of visible vocabularies +// - Maximum 9999 records returned + import { COL_VOCABULARIES } from '@/constants'; import { pb } from '@/lib/pb'; diff --git a/002_source/cms/src/db/Vocabularies/Helloworld.tsx b/002_source/cms/src/db/Vocabularies/Helloworld.tsx index 2356119..47ef750 100644 --- a/002_source/cms/src/db/Vocabularies/Helloworld.tsx +++ b/002_source/cms/src/db/Vocabularies/Helloworld.tsx @@ -1,3 +1,10 @@ +// +// PURPOSE: Example/test function that returns "helloworld" string +// RULES: +// - Takes no parameters +// - Always returns fixed string "helloworld" +// + function helloWorld(): string { return 'helloworld'; } diff --git a/002_source/cms/src/db/Vocabularies/Update.tsx b/002_source/cms/src/db/Vocabularies/Update.tsx index 6c1db27..c1f38fa 100644 --- a/002_source/cms/src/db/Vocabularies/Update.tsx +++ b/002_source/cms/src/db/Vocabularies/Update.tsx @@ -1,3 +1,13 @@ +// +// PURPOSE: +// Update specified vocabulary entry in the database +// +// RULES: +// - Must provide valid vocabulary ID and update data +// - Uses PocketBase collection API +// - Returns Promise with updated vocabulary +// + import { COL_VOCABULARIES } from '@/constants'; import type { RecordModel } from 'pocketbase';