@studious-lms/server 1.1.3 → 1.1.5
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/index.js +99 -4
- package/dist/lib/fileUpload.d.ts +5 -0
- package/dist/lib/fileUpload.d.ts.map +1 -1
- package/dist/lib/fileUpload.js +19 -3
- package/dist/lib/googleCloudStorage.d.ts +2 -1
- package/dist/lib/googleCloudStorage.d.ts.map +1 -1
- package/dist/lib/googleCloudStorage.js +12 -5
- package/dist/routers/_app.d.ts +78 -22
- package/dist/routers/_app.d.ts.map +1 -1
- package/dist/routers/auth.d.ts.map +1 -1
- package/dist/routers/auth.js +9 -1
- package/dist/routers/user.d.ts +39 -11
- package/dist/routers/user.d.ts.map +1 -1
- package/dist/routers/user.js +185 -25
- package/package.json +1 -1
- package/prisma/migrations/20250920143543_add_profile_fields/migration.sql +15 -0
- package/prisma/schema.prisma +10 -1
- package/src/index.ts +111 -4
- package/src/lib/fileUpload.ts +30 -4
- package/src/lib/googleCloudStorage.ts +14 -5
- package/src/routers/auth.ts +9 -1
- package/src/routers/user.ts +200 -25
package/dist/index.js
CHANGED
|
@@ -8,13 +8,56 @@ import { appRouter } from './routers/_app.js';
|
|
|
8
8
|
import { createTRPCContext, createCallerFactory } from './trpc.js';
|
|
9
9
|
import { logger } from './utils/logger.js';
|
|
10
10
|
import { setupSocketHandlers } from './socket/handlers.js';
|
|
11
|
+
import { bucket } from './lib/googleCloudStorage.js';
|
|
11
12
|
dotenv.config();
|
|
12
13
|
const app = express();
|
|
13
14
|
// CORS middleware
|
|
14
15
|
app.use(cors({
|
|
15
|
-
origin: [
|
|
16
|
+
origin: [
|
|
17
|
+
'http://localhost:3000', // Frontend development server
|
|
18
|
+
'http://localhost:3001', // Server port
|
|
19
|
+
'http://127.0.0.1:3000', // Alternative localhost
|
|
20
|
+
'http://127.0.0.1:3001', // Alternative localhost
|
|
21
|
+
process.env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000'
|
|
22
|
+
],
|
|
16
23
|
credentials: true,
|
|
24
|
+
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
|
|
25
|
+
allowedHeaders: ['Content-Type', 'Authorization', 'X-Requested-With', 'x-user'],
|
|
26
|
+
optionsSuccessStatus: 200
|
|
17
27
|
}));
|
|
28
|
+
// Handle preflight OPTIONS requests
|
|
29
|
+
app.options('*', (req, res) => {
|
|
30
|
+
const allowedOrigins = [
|
|
31
|
+
'http://localhost:3000',
|
|
32
|
+
'http://localhost:3001',
|
|
33
|
+
'http://127.0.0.1:3000',
|
|
34
|
+
'http://127.0.0.1:3001',
|
|
35
|
+
process.env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000'
|
|
36
|
+
];
|
|
37
|
+
const origin = req.headers.origin;
|
|
38
|
+
if (origin && allowedOrigins.includes(origin)) {
|
|
39
|
+
res.header('Access-Control-Allow-Origin', origin);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
res.header('Access-Control-Allow-Origin', 'http://localhost:3000');
|
|
43
|
+
}
|
|
44
|
+
res.header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
|
|
45
|
+
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, X-Requested-With, x-user');
|
|
46
|
+
res.header('Access-Control-Allow-Credentials', 'true');
|
|
47
|
+
res.sendStatus(200);
|
|
48
|
+
});
|
|
49
|
+
// CORS debugging middleware
|
|
50
|
+
app.use((req, res, next) => {
|
|
51
|
+
if (req.method === 'OPTIONS' || req.path.includes('trpc')) {
|
|
52
|
+
logger.info('CORS Request', {
|
|
53
|
+
method: req.method,
|
|
54
|
+
path: req.path,
|
|
55
|
+
origin: req.headers.origin,
|
|
56
|
+
userAgent: req.headers['user-agent']
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
next();
|
|
60
|
+
});
|
|
18
61
|
// Response time logging middleware
|
|
19
62
|
app.use((req, res, next) => {
|
|
20
63
|
const start = Date.now();
|
|
@@ -34,10 +77,16 @@ const httpServer = createServer(app);
|
|
|
34
77
|
// Setup Socket.IO
|
|
35
78
|
const io = new Server(httpServer, {
|
|
36
79
|
cors: {
|
|
37
|
-
origin:
|
|
38
|
-
|
|
80
|
+
origin: [
|
|
81
|
+
'http://localhost:3000', // Frontend development server
|
|
82
|
+
'http://localhost:3001', // Server port
|
|
83
|
+
'http://127.0.0.1:3000', // Alternative localhost
|
|
84
|
+
'http://127.0.0.1:3001', // Alternative localhost
|
|
85
|
+
process.env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000'
|
|
86
|
+
],
|
|
87
|
+
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
|
|
39
88
|
credentials: true,
|
|
40
|
-
allowedHeaders: ['Access-Control-Allow-Origin']
|
|
89
|
+
allowedHeaders: ['Content-Type', 'Authorization', 'X-Requested-With', 'Access-Control-Allow-Origin', 'x-user']
|
|
41
90
|
},
|
|
42
91
|
transports: ['websocket', 'polling'],
|
|
43
92
|
pingTimeout: 60000,
|
|
@@ -52,6 +101,42 @@ io.engine.on('connection_error', (err) => {
|
|
|
52
101
|
});
|
|
53
102
|
// Setup socket handlers
|
|
54
103
|
setupSocketHandlers(io);
|
|
104
|
+
// File serving endpoint for secure file access
|
|
105
|
+
app.get('/api/files/:filePath', async (req, res) => {
|
|
106
|
+
try {
|
|
107
|
+
const filePath = decodeURIComponent(req.params.filePath);
|
|
108
|
+
console.log('File request:', { filePath, originalPath: req.params.filePath });
|
|
109
|
+
// Get file from Google Cloud Storage
|
|
110
|
+
const file = bucket.file(filePath);
|
|
111
|
+
const [exists] = await file.exists();
|
|
112
|
+
console.log('File exists:', exists, 'for path:', filePath);
|
|
113
|
+
if (!exists) {
|
|
114
|
+
return res.status(404).json({ error: 'File not found', filePath });
|
|
115
|
+
}
|
|
116
|
+
// Get file metadata
|
|
117
|
+
const [metadata] = await file.getMetadata();
|
|
118
|
+
// Set appropriate headers
|
|
119
|
+
res.set({
|
|
120
|
+
'Content-Type': metadata.contentType || 'application/octet-stream',
|
|
121
|
+
'Content-Length': metadata.size,
|
|
122
|
+
'Cache-Control': 'public, max-age=31536000', // 1 year cache
|
|
123
|
+
'ETag': metadata.etag,
|
|
124
|
+
});
|
|
125
|
+
// Stream file to response
|
|
126
|
+
const stream = file.createReadStream();
|
|
127
|
+
stream.pipe(res);
|
|
128
|
+
stream.on('error', (error) => {
|
|
129
|
+
console.error('Error streaming file:', error);
|
|
130
|
+
if (!res.headersSent) {
|
|
131
|
+
res.status(500).json({ error: 'Error streaming file' });
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
console.error('Error serving file:', error);
|
|
137
|
+
res.status(500).json({ error: 'Internal server error' });
|
|
138
|
+
}
|
|
139
|
+
});
|
|
55
140
|
// Create caller
|
|
56
141
|
const createCaller = createCallerFactory(appRouter);
|
|
57
142
|
// Setup tRPC middleware
|
|
@@ -75,3 +160,13 @@ logger.info('Configurations', {
|
|
|
75
160
|
NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
|
|
76
161
|
LOG_MODE: process.env.LOG_MODE,
|
|
77
162
|
});
|
|
163
|
+
// Log CORS configuration
|
|
164
|
+
logger.info('CORS Configuration', {
|
|
165
|
+
allowedOrigins: [
|
|
166
|
+
'http://localhost:3000',
|
|
167
|
+
'http://localhost:3001',
|
|
168
|
+
'http://127.0.0.1:3000',
|
|
169
|
+
'http://127.0.0.1:3001',
|
|
170
|
+
process.env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000'
|
|
171
|
+
]
|
|
172
|
+
});
|
package/dist/lib/fileUpload.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileUpload.d.ts","sourceRoot":"","sources":["../../src/lib/fileUpload.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CA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AW,CAC/B,KAAK,EAAE,QAAQ,EAAE,EACjB,MAAM,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,YAAY,EAAE,CAAC,CAWzB;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAUlE"}
|
package/dist/lib/fileUpload.js
CHANGED
|
@@ -13,8 +13,22 @@ import { prisma } from "./prisma.js";
|
|
|
13
13
|
*/
|
|
14
14
|
export async function uploadFile(file, userId, directory, assignmentId) {
|
|
15
15
|
try {
|
|
16
|
+
// Validate file extension matches MIME type
|
|
17
|
+
const fileExtension = file.name.split('.').pop()?.toLowerCase();
|
|
18
|
+
const mimeType = file.type.toLowerCase();
|
|
19
|
+
const extensionMimeMap = {
|
|
20
|
+
'jpg': ['image/jpeg'],
|
|
21
|
+
'jpeg': ['image/jpeg'],
|
|
22
|
+
'png': ['image/png'],
|
|
23
|
+
'gif': ['image/gif'],
|
|
24
|
+
'webp': ['image/webp']
|
|
25
|
+
};
|
|
26
|
+
if (fileExtension && extensionMimeMap[fileExtension]) {
|
|
27
|
+
if (!extensionMimeMap[fileExtension].includes(mimeType)) {
|
|
28
|
+
throw new Error(`File extension .${fileExtension} does not match MIME type ${mimeType}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
16
31
|
// Create a unique filename
|
|
17
|
-
const fileExtension = file.name.split('.').pop();
|
|
18
32
|
const uniqueFilename = `${uuidv4()}.${fileExtension}`;
|
|
19
33
|
// // Construct the full path
|
|
20
34
|
const filePath = directory
|
|
@@ -25,8 +39,9 @@ export async function uploadFile(file, userId, directory, assignmentId) {
|
|
|
25
39
|
// // Generate and store thumbnail if supported
|
|
26
40
|
let thumbnailId;
|
|
27
41
|
try {
|
|
28
|
-
//
|
|
29
|
-
|
|
42
|
+
// // Convert base64 to buffer for thumbnail generation
|
|
43
|
+
// Handle both data URI format (data:image/jpeg;base64,...) and raw base64
|
|
44
|
+
const base64Data = file.data.includes(',') ? file.data.split(',')[1] : file.data;
|
|
30
45
|
const fileBuffer = Buffer.from(base64Data, 'base64');
|
|
31
46
|
// // Generate thumbnail directly from buffer
|
|
32
47
|
const thumbnailBuffer = await generateMediaThumbnail(fileBuffer, file.type);
|
|
@@ -52,6 +67,7 @@ export async function uploadFile(file, userId, directory, assignmentId) {
|
|
|
52
67
|
}
|
|
53
68
|
catch (error) {
|
|
54
69
|
console.warn('Failed to generate thumbnail:', error);
|
|
70
|
+
// Continue without thumbnail - this is not a critical failure
|
|
55
71
|
}
|
|
56
72
|
// Create file record in database
|
|
57
73
|
// const uploadedPath = '/dummyPath' + Math.random().toString(36).substring(2, 15);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare const bucket: import("@google-cloud/storage").Bucket;
|
|
1
2
|
/**
|
|
2
3
|
* Uploads a file to Google Cloud Storage
|
|
3
4
|
* @param base64Data Base64 encoded file data
|
|
@@ -11,7 +12,7 @@ export declare function uploadFile(base64Data: string, filePath: string, content
|
|
|
11
12
|
* @param filePath The path of the file in the bucket
|
|
12
13
|
* @returns The signed URL
|
|
13
14
|
*/
|
|
14
|
-
export declare function getSignedUrl(filePath: string): Promise<string>;
|
|
15
|
+
export declare function getSignedUrl(filePath: string, action?: 'read' | 'write', contentType?: string): Promise<string>;
|
|
15
16
|
/**
|
|
16
17
|
* Deletes a file from Google Cloud Storage
|
|
17
18
|
* @param filePath The path of the file to delete
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"googleCloudStorage.d.ts","sourceRoot":"","sources":["../../src/lib/googleCloudStorage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"googleCloudStorage.d.ts","sourceRoot":"","sources":["../../src/lib/googleCloudStorage.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,MAAM,wCAAwD,CAAC;AAK5E;;;;;;GAMG;AACH,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CA4BjB;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,OAAgB,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAsB7H;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAUhE"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import dotenv from 'dotenv';
|
|
2
|
+
dotenv.config();
|
|
1
3
|
import { Storage } from '@google-cloud/storage';
|
|
2
4
|
import { TRPCError } from '@trpc/server';
|
|
3
5
|
const storage = new Storage({
|
|
@@ -7,7 +9,7 @@ const storage = new Storage({
|
|
|
7
9
|
private_key: process.env.GOOGLE_CLOUD_PRIVATE_KEY?.replace(/\\n/g, '\n'),
|
|
8
10
|
},
|
|
9
11
|
});
|
|
10
|
-
const bucket = storage.bucket(process.env.GOOGLE_CLOUD_BUCKET_NAME
|
|
12
|
+
export const bucket = storage.bucket(process.env.GOOGLE_CLOUD_BUCKET_NAME);
|
|
11
13
|
// Short expiration time for signed URLs (5 minutes)
|
|
12
14
|
const SIGNED_URL_EXPIRATION = 5 * 60 * 1000;
|
|
13
15
|
/**
|
|
@@ -48,13 +50,18 @@ export async function uploadFile(base64Data, filePath, contentType) {
|
|
|
48
50
|
* @param filePath The path of the file in the bucket
|
|
49
51
|
* @returns The signed URL
|
|
50
52
|
*/
|
|
51
|
-
export async function getSignedUrl(filePath) {
|
|
53
|
+
export async function getSignedUrl(filePath, action = 'read', contentType) {
|
|
52
54
|
try {
|
|
53
|
-
const
|
|
55
|
+
const options = {
|
|
54
56
|
version: 'v4',
|
|
55
|
-
action:
|
|
57
|
+
action: action,
|
|
56
58
|
expires: Date.now() + SIGNED_URL_EXPIRATION,
|
|
57
|
-
}
|
|
59
|
+
};
|
|
60
|
+
// For write operations, add content type if provided
|
|
61
|
+
if (action === 'write' && contentType) {
|
|
62
|
+
options.contentType = contentType;
|
|
63
|
+
}
|
|
64
|
+
const [url] = await bucket.file(filePath).getSignedUrl(options);
|
|
58
65
|
return url;
|
|
59
66
|
}
|
|
60
67
|
catch (error) {
|
package/dist/routers/_app.d.ts
CHANGED
|
@@ -2164,29 +2164,57 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
2164
2164
|
id: string;
|
|
2165
2165
|
username: string;
|
|
2166
2166
|
profile: {
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2167
|
+
displayName: any;
|
|
2168
|
+
bio: any;
|
|
2169
|
+
location: any;
|
|
2170
|
+
website: any;
|
|
2171
|
+
profilePicture: string | null;
|
|
2172
|
+
profilePictureThumbnail: string | null;
|
|
2173
|
+
};
|
|
2170
2174
|
};
|
|
2171
2175
|
meta: object;
|
|
2172
2176
|
}>;
|
|
2173
2177
|
updateProfile: import("@trpc/server").TRPCMutationProcedure<{
|
|
2174
2178
|
input: {
|
|
2175
|
-
profile
|
|
2179
|
+
profile?: {
|
|
2180
|
+
location?: string | null | undefined;
|
|
2181
|
+
displayName?: string | null | undefined;
|
|
2182
|
+
bio?: string | null | undefined;
|
|
2183
|
+
website?: string | null | undefined;
|
|
2184
|
+
} | undefined;
|
|
2176
2185
|
profilePicture?: {
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2186
|
+
filePath: string;
|
|
2187
|
+
fileName: string;
|
|
2188
|
+
fileType: string;
|
|
2189
|
+
fileSize: number;
|
|
2190
|
+
} | undefined;
|
|
2191
|
+
dicebearAvatar?: {
|
|
2192
|
+
url: string;
|
|
2181
2193
|
} | undefined;
|
|
2182
2194
|
};
|
|
2183
2195
|
output: {
|
|
2184
2196
|
id: string;
|
|
2185
2197
|
username: string;
|
|
2186
2198
|
profile: {
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2199
|
+
displayName: any;
|
|
2200
|
+
bio: any;
|
|
2201
|
+
location: any;
|
|
2202
|
+
website: any;
|
|
2203
|
+
profilePicture: string | null;
|
|
2204
|
+
profilePictureThumbnail: string | null;
|
|
2205
|
+
};
|
|
2206
|
+
};
|
|
2207
|
+
meta: object;
|
|
2208
|
+
}>;
|
|
2209
|
+
getUploadUrl: import("@trpc/server").TRPCMutationProcedure<{
|
|
2210
|
+
input: {
|
|
2211
|
+
fileName: string;
|
|
2212
|
+
fileType: string;
|
|
2213
|
+
};
|
|
2214
|
+
output: {
|
|
2215
|
+
uploadUrl: string;
|
|
2216
|
+
filePath: string;
|
|
2217
|
+
fileName: string;
|
|
2190
2218
|
};
|
|
2191
2219
|
meta: object;
|
|
2192
2220
|
}>;
|
|
@@ -5460,29 +5488,57 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
|
|
|
5460
5488
|
id: string;
|
|
5461
5489
|
username: string;
|
|
5462
5490
|
profile: {
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5491
|
+
displayName: any;
|
|
5492
|
+
bio: any;
|
|
5493
|
+
location: any;
|
|
5494
|
+
website: any;
|
|
5495
|
+
profilePicture: string | null;
|
|
5496
|
+
profilePictureThumbnail: string | null;
|
|
5497
|
+
};
|
|
5466
5498
|
};
|
|
5467
5499
|
meta: object;
|
|
5468
5500
|
}>;
|
|
5469
5501
|
updateProfile: import("@trpc/server").TRPCMutationProcedure<{
|
|
5470
5502
|
input: {
|
|
5471
|
-
profile
|
|
5503
|
+
profile?: {
|
|
5504
|
+
location?: string | null | undefined;
|
|
5505
|
+
displayName?: string | null | undefined;
|
|
5506
|
+
bio?: string | null | undefined;
|
|
5507
|
+
website?: string | null | undefined;
|
|
5508
|
+
} | undefined;
|
|
5472
5509
|
profilePicture?: {
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5510
|
+
filePath: string;
|
|
5511
|
+
fileName: string;
|
|
5512
|
+
fileType: string;
|
|
5513
|
+
fileSize: number;
|
|
5514
|
+
} | undefined;
|
|
5515
|
+
dicebearAvatar?: {
|
|
5516
|
+
url: string;
|
|
5477
5517
|
} | undefined;
|
|
5478
5518
|
};
|
|
5479
5519
|
output: {
|
|
5480
5520
|
id: string;
|
|
5481
5521
|
username: string;
|
|
5482
5522
|
profile: {
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5523
|
+
displayName: any;
|
|
5524
|
+
bio: any;
|
|
5525
|
+
location: any;
|
|
5526
|
+
website: any;
|
|
5527
|
+
profilePicture: string | null;
|
|
5528
|
+
profilePictureThumbnail: string | null;
|
|
5529
|
+
};
|
|
5530
|
+
};
|
|
5531
|
+
meta: object;
|
|
5532
|
+
}>;
|
|
5533
|
+
getUploadUrl: import("@trpc/server").TRPCMutationProcedure<{
|
|
5534
|
+
input: {
|
|
5535
|
+
fileName: string;
|
|
5536
|
+
fileType: string;
|
|
5537
|
+
};
|
|
5538
|
+
output: {
|
|
5539
|
+
uploadUrl: string;
|
|
5540
|
+
filePath: string;
|
|
5541
|
+
fileName: string;
|
|
5486
5542
|
};
|
|
5487
5543
|
meta: object;
|
|
5488
5544
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_app.d.ts","sourceRoot":"","sources":["../../src/routers/_app.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAU1E,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"_app.d.ts","sourceRoot":"","sources":["../../src/routers/_app.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAU1E,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAiC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/routers/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAwBxB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/routers/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAwBxB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuSrB,CAAC"}
|
package/dist/routers/auth.js
CHANGED
|
@@ -197,7 +197,15 @@ export const authRouter = createTRPCRouter({
|
|
|
197
197
|
id: true,
|
|
198
198
|
email: true,
|
|
199
199
|
role: true,
|
|
200
|
-
|
|
200
|
+
profile: {
|
|
201
|
+
select: {
|
|
202
|
+
displayName: true,
|
|
203
|
+
bio: true,
|
|
204
|
+
location: true,
|
|
205
|
+
website: true,
|
|
206
|
+
profilePicture: true,
|
|
207
|
+
},
|
|
208
|
+
},
|
|
201
209
|
},
|
|
202
210
|
});
|
|
203
211
|
if (!user) {
|
package/dist/routers/user.d.ts
CHANGED
|
@@ -22,29 +22,57 @@ export declare const userRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
22
22
|
id: string;
|
|
23
23
|
username: string;
|
|
24
24
|
profile: {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
displayName: any;
|
|
26
|
+
bio: any;
|
|
27
|
+
location: any;
|
|
28
|
+
website: any;
|
|
29
|
+
profilePicture: string | null;
|
|
30
|
+
profilePictureThumbnail: string | null;
|
|
31
|
+
};
|
|
28
32
|
};
|
|
29
33
|
meta: object;
|
|
30
34
|
}>;
|
|
31
35
|
updateProfile: import("@trpc/server").TRPCMutationProcedure<{
|
|
32
36
|
input: {
|
|
33
|
-
profile
|
|
37
|
+
profile?: {
|
|
38
|
+
location?: string | null | undefined;
|
|
39
|
+
displayName?: string | null | undefined;
|
|
40
|
+
bio?: string | null | undefined;
|
|
41
|
+
website?: string | null | undefined;
|
|
42
|
+
} | undefined;
|
|
34
43
|
profilePicture?: {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
filePath: string;
|
|
45
|
+
fileName: string;
|
|
46
|
+
fileType: string;
|
|
47
|
+
fileSize: number;
|
|
48
|
+
} | undefined;
|
|
49
|
+
dicebearAvatar?: {
|
|
50
|
+
url: string;
|
|
39
51
|
} | undefined;
|
|
40
52
|
};
|
|
41
53
|
output: {
|
|
42
54
|
id: string;
|
|
43
55
|
username: string;
|
|
44
56
|
profile: {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
57
|
+
displayName: any;
|
|
58
|
+
bio: any;
|
|
59
|
+
location: any;
|
|
60
|
+
website: any;
|
|
61
|
+
profilePicture: string | null;
|
|
62
|
+
profilePictureThumbnail: string | null;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
meta: object;
|
|
66
|
+
}>;
|
|
67
|
+
getUploadUrl: import("@trpc/server").TRPCMutationProcedure<{
|
|
68
|
+
input: {
|
|
69
|
+
fileName: string;
|
|
70
|
+
fileType: string;
|
|
71
|
+
};
|
|
72
|
+
output: {
|
|
73
|
+
uploadUrl: string;
|
|
74
|
+
filePath: string;
|
|
75
|
+
fileName: string;
|
|
48
76
|
};
|
|
49
77
|
meta: object;
|
|
50
78
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/routers/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/routers/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA2DxB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqMrB,CAAC"}
|