update,
This commit is contained in:
@@ -37,9 +37,10 @@ import { PropertyItem } from '@/components/core/property-item';
|
||||
import { PropertyList } from '@/components/core/property-list';
|
||||
import { toast } from '@/components/core/toaster';
|
||||
import ErrorDisplay from '@/components/dashboard/error';
|
||||
import { defaultLessonType } from '@/components/dashboard/lesson_type/_constants';
|
||||
// import { getLessonTypeById } from '@/components/dashboard/lesson_type/http-actions';
|
||||
import { LessonTypeDefaultValue, type LessonType } from '@/components/dashboard/lesson_type/ILessonType';
|
||||
import { defaultLessonType } from '@/components/dashboard/lesson_type/interfaces';
|
||||
// import { defaultLessonType } from '@/components/dashboard/lesson_type/interfaces';
|
||||
import { Notifications } from '@/components/dashboard/lesson_type/notifications';
|
||||
import { Payments } from '@/components/dashboard/lesson_type/payments';
|
||||
import type { Address } from '@/components/dashboard/lesson_type/shipping-address';
|
||||
|
@@ -18,8 +18,9 @@ import { logger } from '@/lib/default-logger';
|
||||
import { pb } from '@/lib/pb';
|
||||
import { toast } from '@/components/core/toaster';
|
||||
import ErrorDisplay from '@/components/dashboard/error';
|
||||
import { defaultLessonType } from '@/components/dashboard/lesson_type/_constants';
|
||||
import type { LessonType } from '@/components/dashboard/lesson_type/ILessonType';
|
||||
import { defaultLessonType, emptyLessonType, safeAssignment } from '@/components/dashboard/lesson_type/interfaces';
|
||||
// import { defaultLessonType, emptyLessonType, safeAssignment } from '@/components/dashboard/lesson_type/interfaces';
|
||||
import { LessonTypesFilters } from '@/components/dashboard/lesson_type/lesson-types-filters';
|
||||
import type { Filters } from '@/components/dashboard/lesson_type/lesson-types-filters';
|
||||
import { LessonTypesPagination } from '@/components/dashboard/lesson_type/lesson-types-pagination';
|
||||
|
@@ -4,25 +4,7 @@ import type { RecordModel } from 'pocketbase';
|
||||
import { dayjs } from '@/lib/dayjs';
|
||||
|
||||
import type { LessonType } from './ILessonType';
|
||||
|
||||
export interface LessonTypeEditFormProps {
|
||||
name: string;
|
||||
type: string;
|
||||
pos: number;
|
||||
visible: string;
|
||||
}
|
||||
|
||||
export interface RestLessonTypeUpdateForm {
|
||||
id: string;
|
||||
data: LessonTypeEditFormProps;
|
||||
}
|
||||
|
||||
export interface CreateForm {
|
||||
name: string;
|
||||
type: string;
|
||||
pos: number;
|
||||
visible: string;
|
||||
}
|
||||
import type { CreateForm } from './types';
|
||||
|
||||
export const LessonTypeCreateFormDefault: CreateForm = {
|
||||
name: '',
|
@@ -36,7 +36,10 @@ import { pb } from '@/lib/pb';
|
||||
// import { Option } from '@/components/core/option';
|
||||
import { toast } from '@/components/core/toaster';
|
||||
|
||||
import { CreateForm, LessonTypeCreateFormDefault } from './interfaces';
|
||||
import { LessonTypeCreateFormDefault } from './_constants';
|
||||
import { CreateForm } from './types';
|
||||
|
||||
// import { CreateForm, LessonTypeCreateFormDefault } from './interfaces';
|
||||
|
||||
// import { createLessonType } from './http-actions';
|
||||
// import { LessonTypeCreateForm, LessonTypeCreateFormDefault } from './interfaces';
|
||||
|
@@ -37,10 +37,13 @@ import { pb } from '@/lib/pb';
|
||||
import { toast } from '@/components/core/toaster';
|
||||
import FormLoading from '@/components/loading';
|
||||
|
||||
import { defaultLessonType } from './_constants';
|
||||
// import { getLessonTypeById, updateLessonType } from './http-actions';
|
||||
// TODO: this may be wrong
|
||||
import type { LessonType } from './ILessonType';
|
||||
import { defaultLessonType, type LessonTypeEditFormProps } from './interfaces';
|
||||
import { LessonTypeEditFormProps } from './types';
|
||||
|
||||
// import { defaultLessonType, type LessonTypeEditFormProps } from './interfaces';
|
||||
|
||||
// function fileToBase64(file: Blob): Promise<string> {
|
||||
// return new Promise((resolve, reject) => {
|
||||
|
44
002_source/cms/src/components/dashboard/lesson_type/types.d.ts
vendored
Normal file
44
002_source/cms/src/components/dashboard/lesson_type/types.d.ts
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import { NO_NUM, NO_VALUE } from '@/constants';
|
||||
import type { RecordModel } from 'pocketbase';
|
||||
|
||||
import { dayjs } from '@/lib/dayjs';
|
||||
|
||||
import { defaultLessonType } from './_constants';
|
||||
import type { LessonType } from './ILessonType';
|
||||
|
||||
export interface LessonTypeEditFormProps {
|
||||
name: string;
|
||||
type: string;
|
||||
pos: number;
|
||||
visible: string;
|
||||
}
|
||||
|
||||
export interface RestLessonTypeUpdateForm {
|
||||
id: string;
|
||||
data: LessonTypeEditFormProps;
|
||||
}
|
||||
|
||||
export interface CreateForm {
|
||||
name: string;
|
||||
type: string;
|
||||
pos: number;
|
||||
visible: string;
|
||||
}
|
||||
|
||||
export function safeAssignment(inTemp: LessonType | RecordModel): LessonType {
|
||||
const { id, name, type, pos, visible, createdAt, email, quota, status } = { ...defaultLessonType, ...inTemp };
|
||||
const oCreatedAt = dayjs(createdAt).toDate();
|
||||
|
||||
const output: LessonType = {
|
||||
id,
|
||||
name,
|
||||
type,
|
||||
pos,
|
||||
visible,
|
||||
createdAt: oCreatedAt,
|
||||
email,
|
||||
quota,
|
||||
status,
|
||||
};
|
||||
return output;
|
||||
}
|
Reference in New Issue
Block a user