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