suparisma 1.2.2 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -2
- package/dist/generators/coreGenerator.js +200 -15
- package/dist/generators/hookGenerator.js +20 -2
- package/dist/generators/typeGenerator.js +55 -5
- package/dist/index.js +6 -1
- package/package.json +1 -1
- package/tmp/generated-test/hooks/useSuparismaAsset.ts +94 -0
- package/tmp/generated-test/hooks/useSuparismaChapter.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaCourse.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaDeviceSession.ts +94 -0
- package/tmp/generated-test/hooks/useSuparismaEnrollment.ts +92 -0
- package/tmp/generated-test/hooks/useSuparismaLesson.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaLessonPurchase.ts +92 -0
- package/tmp/generated-test/hooks/useSuparismaLessonQuestion.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaPayoutMethod.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaPayoutRequest.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaQuestionOption.ts +92 -0
- package/tmp/generated-test/hooks/useSuparismaSavedPaymentMethod.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaTeacherPayoutInfo.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaThing.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaUser.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaVideoNote.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaWallet.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaWalletTransaction.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaWatchProgress.ts +96 -0
- package/tmp/generated-test/index.ts +140 -0
- package/tmp/generated-test/types/AssetTypes.ts +485 -0
- package/tmp/generated-test/types/ChapterTypes.ts +488 -0
- package/tmp/generated-test/types/CourseTypes.ts +519 -0
- package/tmp/generated-test/types/DeviceSessionTypes.ts +489 -0
- package/tmp/generated-test/types/EnrollmentTypes.ts +495 -0
- package/tmp/generated-test/types/LessonPurchaseTypes.ts +490 -0
- package/tmp/generated-test/types/LessonQuestionTypes.ts +496 -0
- package/tmp/generated-test/types/LessonTypes.ts +517 -0
- package/tmp/generated-test/types/PayoutMethodTypes.ts +517 -0
- package/tmp/generated-test/types/PayoutRequestTypes.ts +528 -0
- package/tmp/generated-test/types/QuestionOptionTypes.ts +479 -0
- package/tmp/generated-test/types/SavedPaymentMethodTypes.ts +497 -0
- package/tmp/generated-test/types/TeacherPayoutInfoTypes.ts +480 -0
- package/tmp/generated-test/types/ThingTypes.ts +482 -0
- package/tmp/generated-test/types/UserTypes.ts +487 -0
- package/tmp/generated-test/types/VideoNoteTypes.ts +489 -0
- package/tmp/generated-test/types/WalletTransactionTypes.ts +505 -0
- package/tmp/generated-test/types/WalletTypes.ts +480 -0
- package/tmp/generated-test/types/WatchProgressTypes.ts +493 -0
- package/tmp/generated-test/utils/core.ts +2306 -0
- package/tmp/generated-test/utils/supabase-client.ts +17 -0
- package/tmp/generated-test2/hooks/useSuparismaAsset.ts +94 -0
- package/tmp/generated-test2/hooks/useSuparismaChapter.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaCourse.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaDeviceSession.ts +94 -0
- package/tmp/generated-test2/hooks/useSuparismaEnrollment.ts +92 -0
- package/tmp/generated-test2/hooks/useSuparismaLesson.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaLessonPurchase.ts +92 -0
- package/tmp/generated-test2/hooks/useSuparismaLessonQuestion.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaPayoutMethod.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaPayoutRequest.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaQuestionOption.ts +92 -0
- package/tmp/generated-test2/hooks/useSuparismaSavedPaymentMethod.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaTeacherPayoutInfo.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaThing.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaUser.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaVideoNote.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaWallet.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaWalletTransaction.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaWatchProgress.ts +96 -0
- package/tmp/generated-test2/index.ts +140 -0
- package/tmp/generated-test2/types/AssetTypes.ts +485 -0
- package/tmp/generated-test2/types/ChapterTypes.ts +488 -0
- package/tmp/generated-test2/types/CourseTypes.ts +522 -0
- package/tmp/generated-test2/types/DeviceSessionTypes.ts +489 -0
- package/tmp/generated-test2/types/EnrollmentTypes.ts +495 -0
- package/tmp/generated-test2/types/LessonPurchaseTypes.ts +490 -0
- package/tmp/generated-test2/types/LessonQuestionTypes.ts +496 -0
- package/tmp/generated-test2/types/LessonTypes.ts +517 -0
- package/tmp/generated-test2/types/PayoutMethodTypes.ts +517 -0
- package/tmp/generated-test2/types/PayoutRequestTypes.ts +528 -0
- package/tmp/generated-test2/types/QuestionOptionTypes.ts +479 -0
- package/tmp/generated-test2/types/SavedPaymentMethodTypes.ts +497 -0
- package/tmp/generated-test2/types/TeacherPayoutInfoTypes.ts +480 -0
- package/tmp/generated-test2/types/ThingTypes.ts +482 -0
- package/tmp/generated-test2/types/UserTypes.ts +490 -0
- package/tmp/generated-test2/types/VideoNoteTypes.ts +489 -0
- package/tmp/generated-test2/types/WalletTransactionTypes.ts +505 -0
- package/tmp/generated-test2/types/WalletTypes.ts +480 -0
- package/tmp/generated-test2/types/WatchProgressTypes.ts +493 -0
- package/tmp/generated-test2/utils/core.ts +2306 -0
- package/tmp/generated-test2/utils/supabase-client.ts +17 -0
- package/tmp/generated-test3/hooks/useSuparismaAsset.ts +94 -0
- package/tmp/generated-test3/hooks/useSuparismaChapter.ts +98 -0
- package/tmp/generated-test3/hooks/useSuparismaCourse.ts +98 -0
- package/tmp/generated-test3/hooks/useSuparismaDeviceSession.ts +94 -0
- package/tmp/generated-test3/hooks/useSuparismaEnrollment.ts +94 -0
- package/tmp/generated-test3/hooks/useSuparismaLesson.ts +98 -0
- package/tmp/generated-test3/hooks/useSuparismaLessonPurchase.ts +94 -0
- package/tmp/generated-test3/hooks/useSuparismaLessonQuestion.ts +98 -0
- package/tmp/generated-test3/hooks/useSuparismaPayoutMethod.ts +96 -0
- package/tmp/generated-test3/hooks/useSuparismaPayoutRequest.ts +96 -0
- package/tmp/generated-test3/hooks/useSuparismaQuestionOption.ts +94 -0
- package/tmp/generated-test3/hooks/useSuparismaSavedPaymentMethod.ts +96 -0
- package/tmp/generated-test3/hooks/useSuparismaTeacherPayoutInfo.ts +98 -0
- package/tmp/generated-test3/hooks/useSuparismaThing.ts +96 -0
- package/tmp/generated-test3/hooks/useSuparismaUser.ts +98 -0
- package/tmp/generated-test3/hooks/useSuparismaVideoNote.ts +98 -0
- package/tmp/generated-test3/hooks/useSuparismaWallet.ts +98 -0
- package/tmp/generated-test3/hooks/useSuparismaWalletTransaction.ts +98 -0
- package/tmp/generated-test3/hooks/useSuparismaWatchProgress.ts +98 -0
- package/tmp/generated-test3/index.ts +140 -0
- package/tmp/generated-test3/types/AssetTypes.ts +485 -0
- package/tmp/generated-test3/types/ChapterTypes.ts +488 -0
- package/tmp/generated-test3/types/CourseTypes.ts +522 -0
- package/tmp/generated-test3/types/DeviceSessionTypes.ts +489 -0
- package/tmp/generated-test3/types/EnrollmentTypes.ts +495 -0
- package/tmp/generated-test3/types/LessonPurchaseTypes.ts +490 -0
- package/tmp/generated-test3/types/LessonQuestionTypes.ts +496 -0
- package/tmp/generated-test3/types/LessonTypes.ts +517 -0
- package/tmp/generated-test3/types/PayoutMethodTypes.ts +517 -0
- package/tmp/generated-test3/types/PayoutRequestTypes.ts +528 -0
- package/tmp/generated-test3/types/QuestionOptionTypes.ts +479 -0
- package/tmp/generated-test3/types/SavedPaymentMethodTypes.ts +497 -0
- package/tmp/generated-test3/types/TeacherPayoutInfoTypes.ts +480 -0
- package/tmp/generated-test3/types/ThingTypes.ts +482 -0
- package/tmp/generated-test3/types/UserTypes.ts +490 -0
- package/tmp/generated-test3/types/VideoNoteTypes.ts +489 -0
- package/tmp/generated-test3/types/WalletTransactionTypes.ts +505 -0
- package/tmp/generated-test3/types/WalletTypes.ts +480 -0
- package/tmp/generated-test3/types/WatchProgressTypes.ts +493 -0
- package/tmp/generated-test3/utils/core.ts +2316 -0
- package/tmp/generated-test3/utils/supabase-client.ts +17 -0
- package/tmp/prisma-test-schema-2.prisma +339 -0
- package/tmp/prisma-test-schema.prisma +317 -0
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
// THIS FILE IS AUTO-GENERATED - DO NOT EDIT DIRECTLY
|
|
2
|
+
// Edit the generator script instead
|
|
3
|
+
|
|
4
|
+
import type { Chapter } from '@prisma/client';
|
|
5
|
+
import type { ModelResult, SuparismaOptions, SearchQuery, SearchState, FilterOperators, IncludeValue } from '../utils/core';
|
|
6
|
+
import type { CourseWithRelations, CourseSelectInput } from './CourseTypes';
|
|
7
|
+
import type { LessonWithRelations, LessonSelectInput } from './LessonTypes';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Extended Chapter type that includes relation fields.
|
|
11
|
+
* This represents the complete shape of Chapter records returned from the database.
|
|
12
|
+
*/
|
|
13
|
+
export interface ChapterWithRelations {
|
|
14
|
+
id: string;
|
|
15
|
+
title: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
order: number;
|
|
18
|
+
courseId: string;
|
|
19
|
+
createdAt: Date;
|
|
20
|
+
updatedAt: Date;
|
|
21
|
+
course?: CourseWithRelations;
|
|
22
|
+
lessons?: LessonWithRelations[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Input type for creating a new Chapter record.
|
|
27
|
+
* Fields with default values are optional and will be filled automatically if not provided.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* // Create a minimal chapter
|
|
31
|
+
* chapter.create({
|
|
32
|
+
* // Required fields only
|
|
33
|
+
* title: string,
|
|
34
|
+
* courseId: string,
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* // Create with optional fields
|
|
39
|
+
* chapter.create({
|
|
40
|
+
* // All fields including optional ones
|
|
41
|
+
* id?: string,
|
|
42
|
+
* title: string,
|
|
43
|
+
* description?: string,
|
|
44
|
+
* });
|
|
45
|
+
*/
|
|
46
|
+
export interface ChapterCreateInput {
|
|
47
|
+
id?: string;
|
|
48
|
+
title: string;
|
|
49
|
+
description?: string;
|
|
50
|
+
order?: number;
|
|
51
|
+
courseId: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Input type for updating an existing Chapter record.
|
|
56
|
+
* All fields are optional since you only need to specify the fields you want to change.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* // Update a chapter's fields
|
|
60
|
+
* chapter.update({
|
|
61
|
+
* where: { id: "123" },
|
|
62
|
+
* data: {
|
|
63
|
+
* id?: string,
|
|
64
|
+
* title: string,
|
|
65
|
+
* }
|
|
66
|
+
* });
|
|
67
|
+
*/
|
|
68
|
+
export type ChapterUpdateInput = Partial<ChapterCreateInput>;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Filter type for querying Chapter records.
|
|
72
|
+
* You can filter by any field in the model using equality or advanced filter operators.
|
|
73
|
+
* Supports OR and AND logical operations for complex queries.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* // Basic filtering
|
|
77
|
+
* chapter.findMany({
|
|
78
|
+
* where: {
|
|
79
|
+
* id: "value",
|
|
80
|
+
* title: "value"
|
|
81
|
+
* }
|
|
82
|
+
* });
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* // Advanced filtering
|
|
86
|
+
* chapter.findMany({
|
|
87
|
+
* where: {
|
|
88
|
+
* // Use advanced operators
|
|
89
|
+
* id: { contains: "partial" }
|
|
90
|
+
* }
|
|
91
|
+
* });
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* // OR conditions - match ANY condition
|
|
95
|
+
* chapter.findMany({
|
|
96
|
+
* where: {
|
|
97
|
+
* OR: [
|
|
98
|
+
* { id: "value1" },
|
|
99
|
+
* { title: { contains: "value2" } }
|
|
100
|
+
* ]
|
|
101
|
+
* }
|
|
102
|
+
* });
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* // AND conditions - match ALL conditions
|
|
106
|
+
* chapter.findMany({
|
|
107
|
+
* where: {
|
|
108
|
+
* AND: [
|
|
109
|
+
* { id: "value1" },
|
|
110
|
+
* { title: { gt: 100 } }
|
|
111
|
+
* ]
|
|
112
|
+
* }
|
|
113
|
+
* });
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* // Complex nested logic
|
|
117
|
+
* chapter.findMany({
|
|
118
|
+
* where: {
|
|
119
|
+
* active: true, // Regular condition (implicit AND)
|
|
120
|
+
* OR: [
|
|
121
|
+
* { role: "admin" },
|
|
122
|
+
* { role: "moderator" }
|
|
123
|
+
* ]
|
|
124
|
+
* }
|
|
125
|
+
* });
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* // Array filtering (for array fields)
|
|
129
|
+
* chapter.findMany({
|
|
130
|
+
* where: {
|
|
131
|
+
* // Array contains specific items
|
|
132
|
+
* lessons?: { has: ["item1", "item2"] }
|
|
133
|
+
* }
|
|
134
|
+
* });
|
|
135
|
+
*/
|
|
136
|
+
export type ChapterWhereInput = {
|
|
137
|
+
id?: string | FilterOperators<string>;
|
|
138
|
+
title?: string | FilterOperators<string>;
|
|
139
|
+
description?: string | FilterOperators<string>;
|
|
140
|
+
order?: number | FilterOperators<number>;
|
|
141
|
+
courseId?: string | FilterOperators<string>;
|
|
142
|
+
createdAt?: Date | FilterOperators<Date>;
|
|
143
|
+
updatedAt?: Date | FilterOperators<Date>;
|
|
144
|
+
} & {
|
|
145
|
+
/** Match ANY of the provided conditions */
|
|
146
|
+
OR?: ChapterWhereInput[];
|
|
147
|
+
/** Match ALL of the provided conditions */
|
|
148
|
+
AND?: ChapterWhereInput[];
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Unique identifier for finding a specific Chapter record.
|
|
153
|
+
* Usually uses the ID field but can be any field marked as @unique in the schema.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* // Find by ID
|
|
157
|
+
* chapter.findUnique({ id: "123" });
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* // Delete by ID
|
|
161
|
+
* chapter.delete({ id: "123" });
|
|
162
|
+
*/
|
|
163
|
+
export type ChapterWhereUniqueInput = {
|
|
164
|
+
id: string;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Sort options for Chapter queries.
|
|
169
|
+
* Specify the field to sort by and the direction ('asc' or 'desc').
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* // Sort by creation date, newest first
|
|
173
|
+
* chapter.findMany({
|
|
174
|
+
* orderBy: { created_at: 'desc' }
|
|
175
|
+
* });
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* // Sort alphabetically
|
|
179
|
+
* chapter.findMany({
|
|
180
|
+
* orderBy: { name: 'asc' }
|
|
181
|
+
* });
|
|
182
|
+
*/
|
|
183
|
+
export type ChapterOrderByInput = {
|
|
184
|
+
[key in keyof ChapterSelectInput]?: 'asc' | 'desc';
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Select specific scalar fields to return from Chapter queries.
|
|
189
|
+
* Relation fields are intentionally excluded; use `include` for relations.
|
|
190
|
+
*/
|
|
191
|
+
export type ChapterSelectInput = {
|
|
192
|
+
id?: boolean;
|
|
193
|
+
title?: boolean;
|
|
194
|
+
description?: boolean;
|
|
195
|
+
order?: boolean;
|
|
196
|
+
courseId?: boolean;
|
|
197
|
+
createdAt?: boolean;
|
|
198
|
+
updatedAt?: boolean;
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Include related records when querying Chapter.
|
|
203
|
+
* Only real Prisma relation fields are allowed here.
|
|
204
|
+
*/
|
|
205
|
+
export type ChapterIncludeInput = {
|
|
206
|
+
course?: IncludeValue | { select?: CourseSelectInput };
|
|
207
|
+
lessons?: IncludeValue | { select?: LessonSelectInput };
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Result type for operations that return a single Chapter record.
|
|
212
|
+
*/
|
|
213
|
+
export type ChapterSingleResult = ModelResult<ChapterWithRelations>;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Result type for operations that return multiple Chapter records.
|
|
217
|
+
*/
|
|
218
|
+
export type ChapterManyResult = ModelResult<ChapterWithRelations[]>;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Configuration options for the Chapter hook.
|
|
222
|
+
* Includes where filters, ordering, pagination, and field selection.
|
|
223
|
+
*/
|
|
224
|
+
export type UseChapterOptions = SuparismaOptions<
|
|
225
|
+
ChapterWhereInput,
|
|
226
|
+
ChapterOrderByInput,
|
|
227
|
+
ChapterSelectInput,
|
|
228
|
+
ChapterIncludeInput
|
|
229
|
+
>;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* The complete API for interacting with Chapter records.
|
|
233
|
+
* This interface defines all available operations and state properties.
|
|
234
|
+
*/
|
|
235
|
+
export interface ChapterHookApi {
|
|
236
|
+
/**
|
|
237
|
+
* Current array of Chapter records.
|
|
238
|
+
* This is automatically updated when:
|
|
239
|
+
* - The initial data is loaded
|
|
240
|
+
* - Mutations are performed (create, update, delete)
|
|
241
|
+
* - Real-time updates are received from other clients
|
|
242
|
+
* - The refresh method is called
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* // Render a list of chapter records
|
|
246
|
+
* const { data } = chapter;
|
|
247
|
+
* return (
|
|
248
|
+
* <ul>
|
|
249
|
+
* {data.map(item => (
|
|
250
|
+
* <li key={item.id}>{item.name}</li>
|
|
251
|
+
* ))}
|
|
252
|
+
* </ul>
|
|
253
|
+
* );
|
|
254
|
+
*/
|
|
255
|
+
data: ChapterWithRelations[];
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Error object if the last operation failed, null otherwise.
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* // Handle potential errors
|
|
262
|
+
* const { error } = chapter;
|
|
263
|
+
* if (error) {
|
|
264
|
+
* return <div>Error: {error.message}</div>;
|
|
265
|
+
* }
|
|
266
|
+
*/
|
|
267
|
+
error: Error | null;
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Boolean indicating if an operation is in progress.
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* // Show loading state
|
|
274
|
+
* const { loading } = chapter;
|
|
275
|
+
* if (loading) {
|
|
276
|
+
* return <div>Loading...</div>;
|
|
277
|
+
* }
|
|
278
|
+
*/
|
|
279
|
+
loading: boolean;
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* The current count of records matching the filter criteria.
|
|
283
|
+
* This automatically updates with the data, including realtime updates.
|
|
284
|
+
* It always reflects the current length of the data array, respecting any filters.
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* // Display the count in the UI
|
|
288
|
+
* const { count } = chapter;
|
|
289
|
+
* return <div>Total records: {count}</div>;
|
|
290
|
+
*/
|
|
291
|
+
count: number;
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Find a single Chapter record by its unique identifier.
|
|
297
|
+
*
|
|
298
|
+
* @param where - The unique identifier to find the record by
|
|
299
|
+
* @returns A promise with the found record or error
|
|
300
|
+
*
|
|
301
|
+
* @example
|
|
302
|
+
* // Find chapter by ID
|
|
303
|
+
* const result = await chapter.findUnique({ id: "123" });
|
|
304
|
+
* if (result.data) {
|
|
305
|
+
* console.log("Found chapter:", result.data);
|
|
306
|
+
* }
|
|
307
|
+
*/
|
|
308
|
+
findUnique: (where: ChapterWhereUniqueInput) => ChapterSingleResult;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Find multiple Chapter records matching the filter criteria.
|
|
312
|
+
* Supports filtering, sorting, and pagination.
|
|
313
|
+
*
|
|
314
|
+
* @param params - Optional query parameters
|
|
315
|
+
* @returns A promise with the matching records or error
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* // Get all chapter records
|
|
319
|
+
* const result = await chapter.findMany();
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* // Filter and sort records
|
|
323
|
+
* const result = await chapter.findMany({
|
|
324
|
+
* where: { active: true },
|
|
325
|
+
* orderBy: { created_at: 'desc' },
|
|
326
|
+
* take: 10,
|
|
327
|
+
* skip: 0
|
|
328
|
+
* });
|
|
329
|
+
*/
|
|
330
|
+
findMany: (params?: {
|
|
331
|
+
where?: ChapterWhereInput;
|
|
332
|
+
orderBy?: ChapterOrderByInput;
|
|
333
|
+
take?: number;
|
|
334
|
+
skip?: number;
|
|
335
|
+
}) => ChapterManyResult;
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Find the first Chapter record matching the filter criteria.
|
|
339
|
+
*
|
|
340
|
+
* @param params - Optional query parameters
|
|
341
|
+
* @returns A promise with the first matching record or error
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* // Find the first active chapter
|
|
345
|
+
* const result = await chapter.findFirst({
|
|
346
|
+
* where: { active: true }
|
|
347
|
+
* });
|
|
348
|
+
*
|
|
349
|
+
* @example
|
|
350
|
+
* // Find the oldest chapter
|
|
351
|
+
* const result = await chapter.findFirst({
|
|
352
|
+
* orderBy: { created_at: 'asc' }
|
|
353
|
+
* });
|
|
354
|
+
*/
|
|
355
|
+
findFirst: (params?: {
|
|
356
|
+
where?: ChapterWhereInput;
|
|
357
|
+
orderBy?: ChapterOrderByInput;
|
|
358
|
+
}) => ChapterSingleResult;
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Create a new Chapter record.
|
|
362
|
+
* Fields with default values are optional and will use their defaults if not provided.
|
|
363
|
+
*
|
|
364
|
+
* @param data - The data for the new record
|
|
365
|
+
* @returns A promise with the created record or error
|
|
366
|
+
*
|
|
367
|
+
* @example
|
|
368
|
+
* // Create a new chapter
|
|
369
|
+
* const result = await chapter.create({
|
|
370
|
+
* title: "value",
|
|
371
|
+
* courseId: "value"
|
|
372
|
+
* });
|
|
373
|
+
*
|
|
374
|
+
* @example
|
|
375
|
+
* // Create with custom ID (overriding default)
|
|
376
|
+
* const result = await chapter.create({
|
|
377
|
+
* id: "custom-id",
|
|
378
|
+
* title: "value"
|
|
379
|
+
* });
|
|
380
|
+
*/
|
|
381
|
+
create: (data: ChapterCreateInput) => ChapterSingleResult;
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Update an existing Chapter record.
|
|
385
|
+
*
|
|
386
|
+
* @param params - Object with the record identifier and fields to update
|
|
387
|
+
* @returns A promise with the updated record or error
|
|
388
|
+
*
|
|
389
|
+
* @example
|
|
390
|
+
* // Update a chapter's fields
|
|
391
|
+
* const result = await chapter.update({
|
|
392
|
+
* where: { id: "123" },
|
|
393
|
+
* data: {
|
|
394
|
+
* id?: "updated value",
|
|
395
|
+
* title: "updated value"
|
|
396
|
+
* }
|
|
397
|
+
* });
|
|
398
|
+
*/
|
|
399
|
+
update: (params: {
|
|
400
|
+
where: ChapterWhereUniqueInput;
|
|
401
|
+
data: ChapterUpdateInput;
|
|
402
|
+
}) => ChapterSingleResult;
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Delete a Chapter record by its unique identifier.
|
|
406
|
+
*
|
|
407
|
+
* @param where - The unique identifier of the record to delete
|
|
408
|
+
* @returns A promise with the deleted record or error
|
|
409
|
+
*
|
|
410
|
+
* @example
|
|
411
|
+
* // Delete a chapter by ID
|
|
412
|
+
* const result = await chapter.delete({ id: "123" });
|
|
413
|
+
* if (result.data) {
|
|
414
|
+
* console.log("Deleted chapter:", result.data);
|
|
415
|
+
* }
|
|
416
|
+
*/
|
|
417
|
+
delete: (where: ChapterWhereUniqueInput) => ChapterSingleResult;
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Delete multiple Chapter records matching the filter criteria.
|
|
421
|
+
*
|
|
422
|
+
* @param params - Optional filter parameters
|
|
423
|
+
* @returns A promise with the count of deleted records or error
|
|
424
|
+
*
|
|
425
|
+
* @example
|
|
426
|
+
* // Delete all inactive chapter records
|
|
427
|
+
* const result = await chapter.deleteMany({
|
|
428
|
+
* where: { active: false }
|
|
429
|
+
* });
|
|
430
|
+
* console.log(`Deleted ${result.count} records`);
|
|
431
|
+
*
|
|
432
|
+
* @example
|
|
433
|
+
* // Delete all chapter records (use with caution!)
|
|
434
|
+
* const result = await chapter.deleteMany();
|
|
435
|
+
*/
|
|
436
|
+
deleteMany: (params?: {
|
|
437
|
+
where?: ChapterWhereInput;
|
|
438
|
+
}) => Promise<{ count: number; error: Error | null }>;
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Create a record if it doesn't exist, or update it if it does.
|
|
442
|
+
*
|
|
443
|
+
* @param params - Object with the identifier, update data, and create data
|
|
444
|
+
* @returns A promise with the created or updated record or error
|
|
445
|
+
*
|
|
446
|
+
* @example
|
|
447
|
+
* // Upsert a chapter by ID
|
|
448
|
+
* const result = await chapter.upsert({
|
|
449
|
+
* where: { id: "123" },
|
|
450
|
+
* update: { name: "Updated Name" },
|
|
451
|
+
* create: {
|
|
452
|
+
* id: "123",
|
|
453
|
+
* name: "New Name",
|
|
454
|
+
* title: "value"
|
|
455
|
+
* }
|
|
456
|
+
* });
|
|
457
|
+
*/
|
|
458
|
+
upsert: (params: {
|
|
459
|
+
where: ChapterWhereUniqueInput;
|
|
460
|
+
update: ChapterUpdateInput;
|
|
461
|
+
create: ChapterCreateInput;
|
|
462
|
+
}) => ChapterSingleResult;
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Manually refresh the data with current filter settings.
|
|
466
|
+
* Useful after external operations or when realtime is disabled.
|
|
467
|
+
*
|
|
468
|
+
* @param params - Optional override parameters for this specific refresh
|
|
469
|
+
* @returns A promise with the refreshed data or error
|
|
470
|
+
*
|
|
471
|
+
* @example
|
|
472
|
+
* // Refresh with current filter settings
|
|
473
|
+
* await chapter.refresh();
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
* // Refresh with different filters for this call only
|
|
477
|
+
* await chapter.refresh({
|
|
478
|
+
* where: { active: true },
|
|
479
|
+
* orderBy: { name: 'asc' }
|
|
480
|
+
* });
|
|
481
|
+
*/
|
|
482
|
+
refresh: (params?: {
|
|
483
|
+
where?: ChapterWhereInput;
|
|
484
|
+
orderBy?: ChapterOrderByInput;
|
|
485
|
+
take?: number;
|
|
486
|
+
skip?: number;
|
|
487
|
+
}) => ChapterManyResult;
|
|
488
|
+
}
|