@goscribe/server 1.0.5 → 1.0.7
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/context.d.ts +1 -1
- package/dist/context.d.ts.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/file.d.ts.map +1 -0
- package/dist/lib/prisma.d.ts.map +1 -0
- package/dist/lib/storage.d.ts.map +1 -0
- package/dist/routers/_app.d.ts +268 -10
- package/dist/routers/_app.d.ts.map +1 -0
- package/dist/routers/_app.js +5 -1
- package/dist/routers/auth.d.ts +11 -6
- package/dist/routers/auth.d.ts.map +1 -0
- package/dist/routers/auth.js +15 -1
- package/dist/routers/flashcards.d.ts +124 -0
- package/dist/routers/flashcards.js +127 -0
- package/dist/routers/sample.js +21 -0
- package/dist/routers/worksheets.d.ts +129 -0
- package/dist/routers/worksheets.js +139 -0
- package/dist/routers/workspace.d.ts +3 -3
- package/dist/routers/workspace.d.ts.map +1 -0
- package/dist/routers/workspace.js +50 -36
- package/dist/server.d.ts.map +1 -0
- package/dist/trpc.d.ts +5 -5
- package/dist/trpc.d.ts.map +1 -0
- package/package.json +3 -2
- package/src/context.ts +1 -0
- package/src/lib/auth.ts +17 -5
- package/src/routers/_app.ts +5 -1
- package/src/routers/auth.ts +58 -20
- package/src/routers/flashcards.ts +135 -0
- package/src/routers/studyguide.ts +0 -0
- package/src/routers/worksheets.ts +149 -0
- package/src/routers/workspace.ts +47 -39
- package/src/server.ts +1 -0
package/dist/context.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ export declare function createContext({ req, res }: CreateExpressContextOptions)
|
|
|
4
4
|
session: any;
|
|
5
5
|
req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
|
|
6
6
|
res: import("express").Response<any, Record<string, any>>;
|
|
7
|
-
cookies:
|
|
7
|
+
cookies: any;
|
|
8
8
|
}>;
|
|
9
9
|
export type Context = Awaited<ReturnType<typeof createContext>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAGjF,wBAAsB,aAAa,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,2BAA2B;;;;;GAI5E;AAED,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/lib/auth.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,UAAU,0HA0BnB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/lib/file.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prisma.d.ts","sourceRoot":"","sources":["../../src/lib/prisma.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C,eAAO,MAAM,MAAM,gIAIf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/lib/storage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,eAAO,MAAM,OAAO,SAMlB,CAAC;AAEH,eAAO,MAAM,MAAM,wCAA0C,CAAC"}
|
package/dist/routers/_app.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
5
5
|
session: any;
|
|
6
6
|
req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
|
|
7
7
|
res: import("express").Response<any, Record<string, any>>;
|
|
8
|
-
cookies:
|
|
8
|
+
cookies: any;
|
|
9
9
|
};
|
|
10
10
|
meta: object;
|
|
11
11
|
errorShape: import("@trpc/server").TRPCDefaultErrorShape;
|
|
@@ -17,7 +17,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
17
17
|
session: any;
|
|
18
18
|
req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
|
|
19
19
|
res: import("express").Response<any, Record<string, any>>;
|
|
20
|
-
cookies:
|
|
20
|
+
cookies: any;
|
|
21
21
|
};
|
|
22
22
|
meta: object;
|
|
23
23
|
errorShape: import("@trpc/server").TRPCDefaultErrorShape;
|
|
@@ -42,17 +42,22 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
42
42
|
password: string;
|
|
43
43
|
};
|
|
44
44
|
output: {
|
|
45
|
-
id:
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
id: any;
|
|
46
|
+
session: any;
|
|
47
|
+
user: {
|
|
48
|
+
id: string;
|
|
49
|
+
email: string | null;
|
|
50
|
+
name: string | null;
|
|
51
|
+
image: string | null;
|
|
52
|
+
};
|
|
48
53
|
};
|
|
49
54
|
meta: object;
|
|
50
55
|
}>;
|
|
51
56
|
getSession: import("@trpc/server").TRPCQueryProcedure<{
|
|
52
57
|
input: void;
|
|
53
58
|
output: {
|
|
54
|
-
id:
|
|
55
|
-
userId:
|
|
59
|
+
id: any;
|
|
60
|
+
userId: any;
|
|
56
61
|
user: {
|
|
57
62
|
id: string;
|
|
58
63
|
email: string | null;
|
|
@@ -69,7 +74,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
69
74
|
session: any;
|
|
70
75
|
req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
|
|
71
76
|
res: import("express").Response<any, Record<string, any>>;
|
|
72
|
-
cookies:
|
|
77
|
+
cookies: any;
|
|
73
78
|
};
|
|
74
79
|
meta: object;
|
|
75
80
|
errorShape: import("@trpc/server").TRPCDefaultErrorShape;
|
|
@@ -116,7 +121,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
116
121
|
title: string;
|
|
117
122
|
description: string | null;
|
|
118
123
|
folderId: string | null;
|
|
119
|
-
}
|
|
124
|
+
};
|
|
120
125
|
meta: object;
|
|
121
126
|
}>;
|
|
122
127
|
update: import("@trpc/server").TRPCMutationProcedure<{
|
|
@@ -163,7 +168,260 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
163
168
|
fileId: string[];
|
|
164
169
|
id: string;
|
|
165
170
|
};
|
|
166
|
-
output:
|
|
171
|
+
output: boolean;
|
|
172
|
+
meta: object;
|
|
173
|
+
}>;
|
|
174
|
+
}>>;
|
|
175
|
+
flashcards: import("@trpc/server").TRPCBuiltRouter<{
|
|
176
|
+
ctx: {
|
|
177
|
+
db: import("@prisma/client").PrismaClient<import("@prisma/client").Prisma.PrismaClientOptions, never, import("@prisma/client/runtime/library").DefaultArgs>;
|
|
178
|
+
session: any;
|
|
179
|
+
req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
|
|
180
|
+
res: import("express").Response<any, Record<string, any>>;
|
|
181
|
+
cookies: any;
|
|
182
|
+
};
|
|
183
|
+
meta: object;
|
|
184
|
+
errorShape: import("@trpc/server").TRPCDefaultErrorShape;
|
|
185
|
+
transformer: true;
|
|
186
|
+
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
187
|
+
listSets: import("@trpc/server").TRPCQueryProcedure<{
|
|
188
|
+
input: {
|
|
189
|
+
workspaceId: string;
|
|
190
|
+
};
|
|
191
|
+
output: {
|
|
192
|
+
id: string;
|
|
193
|
+
createdAt: Date;
|
|
194
|
+
updatedAt: Date;
|
|
195
|
+
title: string;
|
|
196
|
+
workspaceId: string;
|
|
197
|
+
type: import("@prisma/client").$Enums.ArtifactType;
|
|
198
|
+
isArchived: boolean;
|
|
199
|
+
createdById: string | null;
|
|
200
|
+
}[];
|
|
201
|
+
meta: object;
|
|
202
|
+
}>;
|
|
203
|
+
createSet: import("@trpc/server").TRPCMutationProcedure<{
|
|
204
|
+
input: {
|
|
205
|
+
workspaceId: string;
|
|
206
|
+
title: string;
|
|
207
|
+
};
|
|
208
|
+
output: {
|
|
209
|
+
id: string;
|
|
210
|
+
createdAt: Date;
|
|
211
|
+
updatedAt: Date;
|
|
212
|
+
title: string;
|
|
213
|
+
workspaceId: string;
|
|
214
|
+
type: import("@prisma/client").$Enums.ArtifactType;
|
|
215
|
+
isArchived: boolean;
|
|
216
|
+
createdById: string | null;
|
|
217
|
+
};
|
|
218
|
+
meta: object;
|
|
219
|
+
}>;
|
|
220
|
+
getSet: import("@trpc/server").TRPCQueryProcedure<{
|
|
221
|
+
input: {
|
|
222
|
+
setId: string;
|
|
223
|
+
};
|
|
224
|
+
output: {
|
|
225
|
+
flashcards: {
|
|
226
|
+
id: string;
|
|
227
|
+
createdAt: Date;
|
|
228
|
+
artifactId: string;
|
|
229
|
+
front: string;
|
|
230
|
+
back: string;
|
|
231
|
+
tags: string[];
|
|
232
|
+
order: number;
|
|
233
|
+
}[];
|
|
234
|
+
} & {
|
|
235
|
+
id: string;
|
|
236
|
+
createdAt: Date;
|
|
237
|
+
updatedAt: Date;
|
|
238
|
+
title: string;
|
|
239
|
+
workspaceId: string;
|
|
240
|
+
type: import("@prisma/client").$Enums.ArtifactType;
|
|
241
|
+
isArchived: boolean;
|
|
242
|
+
createdById: string | null;
|
|
243
|
+
};
|
|
244
|
+
meta: object;
|
|
245
|
+
}>;
|
|
246
|
+
createCard: import("@trpc/server").TRPCMutationProcedure<{
|
|
247
|
+
input: {
|
|
248
|
+
setId: string;
|
|
249
|
+
front: string;
|
|
250
|
+
back: string;
|
|
251
|
+
tags?: string[] | undefined;
|
|
252
|
+
order?: number | undefined;
|
|
253
|
+
};
|
|
254
|
+
output: {
|
|
255
|
+
id: string;
|
|
256
|
+
createdAt: Date;
|
|
257
|
+
artifactId: string;
|
|
258
|
+
front: string;
|
|
259
|
+
back: string;
|
|
260
|
+
tags: string[];
|
|
261
|
+
order: number;
|
|
262
|
+
};
|
|
263
|
+
meta: object;
|
|
264
|
+
}>;
|
|
265
|
+
updateCard: import("@trpc/server").TRPCMutationProcedure<{
|
|
266
|
+
input: {
|
|
267
|
+
cardId: string;
|
|
268
|
+
front?: string | undefined;
|
|
269
|
+
back?: string | undefined;
|
|
270
|
+
tags?: string[] | undefined;
|
|
271
|
+
order?: number | undefined;
|
|
272
|
+
};
|
|
273
|
+
output: {
|
|
274
|
+
id: string;
|
|
275
|
+
createdAt: Date;
|
|
276
|
+
artifactId: string;
|
|
277
|
+
front: string;
|
|
278
|
+
back: string;
|
|
279
|
+
tags: string[];
|
|
280
|
+
order: number;
|
|
281
|
+
};
|
|
282
|
+
meta: object;
|
|
283
|
+
}>;
|
|
284
|
+
deleteCard: import("@trpc/server").TRPCMutationProcedure<{
|
|
285
|
+
input: {
|
|
286
|
+
cardId: string;
|
|
287
|
+
};
|
|
288
|
+
output: boolean;
|
|
289
|
+
meta: object;
|
|
290
|
+
}>;
|
|
291
|
+
deleteSet: import("@trpc/server").TRPCMutationProcedure<{
|
|
292
|
+
input: {
|
|
293
|
+
setId: string;
|
|
294
|
+
};
|
|
295
|
+
output: boolean;
|
|
296
|
+
meta: object;
|
|
297
|
+
}>;
|
|
298
|
+
}>>;
|
|
299
|
+
worksheets: import("@trpc/server").TRPCBuiltRouter<{
|
|
300
|
+
ctx: {
|
|
301
|
+
db: import("@prisma/client").PrismaClient<import("@prisma/client").Prisma.PrismaClientOptions, never, import("@prisma/client/runtime/library").DefaultArgs>;
|
|
302
|
+
session: any;
|
|
303
|
+
req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
|
|
304
|
+
res: import("express").Response<any, Record<string, any>>;
|
|
305
|
+
cookies: any;
|
|
306
|
+
};
|
|
307
|
+
meta: object;
|
|
308
|
+
errorShape: import("@trpc/server").TRPCDefaultErrorShape;
|
|
309
|
+
transformer: true;
|
|
310
|
+
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
311
|
+
listSets: import("@trpc/server").TRPCQueryProcedure<{
|
|
312
|
+
input: {
|
|
313
|
+
workspaceId: string;
|
|
314
|
+
};
|
|
315
|
+
output: {
|
|
316
|
+
id: string;
|
|
317
|
+
createdAt: Date;
|
|
318
|
+
updatedAt: Date;
|
|
319
|
+
title: string;
|
|
320
|
+
workspaceId: string;
|
|
321
|
+
type: import("@prisma/client").$Enums.ArtifactType;
|
|
322
|
+
isArchived: boolean;
|
|
323
|
+
createdById: string | null;
|
|
324
|
+
}[];
|
|
325
|
+
meta: object;
|
|
326
|
+
}>;
|
|
327
|
+
createSet: import("@trpc/server").TRPCMutationProcedure<{
|
|
328
|
+
input: {
|
|
329
|
+
workspaceId: string;
|
|
330
|
+
title: string;
|
|
331
|
+
};
|
|
332
|
+
output: {
|
|
333
|
+
id: string;
|
|
334
|
+
createdAt: Date;
|
|
335
|
+
updatedAt: Date;
|
|
336
|
+
title: string;
|
|
337
|
+
workspaceId: string;
|
|
338
|
+
type: import("@prisma/client").$Enums.ArtifactType;
|
|
339
|
+
isArchived: boolean;
|
|
340
|
+
createdById: string | null;
|
|
341
|
+
};
|
|
342
|
+
meta: object;
|
|
343
|
+
}>;
|
|
344
|
+
getSet: import("@trpc/server").TRPCQueryProcedure<{
|
|
345
|
+
input: {
|
|
346
|
+
setId: string;
|
|
347
|
+
};
|
|
348
|
+
output: {
|
|
349
|
+
questions: {
|
|
350
|
+
meta: import("@prisma/client/runtime/library").JsonValue | null;
|
|
351
|
+
id: string;
|
|
352
|
+
createdAt: Date;
|
|
353
|
+
artifactId: string;
|
|
354
|
+
order: number;
|
|
355
|
+
prompt: string;
|
|
356
|
+
answer: string | null;
|
|
357
|
+
difficulty: import("@prisma/client").$Enums.Difficulty;
|
|
358
|
+
}[];
|
|
359
|
+
} & {
|
|
360
|
+
id: string;
|
|
361
|
+
createdAt: Date;
|
|
362
|
+
updatedAt: Date;
|
|
363
|
+
title: string;
|
|
364
|
+
workspaceId: string;
|
|
365
|
+
type: import("@prisma/client").$Enums.ArtifactType;
|
|
366
|
+
isArchived: boolean;
|
|
367
|
+
createdById: string | null;
|
|
368
|
+
};
|
|
369
|
+
meta: object;
|
|
370
|
+
}>;
|
|
371
|
+
createQuestion: import("@trpc/server").TRPCMutationProcedure<{
|
|
372
|
+
input: {
|
|
373
|
+
setId: string;
|
|
374
|
+
prompt: string;
|
|
375
|
+
answer?: string | undefined;
|
|
376
|
+
difficulty?: "EASY" | "MEDIUM" | "HARD" | undefined;
|
|
377
|
+
order?: number | undefined;
|
|
378
|
+
meta?: Record<string, unknown> | undefined;
|
|
379
|
+
};
|
|
380
|
+
output: {
|
|
381
|
+
meta: import("@prisma/client/runtime/library").JsonValue | null;
|
|
382
|
+
id: string;
|
|
383
|
+
createdAt: Date;
|
|
384
|
+
artifactId: string;
|
|
385
|
+
order: number;
|
|
386
|
+
prompt: string;
|
|
387
|
+
answer: string | null;
|
|
388
|
+
difficulty: import("@prisma/client").$Enums.Difficulty;
|
|
389
|
+
};
|
|
390
|
+
meta: object;
|
|
391
|
+
}>;
|
|
392
|
+
updateQuestion: import("@trpc/server").TRPCMutationProcedure<{
|
|
393
|
+
input: {
|
|
394
|
+
questionId: string;
|
|
395
|
+
prompt?: string | undefined;
|
|
396
|
+
answer?: string | undefined;
|
|
397
|
+
difficulty?: "EASY" | "MEDIUM" | "HARD" | undefined;
|
|
398
|
+
order?: number | undefined;
|
|
399
|
+
meta?: Record<string, unknown> | undefined;
|
|
400
|
+
};
|
|
401
|
+
output: {
|
|
402
|
+
meta: import("@prisma/client/runtime/library").JsonValue | null;
|
|
403
|
+
id: string;
|
|
404
|
+
createdAt: Date;
|
|
405
|
+
artifactId: string;
|
|
406
|
+
order: number;
|
|
407
|
+
prompt: string;
|
|
408
|
+
answer: string | null;
|
|
409
|
+
difficulty: import("@prisma/client").$Enums.Difficulty;
|
|
410
|
+
};
|
|
411
|
+
meta: object;
|
|
412
|
+
}>;
|
|
413
|
+
deleteQuestion: import("@trpc/server").TRPCMutationProcedure<{
|
|
414
|
+
input: {
|
|
415
|
+
questionId: string;
|
|
416
|
+
};
|
|
417
|
+
output: boolean;
|
|
418
|
+
meta: object;
|
|
419
|
+
}>;
|
|
420
|
+
deleteSet: import("@trpc/server").TRPCMutationProcedure<{
|
|
421
|
+
input: {
|
|
422
|
+
setId: string;
|
|
423
|
+
};
|
|
424
|
+
output: boolean;
|
|
167
425
|
meta: object;
|
|
168
426
|
}>;
|
|
169
427
|
}>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_app.d.ts","sourceRoot":"","sources":["../../src/routers/_app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAKrE,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGpB,CAAC;AAGH,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC;AACzC,MAAM,MAAM,YAAY,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;AACxD,MAAM,MAAM,aAAa,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC"}
|
package/dist/routers/_app.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { router } from '../trpc.js';
|
|
2
2
|
import { auth } from './auth.js';
|
|
3
3
|
import { workspace } from './workspace.js';
|
|
4
|
+
import { flashcards } from './flashcards';
|
|
5
|
+
import { worksheets } from './worksheets';
|
|
4
6
|
export const appRouter = router({
|
|
5
7
|
auth,
|
|
6
|
-
workspace
|
|
8
|
+
workspace,
|
|
9
|
+
flashcards,
|
|
10
|
+
worksheets,
|
|
7
11
|
});
|
package/dist/routers/auth.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export declare const auth: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4
4
|
session: any;
|
|
5
5
|
req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
|
|
6
6
|
res: import("express").Response<any, Record<string, any>>;
|
|
7
|
-
cookies:
|
|
7
|
+
cookies: any;
|
|
8
8
|
};
|
|
9
9
|
meta: object;
|
|
10
10
|
errorShape: import("@trpc/server").TRPCDefaultErrorShape;
|
|
@@ -29,17 +29,22 @@ export declare const auth: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
29
29
|
password: string;
|
|
30
30
|
};
|
|
31
31
|
output: {
|
|
32
|
-
id:
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
id: any;
|
|
33
|
+
session: any;
|
|
34
|
+
user: {
|
|
35
|
+
id: string;
|
|
36
|
+
email: string | null;
|
|
37
|
+
name: string | null;
|
|
38
|
+
image: string | null;
|
|
39
|
+
};
|
|
35
40
|
};
|
|
36
41
|
meta: object;
|
|
37
42
|
}>;
|
|
38
43
|
getSession: import("@trpc/server").TRPCQueryProcedure<{
|
|
39
44
|
input: void;
|
|
40
45
|
output: {
|
|
41
|
-
id:
|
|
42
|
-
userId:
|
|
46
|
+
id: any;
|
|
47
|
+
userId: any;
|
|
43
48
|
user: {
|
|
44
49
|
id: string;
|
|
45
50
|
email: string | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/routers/auth.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;GA4Bf,CAAC"}
|
package/dist/routers/auth.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { router, publicProcedure } from '../trpc.js';
|
|
3
3
|
import bcrypt from 'bcryptjs';
|
|
4
|
+
import { serialize } from 'cookie';
|
|
4
5
|
export const auth = router({
|
|
5
6
|
signup: publicProcedure
|
|
6
7
|
.input(z.object({
|
|
@@ -42,7 +43,13 @@ export const auth = router({
|
|
|
42
43
|
if (!valid) {
|
|
43
44
|
throw new Error("Invalid credentials");
|
|
44
45
|
}
|
|
45
|
-
|
|
46
|
+
const session = await ctx.db.session.create({
|
|
47
|
+
data: {
|
|
48
|
+
userId: user.id,
|
|
49
|
+
expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30),
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
return { id: session.id, session: session.id, user: { id: user.id, email: user.email, name: user.name, image: user.image } };
|
|
46
53
|
}),
|
|
47
54
|
getSession: publicProcedure.query(async ({ ctx }) => {
|
|
48
55
|
const session = await ctx.db.session.findUnique({
|
|
@@ -62,6 +69,13 @@ export const auth = router({
|
|
|
62
69
|
if (!user) {
|
|
63
70
|
throw new Error("User not found");
|
|
64
71
|
}
|
|
72
|
+
ctx.res.setHeader("Set-Cookie", serialize("auth_token", session.id, {
|
|
73
|
+
httpOnly: true,
|
|
74
|
+
secure: process.env.NODE_ENV === "production",
|
|
75
|
+
sameSite: "none", // cross-origin XHR needs None
|
|
76
|
+
path: "/",
|
|
77
|
+
maxAge: 60 * 60 * 24 * 7,
|
|
78
|
+
}));
|
|
65
79
|
return { id: session.id, userId: session.userId, user: { id: user.id, email: user.email, name: user.name, image: user.image } };
|
|
66
80
|
}),
|
|
67
81
|
});
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export declare const flashcards: import("@trpc/server").TRPCBuiltRouter<{
|
|
2
|
+
ctx: {
|
|
3
|
+
db: import("@prisma/client").PrismaClient<import("@prisma/client").Prisma.PrismaClientOptions, never, import("@prisma/client/runtime/library").DefaultArgs>;
|
|
4
|
+
session: any;
|
|
5
|
+
req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
|
|
6
|
+
res: import("express").Response<any, Record<string, any>>;
|
|
7
|
+
cookies: any;
|
|
8
|
+
};
|
|
9
|
+
meta: object;
|
|
10
|
+
errorShape: import("@trpc/server").TRPCDefaultErrorShape;
|
|
11
|
+
transformer: true;
|
|
12
|
+
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
13
|
+
listSets: import("@trpc/server").TRPCQueryProcedure<{
|
|
14
|
+
input: {
|
|
15
|
+
workspaceId: string;
|
|
16
|
+
};
|
|
17
|
+
output: {
|
|
18
|
+
id: string;
|
|
19
|
+
createdAt: Date;
|
|
20
|
+
updatedAt: Date;
|
|
21
|
+
title: string;
|
|
22
|
+
workspaceId: string;
|
|
23
|
+
type: import("@prisma/client").$Enums.ArtifactType;
|
|
24
|
+
isArchived: boolean;
|
|
25
|
+
createdById: string | null;
|
|
26
|
+
}[];
|
|
27
|
+
meta: object;
|
|
28
|
+
}>;
|
|
29
|
+
createSet: import("@trpc/server").TRPCMutationProcedure<{
|
|
30
|
+
input: {
|
|
31
|
+
workspaceId: string;
|
|
32
|
+
title: string;
|
|
33
|
+
};
|
|
34
|
+
output: {
|
|
35
|
+
id: string;
|
|
36
|
+
createdAt: Date;
|
|
37
|
+
updatedAt: Date;
|
|
38
|
+
title: string;
|
|
39
|
+
workspaceId: string;
|
|
40
|
+
type: import("@prisma/client").$Enums.ArtifactType;
|
|
41
|
+
isArchived: boolean;
|
|
42
|
+
createdById: string | null;
|
|
43
|
+
};
|
|
44
|
+
meta: object;
|
|
45
|
+
}>;
|
|
46
|
+
getSet: import("@trpc/server").TRPCQueryProcedure<{
|
|
47
|
+
input: {
|
|
48
|
+
setId: string;
|
|
49
|
+
};
|
|
50
|
+
output: {
|
|
51
|
+
flashcards: {
|
|
52
|
+
id: string;
|
|
53
|
+
createdAt: Date;
|
|
54
|
+
artifactId: string;
|
|
55
|
+
front: string;
|
|
56
|
+
back: string;
|
|
57
|
+
tags: string[];
|
|
58
|
+
order: number;
|
|
59
|
+
}[];
|
|
60
|
+
} & {
|
|
61
|
+
id: string;
|
|
62
|
+
createdAt: Date;
|
|
63
|
+
updatedAt: Date;
|
|
64
|
+
title: string;
|
|
65
|
+
workspaceId: string;
|
|
66
|
+
type: import("@prisma/client").$Enums.ArtifactType;
|
|
67
|
+
isArchived: boolean;
|
|
68
|
+
createdById: string | null;
|
|
69
|
+
};
|
|
70
|
+
meta: object;
|
|
71
|
+
}>;
|
|
72
|
+
createCard: import("@trpc/server").TRPCMutationProcedure<{
|
|
73
|
+
input: {
|
|
74
|
+
setId: string;
|
|
75
|
+
front: string;
|
|
76
|
+
back: string;
|
|
77
|
+
tags?: string[] | undefined;
|
|
78
|
+
order?: number | undefined;
|
|
79
|
+
};
|
|
80
|
+
output: {
|
|
81
|
+
id: string;
|
|
82
|
+
createdAt: Date;
|
|
83
|
+
artifactId: string;
|
|
84
|
+
front: string;
|
|
85
|
+
back: string;
|
|
86
|
+
tags: string[];
|
|
87
|
+
order: number;
|
|
88
|
+
};
|
|
89
|
+
meta: object;
|
|
90
|
+
}>;
|
|
91
|
+
updateCard: import("@trpc/server").TRPCMutationProcedure<{
|
|
92
|
+
input: {
|
|
93
|
+
cardId: string;
|
|
94
|
+
front?: string | undefined;
|
|
95
|
+
back?: string | undefined;
|
|
96
|
+
tags?: string[] | undefined;
|
|
97
|
+
order?: number | undefined;
|
|
98
|
+
};
|
|
99
|
+
output: {
|
|
100
|
+
id: string;
|
|
101
|
+
createdAt: Date;
|
|
102
|
+
artifactId: string;
|
|
103
|
+
front: string;
|
|
104
|
+
back: string;
|
|
105
|
+
tags: string[];
|
|
106
|
+
order: number;
|
|
107
|
+
};
|
|
108
|
+
meta: object;
|
|
109
|
+
}>;
|
|
110
|
+
deleteCard: import("@trpc/server").TRPCMutationProcedure<{
|
|
111
|
+
input: {
|
|
112
|
+
cardId: string;
|
|
113
|
+
};
|
|
114
|
+
output: boolean;
|
|
115
|
+
meta: object;
|
|
116
|
+
}>;
|
|
117
|
+
deleteSet: import("@trpc/server").TRPCMutationProcedure<{
|
|
118
|
+
input: {
|
|
119
|
+
setId: string;
|
|
120
|
+
};
|
|
121
|
+
output: boolean;
|
|
122
|
+
meta: object;
|
|
123
|
+
}>;
|
|
124
|
+
}>>;
|