``refactor UserMeta creation and authentication client to improve documentation and type consistency``

This commit is contained in:
louiscklaw
2025-05-15 11:27:02 +08:00
parent c83e8c1b6e
commit 3620837a6a
2 changed files with 12 additions and 14 deletions

View File

@@ -1,11 +1,14 @@
// api method for crate customer record
// RULES:
// TBA
import { pb } from '@/lib/pb';
// src/db/UserMetas/Create.tsx
//
// PURPOSE:
// create user meta
//
import { COL_USER_METAS } from '@/constants';
import type { CreateFormProps } from '@/components/dashboard/user_meta/type.d';
import type { RecordModel } from 'pocketbase';
import { pb } from '@/lib/pb';
import type { CreateFormProps } from '@/components/dashboard/user_meta/type.d';
export async function createUserMeta(data: CreateFormProps): Promise<RecordModel> {
return pb.collection(COL_USER_METAS).create(data);
}

View File

@@ -1,9 +1,12 @@
'use client';
// src/lib/auth/custom/client.ts
//
import { getUserMetaById } from '@/db/UserMetas/GetById';
import type { User } from '@/types/user';
import { logger } from '@/lib/default-logger';
import { pb } from '@/lib/pb';
import type { User } from '@/types/user';
function generateToken(): string {
const arr = new Uint8Array(12);
@@ -11,14 +14,6 @@ function generateToken(): string {
return Array.from(arr, (v) => v.toString(16).padStart(2, '0')).join('');
}
const user_xxx = {
id: 'USR-000',
avatar: '/assets/avatar.png',
firstName: 'Sofia',
lastName: 'Rivers',
email: 'sofia@devias.io',
} satisfies User;
export interface SignUpParams {
firstName: string;
lastName: string;