Skip to content

Commit

Permalink
Lint (#35)
Browse files Browse the repository at this point in the history
* #23 Issue done (#30)

Co-authored-by: Dinmukhamed Mailibay <[email protected]>

* change the length to 120

* further formating

---------

Co-authored-by: Vrushabh Patil <[email protected]>
  • Loading branch information
dinmukhamedm and Vrushabh48 authored Oct 13, 2024
1 parent 149e10d commit 3e50602
Show file tree
Hide file tree
Showing 294 changed files with 5,164 additions and 5,346 deletions.
12 changes: 10 additions & 2 deletions frontend/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
{
"extends": "next/core-web-vitals"
}
"extends": ["next/core-web-vitals", "prettier"],
"rules": {
"indent": ["error", 2],
"eol-last": ["error", "always"],
"max-len": ["error", { "code": 120, "ignoreUrls": true, "ignoreStrings": true, "ignoreTemplateLiterals": true }],
"semi": ["error", "always"],
"no-trailing-spaces": ["error"],
"arrow-body-style": ["warn", "as-needed"]
}
}
6 changes: 6 additions & 0 deletions frontend/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"tabWidth": 2,
"printWidth": 120,
"trailingComma": "es5",
"endOfLine": "lf"
}
8 changes: 4 additions & 4 deletions frontend/app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { authOptions } from '@/lib/auth'
import NextAuth from 'next-auth'
import { authOptions } from '@/lib/auth';
import NextAuth from 'next-auth';

const handler = NextAuth(authOptions)
export { handler as GET, handler as POST }
const handler = NextAuth(authOptions);
export { handler as GET, handler as POST };
10 changes: 5 additions & 5 deletions frontend/app/api/limits/workspace/[workspaceId]/route.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { getServerSession } from 'next-auth'
import { authOptions } from '@/lib/auth'
import { getServerSession } from 'next-auth';
import { authOptions } from '@/lib/auth';
import { fetcher } from '@/lib/utils';
import { NextRequest } from 'next/server';

export async function GET(req: NextRequest, { params }: { params: { workspaceId: string } }): Promise<Response> {
const workspaceId = params.workspaceId;
const session = await getServerSession(authOptions)
const user = session!.user
const session = await getServerSession(authOptions);
const user = session!.user;

return await fetcher(`/limits/workspace/${workspaceId}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${user.apiKey}`
},
})
});
}
10 changes: 5 additions & 5 deletions frontend/app/api/limits/workspace/[workspaceId]/storage/route.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { getServerSession } from 'next-auth'
import { authOptions } from '@/lib/auth'
import { getServerSession } from 'next-auth';
import { authOptions } from '@/lib/auth';
import { fetcher } from '@/lib/utils';
import { NextRequest } from 'next/server';

export async function GET(req: NextRequest, { params }: { params: { workspaceId: string } }): Promise<Response> {
const workspaceId = params.workspaceId;
const session = await getServerSession(authOptions)
const user = session!.user
const session = await getServerSession(authOptions);
const user = session!.user;

return await fetcher(`/limits/workspace/${workspaceId}/storage`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${user.apiKey}`
},
})
});
}

30 changes: 15 additions & 15 deletions frontend/app/api/projects/[projectId]/api-keys/route.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { getServerSession } from 'next-auth'
import { authOptions } from '@/lib/auth'
import { type NextRequest } from 'next/server'
import { getServerSession } from 'next-auth';
import { authOptions } from '@/lib/auth';
import { type NextRequest } from 'next/server';


export async function POST(req: NextRequest, { params }: { params: { projectId: string } }): Promise<Response> {
const projectId = params.projectId
const session = await getServerSession(authOptions)
const user = session!.user
const projectId = params.projectId;
const session = await getServerSession(authOptions);
const user = session!.user;

const body = await req.json()
const body = await req.json();

return await fetch(`${process.env.BACKEND_URL}/api/v1/projects/${projectId}/api-keys`, {
method: 'POST',
Expand All @@ -21,9 +21,9 @@ export async function POST(req: NextRequest, { params }: { params: { projectId:
}

export async function GET(req: NextRequest, { params }: { params: { projectId: string } }): Promise<Response> {
const projectId = params.projectId
const session = await getServerSession(authOptions)
const user = session!.user
const projectId = params.projectId;
const session = await getServerSession(authOptions);
const user = session!.user;

return await fetch(`${process.env.BACKEND_URL}/api/v1/projects/${projectId}/api-keys`, {
method: 'GET',
Expand All @@ -34,11 +34,11 @@ export async function GET(req: NextRequest, { params }: { params: { projectId: s
}

export async function DELETE(req: NextRequest, { params }: { params: { projectId: string } }): Promise<Response> {
const projectId = params.projectId
const session = await getServerSession(authOptions)
const user = session!.user
const projectId = params.projectId;
const session = await getServerSession(authOptions);
const user = session!.user;

const body = await req.json()
const body = await req.json();

return await fetch(`${process.env.BACKEND_URL}/api/v1/projects/${projectId}/api-keys`, {
method: 'DELETE',
Expand All @@ -48,4 +48,4 @@ export async function DELETE(req: NextRequest, { params }: { params: { projectId
},
body: JSON.stringify(body)
});
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { authOptions } from "@/lib/auth";
import { fetcher } from "@/lib/utils";
import { getServerSession } from "next-auth";
import { authOptions } from '@/lib/auth';
import { fetcher } from '@/lib/utils';
import { getServerSession } from 'next-auth';

export async function POST(req: Request, { params }: { params: { projectId: string, datasetId: string, datapointId: string } }): Promise<Response> {
const projectId = params.projectId;
const datasetId = params.datasetId;
const datapointId = params.datapointId;
const session = await getServerSession(authOptions)
const user = session!.user
const session = await getServerSession(authOptions);
const user = session!.user;

const body = await req.json()
const body = await req.json();

return await fetcher(`/projects/${projectId}/datasets/${datasetId}/datapoints/${datapointId}`, {
method: 'POST',
Expand All @@ -18,5 +18,5 @@ export async function POST(req: Request, { params }: { params: { projectId: stri
Authorization: `Bearer ${user.apiKey}`
},
body: JSON.stringify(body)
})
});
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { getServerSession } from 'next-auth'
import { authOptions } from '@/lib/auth'
import { getServerSession } from 'next-auth';
import { authOptions } from '@/lib/auth';
import { fetcher } from '@/lib/utils';

export async function DELETE(req: Request, { params }: { params: { projectId: string, datasetId: string } }): Promise<Response> {
const projectId = params.projectId;
const datasetId = params.datasetId;
const session = await getServerSession(authOptions)
const user = session!.user
const session = await getServerSession(authOptions);
const user = session!.user;

return await fetcher(`/projects/${projectId}/datasets/${datasetId}/datapoints/all`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${user.apiKey}`
},
})
});
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import { getServerSession } from 'next-auth'
import { authOptions } from '@/lib/auth'
import { getServerSession } from 'next-auth';
import { authOptions } from '@/lib/auth';
import { fetcher } from '@/lib/utils';
import { NextRequest } from 'next/server';

export async function GET(req: NextRequest, { params }: { params: { projectId: string, datasetId: string } }): Promise<Response> {
const projectId = params.projectId;
const datasetId = params.datasetId;
const session = await getServerSession(authOptions)
const user = session!.user
const session = await getServerSession(authOptions);
const user = session!.user;

return await fetcher(`/projects/${projectId}/datasets/${datasetId}/datapoints?${req.nextUrl.searchParams.toString()}`, {
method: 'GET',
headers: {
Authorization: `Bearer ${user.apiKey}`
},
})
});
}

export async function POST(req: Request, { params }: { params: { projectId: string, datasetId: string } }): Promise<Response> {
const projectId = params.projectId;
const datasetId = params.datasetId;
const session = await getServerSession(authOptions)
const user = session!.user
const session = await getServerSession(authOptions);
const user = session!.user;

const body = await req.json()
const body = await req.json();

return await fetcher(`/projects/${projectId}/datasets/${datasetId}/datapoints`, {
method: 'POST',
Expand All @@ -32,16 +32,16 @@ export async function POST(req: Request, { params }: { params: { projectId: stri
Authorization: `Bearer ${user.apiKey}`
},
body: JSON.stringify(body)
})
});
}

export async function DELETE(req: Request, { params }: { params: { projectId: string, datasetId: string } }): Promise<Response> {
const projectId = params.projectId;
const datasetId = params.datasetId;
const session = await getServerSession(authOptions)
const user = session!.user
const session = await getServerSession(authOptions);
const user = session!.user;

const body = await req.json()
const body = await req.json();

return await fetcher(`/projects/${projectId}/datasets/${datasetId}/datapoints`, {
method: 'DELETE',
Expand All @@ -50,5 +50,5 @@ export async function DELETE(req: Request, { params }: { params: { projectId: st
Authorization: `Bearer ${user.apiKey}`
},
body: JSON.stringify(body)
})
});
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import { getServerSession } from 'next-auth'
import { authOptions } from '@/lib/auth'
import { type NextRequest } from 'next/server'
import { fetcher } from '@/lib/utils'
import { getServerSession } from 'next-auth';
import { authOptions } from '@/lib/auth';
import { type NextRequest } from 'next/server';
import { fetcher } from '@/lib/utils';


export async function POST(req: NextRequest, { params }: { params: { projectId: string, datasetId: string } }): Promise<Response> {
const projectId = params.projectId
const datasetId = params.datasetId
const session = await getServerSession(authOptions)
const user = session!.user
const projectId = params.projectId;
const datasetId = params.datasetId;
const session = await getServerSession(authOptions);
const user = session!.user;

const data = await req.formData()
const data = await req.formData();

const res = await fetcher(`/projects/${projectId}/datasets/${datasetId}/file-upload`, {
method: 'POST',
headers: {
Authorization: `Bearer ${user.apiKey}`
},
body: data
})
});

return res
return res;
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { getServerSession } from 'next-auth'
import { authOptions } from '@/lib/auth'
import { fetcher } from '@/lib/utils'
import { getServerSession } from 'next-auth';
import { authOptions } from '@/lib/auth';
import { fetcher } from '@/lib/utils';

export async function POST(req: Request, { params }: { params: { projectId: string, datasetId: string } }): Promise<Response> {
const projectId = params.projectId
const datasetId = params.datasetId
const session = await getServerSession(authOptions)
const user = session!.user
const projectId = params.projectId;
const datasetId = params.datasetId;
const session = await getServerSession(authOptions);
const user = session!.user;

const body = await req.json()
const body = await req.json();

const res = await fetcher(`/projects/${projectId}/datasets/${datasetId}/index`, {
method: 'POST',
Expand All @@ -17,7 +17,7 @@ export async function POST(req: Request, { params }: { params: { projectId: stri
Authorization: `Bearer ${user.apiKey}`
},
body: JSON.stringify(body)
})
});

return new Response(res.body)
return new Response(res.body);
}
Loading

0 comments on commit 3e50602

Please sign in to comment.