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