Add self-authentication with Google Calendar API
This commit is contained in:
1 parent
ed392e8bba
commit
1582cfd43f
5 files changed
+225
-19
No files matched your search
@@ -8,14 +8,23 @@ export default async function handler(req, res) {
|
||||
|
||||
if (!session) { res.status(401).json({message: 'You must be logged in to do this'}); return; }
|
||||
|
||||
// TODO: Add user ID so filtering works properly. User object does not include ID currently.
|
||||
// TODO: Add user ID to user session object
|
||||
const user = await prisma.user.findFirst({
|
||||
where: {
|
||||
email: session.user.email,
|
||||
},
|
||||
select: {
|
||||
id: true
|
||||
}
|
||||
});
|
||||
|
||||
const credentials = await prisma.credential.findMany({
|
||||
where: {
|
||||
userId: session.user.id,
|
||||
userId: user.id,
|
||||
},
|
||||
select: {
|
||||
type: true
|
||||
type: true,
|
||||
key: true
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user