update user-meta,
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
// RULES:
|
||||
// TBA
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_CUSTOMERS } from '@/constants';
|
||||
import type { CreateFormProps } from '@/components/dashboard/customer/type.d';
|
||||
import { COL_USER_METAS } from '@/constants';
|
||||
import type { CreateFormProps } from '@/components/dashboard/user_meta/type.d';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
|
||||
export async function createCustomer(data: CreateFormProps): Promise<RecordModel> {
|
||||
return pb.collection(COL_CUSTOMERS).create(data);
|
||||
export async function createUserMeta(data: CreateFormProps): Promise<RecordModel> {
|
||||
return pb.collection(COL_USER_METAS).create(data);
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_CUSTOMERS } from '@/constants';
|
||||
import { COL_USER_METAS } from '@/constants';
|
||||
|
||||
export async function deleteCustomer(id: string): Promise<boolean> {
|
||||
return pb.collection(COL_CUSTOMERS).delete(id);
|
||||
export async function deleteUserMeta(id: string): Promise<boolean> {
|
||||
return pb.collection(COL_USER_METAS).delete(id);
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { COL_CUSTOMERS } from '@/constants';
|
||||
import { COL_USER_METAS } from '@/constants';
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default async function GetActiveCount(): Promise<number> {
|
||||
const { totalItems: count } = await pb.collection(COL_CUSTOMERS).getList(1, 1, {
|
||||
const { totalItems: count } = await pb.collection(COL_USER_METAS).getList(1, 1, {
|
||||
filter: 'status = "active"',
|
||||
});
|
||||
return count;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_CUSTOMERS } from '@/constants';
|
||||
import { COL_USER_METAS } from '@/constants';
|
||||
import { RecordModel } from 'pocketbase';
|
||||
|
||||
export async function getAllCustomers(options = {}): Promise<RecordModel[]> {
|
||||
return pb.collection(COL_CUSTOMERS).getFullList(options);
|
||||
export async function getAllUserMetas(options = {}): Promise<RecordModel[]> {
|
||||
return pb.collection(COL_USER_METAS).getFullList(options);
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { COL_CUSTOMERS } from '@/constants';
|
||||
import { COL_USER_METAS } from '@/constants';
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default async function GetBlockedCount(): Promise<number> {
|
||||
const { totalItems: count } = await pb.collection(COL_CUSTOMERS).getList(1, 1, {
|
||||
const { totalItems: count } = await pb.collection(COL_USER_METAS).getList(1, 1, {
|
||||
filter: 'status = "blocked"',
|
||||
});
|
||||
return count;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { pb } from '@/lib/pb';
|
||||
import { COL_CUSTOMERS } from '@/constants';
|
||||
import { COL_USER_METAS } from '@/constants';
|
||||
import { RecordModel } from 'pocketbase';
|
||||
|
||||
export async function getCustomerById(id: string): Promise<RecordModel> {
|
||||
return pb.collection(COL_CUSTOMERS).getOne(id);
|
||||
export async function getUserMetaById(id: string): Promise<RecordModel> {
|
||||
return pb.collection(COL_USER_METAS).getOne(id);
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { COL_CUSTOMERS } from '@/constants';
|
||||
import { COL_USER_METAS } from '@/constants';
|
||||
import { pb } from '@/lib/pb';
|
||||
|
||||
export default async function GetPendingCount(): Promise<number> {
|
||||
const { totalItems: count } = await pb.collection(COL_CUSTOMERS).getList(1, 1, {
|
||||
const { totalItems: count } = await pb.collection(COL_USER_METAS).getList(1, 1, {
|
||||
filter: 'status = "pending"',
|
||||
});
|
||||
return count;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
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<EditFormProps>): Promise<RecordModel> {
|
||||
return pb.collection(COL_CUSTOMERS).update(id, data);
|
||||
return pb.collection(COL_USER_METAS).update(id, data);
|
||||
}
|
||||
|
11
002_source/cms/src/db/UserMetas/_PROMPT.md
Normal file
11
002_source/cms/src/db/UserMetas/_PROMPT.md
Normal file
@@ -0,0 +1,11 @@
|
||||
`working directory`: `/home/logic/_wsl_workspace/001_github_ws/lettersoup-online-ws/lettersoup-online/project/002_source/cms/src/db/UserMetas`
|
||||
|
||||
these files are clone from elsewhere,
|
||||
please help to list `*.tsx.draft` files in `working directory` (e.g. `find`),
|
||||
iterate the files listed in the result.
|
||||
please understand, modify and update the content to handle `UserMeta` record thanks, modify comments/variables/paths/functions name please
|
||||
|
||||
restrict your modifications in working directory only,
|
||||
I will handle all the modification outside this direcotry
|
||||
|
||||
e.g. if `lessonCategories` exist in file, modify it to `userMetas`
|
Reference in New Issue
Block a user