mirror of
https://github.com/versia-pub/server.git
synced 2026-03-14 06:19:15 +01:00
Finish rewrite of everything with Prisma
This commit is contained in:
parent
5eed8374cd
commit
dc0ec47543
47 changed files with 1283 additions and 1036 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { applyConfig } from "@api";
|
||||
import { parseRequest } from "@request";
|
||||
import { errorResponse, jsonResponse } from "@response";
|
||||
import { Token } from "~database/entities/Token";
|
||||
import { client } from "~database/datasource";
|
||||
|
||||
export const meta = applyConfig({
|
||||
allowedMethods: ["POST"],
|
||||
|
|
@ -36,14 +36,19 @@ export default async (req: Request): Promise<Response> => {
|
|||
);
|
||||
|
||||
// Get associated token
|
||||
const token = await Token.findOneBy({
|
||||
code,
|
||||
application: {
|
||||
client_id,
|
||||
secret: client_secret,
|
||||
redirect_uris: redirect_uri,
|
||||
const token = await client.token.findFirst({
|
||||
where: {
|
||||
code,
|
||||
application: {
|
||||
client_id,
|
||||
secret: client_secret,
|
||||
redirect_uris: redirect_uri,
|
||||
},
|
||||
scope: scope?.replaceAll("+", " "),
|
||||
},
|
||||
include: {
|
||||
application: true,
|
||||
},
|
||||
scope: scope?.replaceAll("+", " "),
|
||||
});
|
||||
|
||||
if (!token)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue