update,
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_CUSTOMERS } from '@/constants';
|
||||
|
||||
export async function deleteCustomer(id) {
|
||||
export async function deleteCustomer(id: string): Promise<boolean> {
|
||||
return pb.collection(COL_CUSTOMERS).delete(id);
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_CUSTOMERS } from '@/constants';
|
||||
import { RecordModel } from 'pocketbase';
|
||||
|
||||
export async function getAllCustomers(options = {}) {
|
||||
export async function getAllCustomers(options = {}): Promise<RecordModel[]> {
|
||||
return pb.collection(COL_CUSTOMERS).getFullList(options);
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_CUSTOMERS } from '@/constants';
|
||||
|
||||
export async function getAllCustomersCount() {
|
||||
export async function getAllCustomersCount(): Promise<number> {
|
||||
const result = await pb.collection(COL_CUSTOMERS).getList(1, 1);
|
||||
return result.totalItems;
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_CUSTOMERS } from '@/constants';
|
||||
import { RecordModel } from 'pocketbase';
|
||||
|
||||
export async function getCustomerById(id) {
|
||||
export async function getCustomerById(id: string): Promise<RecordModel> {
|
||||
return pb.collection(COL_CUSTOMERS).getOne(id);
|
||||
}
|
||||
|
@@ -1,9 +0,0 @@
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_CUSTOMERS } from '@/constants';
|
||||
|
||||
export async function getHiddenCustomersCount() {
|
||||
const result = await pb.collection(COL_CUSTOMERS).getList(1, 1, {
|
||||
filter: 'hidden = true',
|
||||
});
|
||||
return result.totalItems;
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_CUSTOMERS } from '@/constants';
|
||||
|
||||
export async function getVisibleCustomersCount() {
|
||||
const result = await pb.collection(COL_CUSTOMERS).getList(1, 1, {
|
||||
filter: 'hidden = false',
|
||||
});
|
||||
return result.totalItems;
|
||||
}
|
@@ -1,8 +1,8 @@
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_CUSTOMERS } from '@/constants';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
import type { CreateForm } from '@/components/dashboard/customer/type.d';
|
||||
import type { EditFormProps } from '@/components/dashboard/customer/type.d';
|
||||
|
||||
export async function updateCustomer(id: string, data: Partial<CustomerUpdateData>): Promise<RecordModel> {
|
||||
export async function updateCustomer(id: string, data: Partial<EditFormProps>): Promise<RecordModel> {
|
||||
return pb.collection(COL_CUSTOMERS).update(id, data);
|
||||
}
|
||||
|
31
002_source/cms/src/db/Customers/_GUIDELINES.md
Normal file
31
002_source/cms/src/db/Customers/_GUIDELINES.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# GUIDELINES
|
||||
|
||||
This folder contains drivers for `Customer`/`Customers` records using PocketBase:
|
||||
|
||||
- create (Create.tsx)
|
||||
- read (GetById.tsx)
|
||||
- write (Update.tsx)
|
||||
- count (GetAllCount.tsx, GetActiveCount.tsx, GetBlockedCount.tsx, GetPendingCount.tsx)
|
||||
- misc (Helloworld.tsx)
|
||||
- delete (Delete.tsx)
|
||||
- list (GetAll.tsx)
|
||||
|
||||
the `@` sign refer to `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src`
|
||||
|
||||
## Assumption and Requirements
|
||||
|
||||
- assume `pb` is located in `@/lib/pb`
|
||||
- no need to handle error in this function, i'll handle it in the caller
|
||||
- type information defined in `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/Customers/type.d.tsx`
|
||||
|
||||
simple template:
|
||||
|
||||
```typescript
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_CUSTOMERS } from '@/constants';
|
||||
|
||||
export async function createCustomer(data: CreateFormProps) {
|
||||
// ...content
|
||||
// use direct return of pb.collection (e.g. return pb.collection(xxx))
|
||||
}
|
||||
```
|
33
002_source/cms/src/db/Events/_GUIDELINES.md
Normal file
33
002_source/cms/src/db/Events/_GUIDELINES.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# GUIDELINES
|
||||
|
||||
This folder contains drivers for `Event`/`Events` records using PocketBase:
|
||||
|
||||
- create (Create.tsx)
|
||||
- read (GetById.tsx)
|
||||
- write (Update.tsx)
|
||||
- count (GetAllCount.tsx)
|
||||
- delete (Delete.tsx)
|
||||
- list (GetAll.tsx)
|
||||
|
||||
the `@` sign refer to `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src`
|
||||
|
||||
## Assumption and Requirements
|
||||
|
||||
- assume `pb` is located in `@/lib/pb`
|
||||
- no need to handle error in this function, i'll handle it in the caller
|
||||
- type information defined in `@/db/Events/type.d.tsx`
|
||||
- Event records require special handling for:
|
||||
- Date/time validation
|
||||
- Location data
|
||||
- Attendee management
|
||||
|
||||
simple template:
|
||||
|
||||
```typescript
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export async function createEvent(data: CreateFormProps) {
|
||||
// ...content
|
||||
// use direct return of pb.collection (e.g. return pb.collection('Events'))
|
||||
}
|
||||
```
|
30
002_source/cms/src/db/Helloworlds/_GUIDELINES.md
Normal file
30
002_source/cms/src/db/Helloworlds/_GUIDELINES.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# GUIDELINES
|
||||
|
||||
This folder contains test drivers for `Helloworld` records using PocketBase:
|
||||
|
||||
- create (Create.tsx)
|
||||
- read (GetById.tsx)
|
||||
- write (Update.tsx)
|
||||
- count (GetAllCount.tsx)
|
||||
- delete (Delete.tsx)
|
||||
- list (GetAll.tsx)
|
||||
|
||||
the `@` sign refer to `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src`
|
||||
|
||||
## Assumption and Requirements
|
||||
|
||||
- assume `pb` is located in `@/lib/pb`
|
||||
- no need to handle error in this function
|
||||
- type information defined in `@/db/Helloworlds/type.d.tsx`
|
||||
- This is a test collection - keep implementations simple
|
||||
|
||||
simple template:
|
||||
|
||||
```typescript
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export async function createHelloworld(data: CreateFormProps) {
|
||||
// Simple test implementation
|
||||
return pb.collection('Helloworlds').create(data);
|
||||
}
|
||||
```
|
30
002_source/cms/src/db/LessonCategories/_GUIDELINES.md
Normal file
30
002_source/cms/src/db/LessonCategories/_GUIDELINES.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# GUIDELINES
|
||||
|
||||
This folder contains drivers for `LessonCategory`/`LessonCategories` records using PocketBase:
|
||||
|
||||
- create (Create.tsx)
|
||||
- read (GetById.tsx)
|
||||
- write (Update.tsx)
|
||||
- count (GetAllCount.tsx)
|
||||
- delete (Delete.tsx)
|
||||
- list (GetAll.tsx)
|
||||
|
||||
the `@` sign refer to `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src`
|
||||
|
||||
## Assumption and Requirements
|
||||
|
||||
- assume `pb` is located in `@/lib/pb`
|
||||
- no need to handle error in this function, i'll handle it in the caller
|
||||
- type information defined in `@/db/LessonCategories/type.d.tsx`
|
||||
|
||||
simple template:
|
||||
|
||||
```typescript
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_LESSON_CATEGORIES } from '@/constants';
|
||||
|
||||
export async function createLessonCategory(data: CreateFormProps) {
|
||||
// ...content
|
||||
// use direct return of pb.collection (e.g. return pb.collection(xxx))
|
||||
}
|
||||
```
|
30
002_source/cms/src/db/LessonTypes/_GUIDELINES.md
Normal file
30
002_source/cms/src/db/LessonTypes/_GUIDELINES.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# GUIDELINES
|
||||
|
||||
This folder contains drivers for `LessonType`/`LessonTypes` records using PocketBase:
|
||||
|
||||
- create (Create.tsx)
|
||||
- read (GetById.tsx)
|
||||
- write (Update.tsx)
|
||||
- count (GetAllCount.tsx)
|
||||
- delete (Delete.tsx)
|
||||
- list (GetAll.tsx)
|
||||
|
||||
the `@` sign refer to `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src`
|
||||
|
||||
## Assumption and Requirements
|
||||
|
||||
- assume `pb` is located in `@/lib/pb`
|
||||
- no need to handle error in this function, i'll handle it in the caller
|
||||
- type information defined in `@/db/LessonTypes/type.d.tsx`
|
||||
|
||||
simple template:
|
||||
|
||||
```typescript
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_LESSON_TYPES } from '@/constants';
|
||||
|
||||
export async function createLessonType(data: CreateFormProps) {
|
||||
// ...content
|
||||
// use direct return of pb.collection (e.g. return pb.collection(xxx))
|
||||
}
|
||||
```
|
33
002_source/cms/src/db/Messages/_GUIDELINES.md
Normal file
33
002_source/cms/src/db/Messages/_GUIDELINES.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# GUIDELINES
|
||||
|
||||
This folder contains drivers for `Message`/`Messages` records using PocketBase:
|
||||
|
||||
- create (Create.tsx)
|
||||
- read (GetById.tsx)
|
||||
- write (Update.tsx)
|
||||
- count (GetAllCount.tsx)
|
||||
- delete (Delete.tsx)
|
||||
- list (GetAll.tsx)
|
||||
|
||||
the `@` sign refer to `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src`
|
||||
|
||||
## Assumption and Requirements
|
||||
|
||||
- assume `pb` is located in `@/lib/pb`
|
||||
- no need to handle error in this function, i'll handle it in the caller
|
||||
- type information defined in `@/db/Messages/type.d.tsx`
|
||||
- Message records require special handling for:
|
||||
- Sender/receiver validation
|
||||
- Timestamp management
|
||||
- Read status tracking
|
||||
|
||||
simple template:
|
||||
|
||||
```typescript
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export async function createMessage(data: CreateFormProps) {
|
||||
// ...content
|
||||
// use direct return of pb.collection (e.g. return pb.collection('Messages'))
|
||||
}
|
||||
```
|
31
002_source/cms/src/db/QuizCRCategories/_GUIDELINES.md
Normal file
31
002_source/cms/src/db/QuizCRCategories/_GUIDELINES.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# GUIDELINES
|
||||
|
||||
This folder contains drivers for `QuizCRCategory`/`QuizCRCategories` records using PocketBase:
|
||||
|
||||
- create (Create.tsx)
|
||||
- read (GetById.tsx)
|
||||
- write (Update.tsx)
|
||||
- count (GetAllCount.tsx)
|
||||
- delete (Delete.tsx)
|
||||
- list (GetAll.tsx)
|
||||
|
||||
the `@` sign refer to `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src`
|
||||
|
||||
## Assumption and Requirements
|
||||
|
||||
- assume `pb` is located in `@/lib/pb`
|
||||
- no need to handle error in this function, i'll handle it in the caller
|
||||
- type information defined in `@/db/QuizCRCategories/type.d.tsx`
|
||||
- Quiz categories may require additional validation logic
|
||||
|
||||
simple template:
|
||||
|
||||
```typescript
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_QUIZ_CR_CATEGORIES } from '@/constants';
|
||||
|
||||
export async function createQuizCRCategory(data: CreateFormProps) {
|
||||
// ...content
|
||||
// use direct return of pb.collection (e.g. return pb.collection(xxx))
|
||||
}
|
||||
```
|
31
002_source/cms/src/db/QuizLPCategories/_GUIDELINES.md
Normal file
31
002_source/cms/src/db/QuizLPCategories/_GUIDELINES.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# GUIDELINES
|
||||
|
||||
This folder contains drivers for `QuizLPCategory` records using PocketBase:
|
||||
|
||||
- create (Create.tsx)
|
||||
- read (GetById.tsx)
|
||||
- write (Update.tsx)
|
||||
- count (GetAllCount.tsx)
|
||||
- delete (Delete.tsx)
|
||||
- list (GetAll.tsx)
|
||||
|
||||
the `@` sign refer to `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src`
|
||||
|
||||
## Assumption and Requirements
|
||||
|
||||
- assume `pb` is located in `@/lib/pb`
|
||||
- no need to handle error in this function, i'll handle it in the caller
|
||||
- type information defined in `@/db/QuizLPCategories/type.d.tsx`
|
||||
- Quiz LP categories may require additional validation logic
|
||||
|
||||
simple template:
|
||||
|
||||
```typescript
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_QUIZ_LP_CATEGORIES } from '@/constants';
|
||||
|
||||
export async function createQuizLPCategory(data: CreateFormProps) {
|
||||
// ...content
|
||||
// use direct return of pb.collection (e.g. return pb.collection(COL_QUIZ_LP_CATEGORIES))
|
||||
}
|
||||
```
|
@@ -1,18 +0,0 @@
|
||||
please help to review the `tsx` file in this folder
|
||||
`/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/QuizLPCategories`
|
||||
|
||||
it was clone from
|
||||
`MFCategories`
|
||||
please help to modify to
|
||||
`LPCategories`
|
||||
|
||||
please also help to modify the name of
|
||||
`variables`, `constants`, `functions`, `classes`, components's name, paths
|
||||
|
||||
the db fields structures between them are the same
|
||||
|
||||
do not move the files
|
||||
do not create directories
|
||||
keep current folder structure is important
|
||||
|
||||
thanks
|
34
002_source/cms/src/db/QuizLPQuestions/_GUIDELINES.md
Normal file
34
002_source/cms/src/db/QuizLPQuestions/_GUIDELINES.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# GUIDELINES
|
||||
|
||||
This folder contains drivers for `QuizLPQuestion` records using PocketBase:
|
||||
|
||||
- create (Create.tsx)
|
||||
- read (GetById.tsx)
|
||||
- write (Update.tsx)
|
||||
- count (GetAllCount.tsx)
|
||||
- delete (Delete.tsx)
|
||||
- list (GetAll.tsx)
|
||||
|
||||
the `@` sign refer to `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src`
|
||||
|
||||
## Assumption and Requirements
|
||||
|
||||
- assume `pb` is located in `@/lib/pb`
|
||||
- no need to handle error in this function, i'll handle it in the caller
|
||||
- type information defined in `@/db/QuizLPQuestions/type.d.tsx`
|
||||
- Quiz LP questions require special handling for:
|
||||
- Answer validation
|
||||
- Question type checking
|
||||
- Category association
|
||||
|
||||
simple template:
|
||||
|
||||
```typescript
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_QUIZ_LP_QUESTIONS } from '@/constants';
|
||||
|
||||
export async function createQuizLPQuestion(data: CreateFormProps) {
|
||||
// ...content
|
||||
// use direct return of pb.collection (e.g. return pb.collection(COL_QUIZ_LP_QUESTIONS))
|
||||
}
|
||||
```
|
33
002_source/cms/src/db/Subscriptions/_GUIDELINES.md
Normal file
33
002_source/cms/src/db/Subscriptions/_GUIDELINES.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# GUIDELINES
|
||||
|
||||
This folder contains drivers for `Subscription`/`Subscriptions` records using PocketBase:
|
||||
|
||||
- create (Create.tsx)
|
||||
- read (GetById.tsx)
|
||||
- write (Update.tsx)
|
||||
- count (GetAllCount.tsx)
|
||||
- delete (Delete.tsx)
|
||||
- list (GetAll.tsx)
|
||||
|
||||
the `@` sign refer to `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src`
|
||||
|
||||
## Assumption and Requirements
|
||||
|
||||
- assume `pb` is located in `@/lib/pb`
|
||||
- no need to handle error in this function, i'll handle it in the caller
|
||||
- type information defined in `@/db/Subscriptions/type.d.tsx`
|
||||
- Subscription records require special handling for:
|
||||
- Payment status validation
|
||||
- Expiration date checks
|
||||
- Auto-renewal logic
|
||||
|
||||
simple template:
|
||||
|
||||
```typescript
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export async function createSubscription(data: CreateFormProps) {
|
||||
// ...content
|
||||
// use direct return of pb.collection (e.g. return pb.collection('Subscriptions'))
|
||||
}
|
||||
```
|
30
002_source/cms/src/db/UserMetas/_GUIDELINES.md
Normal file
30
002_source/cms/src/db/UserMetas/_GUIDELINES.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# GUIDELINES
|
||||
|
||||
This folder contains drivers for `UserMeta`/`UserMetas` records using PocketBase:
|
||||
|
||||
- create (Create.tsx)
|
||||
- read (GetById.tsx)
|
||||
- write (Update.tsx)
|
||||
- count (GetAllCount.tsx)
|
||||
- delete (Delete.tsx)
|
||||
- list (GetAll.tsx)
|
||||
|
||||
the `@` sign refer to `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src`
|
||||
|
||||
## Assumption and Requirements
|
||||
|
||||
- assume `pb` is located in `@/lib/pb`
|
||||
- no need to handle error in this function, i'll handle it in the caller
|
||||
- type information defined in `@/db/UserMetas/type.d.tsx`
|
||||
|
||||
simple template:
|
||||
|
||||
```typescript
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_USER_METAS } from '@/constants';
|
||||
|
||||
export async function createUserMeta(data: CreateFormProps) {
|
||||
// ...content
|
||||
// use direct return of pb.collection (e.g. return pb.collection(xxx))
|
||||
}
|
||||
```
|
@@ -1,11 +1,11 @@
|
||||
# NOTES
|
||||
# GUIDELINES
|
||||
|
||||
this folder containing driver for `Customer` / `Customers` record:
|
||||
This folder contains drivers for `User`/`Users` records using PocketBase:
|
||||
|
||||
- create (Create.tsx)
|
||||
- read (GetById.tsx)
|
||||
- write (Update.tsx)
|
||||
- count (GetAllCount.tsx, GetHiddenCount.tsx, GetVisibleCount.tsx)
|
||||
- count (GetAllCount.tsx)
|
||||
- delete (Delete.tsx)
|
||||
- list (GetAll.tsx)
|
||||
|
||||
@@ -15,14 +15,15 @@ the `@` sign refer to `/home/logic/_wsl_workspace/001_github_ws/lettersoup-onlin
|
||||
|
||||
- assume `pb` is located in `@/lib/pb`
|
||||
- no need to handle error in this function, i'll handle it in the caller
|
||||
- type information defined in `@/db/Users/type.d.tsx`
|
||||
|
||||
simple template:
|
||||
|
||||
```typescript
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_CUSTOMERS } from '@/constants';
|
||||
import { COL_USERS } from '@/constants';
|
||||
|
||||
export async function createCustomer(data) {
|
||||
export async function createUser(data: CreateFormProps) {
|
||||
// ...content
|
||||
// use direct return of pb.collection (e.g. return pb.collection(xxx))
|
||||
}
|
12508
002_source/cms/src/db/_repomix.md
Normal file
12508
002_source/cms/src/db/_repomix.md
Normal file
File diff suppressed because it is too large
Load Diff
6168
002_source/cms/src/db/repomix-output.xml
Normal file
6168
002_source/cms/src/db/repomix-output.xml
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user