Skip to content

Commit

Permalink
models good
Browse files Browse the repository at this point in the history
  • Loading branch information
pratyush3124 committed Mar 14, 2024
1 parent bfb063b commit 22fde2c
Show file tree
Hide file tree
Showing 22 changed files with 99 additions and 192 deletions.
10 changes: 5 additions & 5 deletions app/api/auth/[...nextauth]/route.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { connectMongoDB } from "@/lib/mongodb";
import { Users } from "@/models/user.model";
import { OAuth2Client } from 'google-auth-library';
import NextAuth from "next-auth/next";
import GoogleProvider from 'next-auth/providers/google'
import {Users} from "@/models/user";
import GoogleProvider from 'next-auth/providers/google';
import { NextResponse } from "next/server";
const client = new OAuth2Client(process.env.GOOGLE_CLIENT_ID);
import { OAuth2Client } from 'google-auth-library';
import { generateTokens } from "../../login/generateTokensUser/route";
const client = new OAuth2Client(process.env.GOOGLE_CLIENT_ID);
const GOOGLE_AUTHORIZATION_URL =
"https://accounts.google.com/o/oauth2/v2/auth?" +
new URLSearchParams({
Expand Down Expand Up @@ -160,4 +160,4 @@ async function refreshAccessToken(token) {

const handler = NextAuth(authOptions);

export { handler as GET, handler as POST };
export { handler as GET, handler as POST };
6 changes: 3 additions & 3 deletions app/api/event1/createTeam/route.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { connectMongoDB } from '@/lib/mongodb';
import { Users } from '@/models/user';
import { Users } from '@/models/user.model';
import { NextResponse } from 'next/server';

import { getTokenDetails } from '../../../../utils/authuser';
import { getToken } from 'next-auth/jwt';
import { Event1 } from '@/models/event1.model';
import { getToken } from 'next-auth/jwt';
import { getTokenDetails } from '../../../../utils/authuser';

export async function POST(req) {
try {
Expand Down
7 changes: 3 additions & 4 deletions app/api/event1/deleteTeam/[teamId]/route.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { connectMongoDB } from "@/lib/mongodb";
import { NextResponse } from "next/server";
import { TeamModel } from "@/models/TeamDetails";
import { generateTokens } from "../../../login/generateTokensTeam/route";
import { getTokenDetails } from "@/utils/authuser";
import { TeamToken } from "@/models/teamToken";
import { Users } from "@/models/user";
import { Users } from "@/models/user.model";
import { getTokenDetails } from "@/utils/authuser";
import { getToken } from "next-auth/jwt";
import { NextResponse } from "next/server";

export async function POST(req,{params}){

Expand Down
6 changes: 3 additions & 3 deletions app/api/event1/getTeamData/route.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { connectMongoDB } from '@/lib/mongodb';
import { Users } from '@/models/user';
import { Users } from '@/models/user.model';
import { NextResponse } from 'next/server';

import { getTokenDetails } from '../../../../utils/authuser';
import { getToken } from 'next-auth/jwt';
import { Event1 } from '@/models/event1.model';
import { getToken } from 'next-auth/jwt';
import { getTokenDetails } from '../../../../utils/authuser';

export async function GET(req) {
try {
Expand Down
6 changes: 1 addition & 5 deletions app/api/event1/getTeamViaToken/route.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { connectMongoDB } from "@/lib/mongodb";
import { NextResponse } from "next/server";
import { UsersDetails } from "@/models/Userdetails";
import { TeamModel } from "@/models/TeamDetails";
import { Users } from "@/models/user";
import { NextResponse } from "next/server";

import { getTokenDetails } from "../../../../utils/authuser";
import { generateTokens } from "../../login/generateTokensTeam/route";

export async function POST(req) {
try {
Expand Down
8 changes: 3 additions & 5 deletions app/api/event1/joinTeam/route.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { connectMongoDB } from "@/lib/mongodb";
import { NextResponse } from "next/server";
import { TeamModel } from "@/models/TeamDetails";
import { getTokenDetails } from "@/utils/authuser";
import { TeamToken } from "@/models/teamToken";
import { customAlphabet } from 'nanoid';
import { Users } from "@/models/user";
import { UsersDetails } from "@/models/Userdetails";
import { Users } from "@/models/user.model";
import { getTokenDetails } from "@/utils/authuser";
import { getToken } from "next-auth/jwt";
import { NextResponse } from "next/server";



Expand Down
9 changes: 3 additions & 6 deletions app/api/event1/leaveTeam/route.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { connectMongoDB } from "@/lib/mongodb";
import { NextResponse } from "next/server";
import { UsersDetails } from "@/models/Userdetails";
import { TeamModel } from "@/models/TeamDetails";
import { Users } from "@/models/user";
import { Users } from "@/models/user.model";
import { NextResponse } from "next/server";

import {getTokenDetails} from "../../../../utils/authuser"
import { generateTokens } from "../../login/generateTokensTeam/route";
import UserDetails from "@/components/userDetails";
import { getToken } from "next-auth/jwt";
import { getTokenDetails } from "../../../../utils/authuser";


export async function POST(req){
Expand Down
8 changes: 3 additions & 5 deletions app/api/event1/removeMember/[teamId]/route.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { connectMongoDB } from "@/lib/mongodb";
import { NextResponse } from "next/server";
import { UsersDetails } from "@/models/Userdetails";
import { TeamModel } from "@/models/TeamDetails";
import { Users } from "@/models/user";
import { UsersDetails } from "@/models/Userdetails";
import { NextResponse } from "next/server";

import { getTokenDetails } from "../../../../../utils/authuser";
import { generateTokens } from "../../../login/generateTokensTeam/route";
import UserDetails from "@/components/userDetails";
import { getToken } from "next-auth/jwt";
import { getTokenDetails } from "../../../../../utils/authuser";

export async function POST(req, { params }) {
try {
Expand Down
8 changes: 3 additions & 5 deletions app/api/event2/deleteTeam/[teamId]/route.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { connectMongoDB } from "@/lib/mongodb";
import { NextResponse } from "next/server";
import { UsersDetails } from "@/models/Userdetails";
import { Event2 } from "@/models/event2.model";
import { generateTokens } from "../../../login/generateTokensTeam/route";
import { getTokenDetails } from "@/utils/authuser";
import { TeamToken } from "@/models/teamToken";
import { Users } from "@/models/user";
import { Users } from "@/models/user.model";
import { getTokenDetails } from "@/utils/authuser";
import { getToken } from "next-auth/jwt";
import { NextResponse } from "next/server";

export async function POST(req, { params }) {
try {
Expand Down
4 changes: 2 additions & 2 deletions app/api/event2/getTeamData/route.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { connectMongoDB } from "@/lib/mongodb";
import { Event2 } from "@/models/event2.model";
import { Users } from "@/models/user";
import { Users } from "@/models/user.model";
import { NextResponse } from "next/server";

import { getTokenDetails } from "../../../../utils/authuser";
import { getToken } from "next-auth/jwt";
import { getTokenDetails } from "../../../../utils/authuser";


export async function POST(req){
Expand Down
6 changes: 1 addition & 5 deletions app/api/event2/getTeamViaToken/route.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { connectMongoDB } from "@/lib/mongodb";
import { NextResponse } from "next/server";
import { UsersDetails } from "@/models/Userdetails";
import { Event2 } from "@/models/event2.model";
import { Users } from "@/models/user";
import { NextResponse } from "next/server";

import { getTokenDetails } from "../../../../utils/authuser";
import { generateTokens } from "../../login/generateTokensTeam/route";

export async function POST(req) {
try {
Expand Down
7 changes: 2 additions & 5 deletions app/api/event2/leaveTeam/route.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { connectMongoDB } from "@/lib/mongodb";
import { NextResponse } from "next/server";
import { UsersDetails } from "@/models/Userdetails";
import { Event2 } from "@/models/event2.model";
import { Users } from "@/models/user";
import { NextResponse } from "next/server";

import {getTokenDetails} from "../../../../utils/authuser"
import { generateTokens } from "../../login/generateTokensTeam/route";
import UserDetails from "@/components/userDetails";
import { getToken } from "next-auth/jwt";
import { getTokenDetails } from "../../../../utils/authuser";


export async function POST(req){
Expand Down
5 changes: 2 additions & 3 deletions app/api/event2/makeTeam/route.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { connectMongoDB } from "@/lib/mongodb";
import { NextResponse } from "next/server";
import { UsersDetails } from "@/models/Userdetails";
import { Event2 } from "@/models/event2.model";
import { Users } from "@/models/user";
import { NextResponse } from "next/server";

import { getToken } from "next-auth/jwt";
import { getTokenDetails } from "../../../../utils/authuser";
import { generateTokens } from "../../login/generateTokensTeam/route";
import { getToken } from "next-auth/jwt";

export async function POST(req) {
try {
Expand Down
9 changes: 3 additions & 6 deletions app/api/event2/removeMember/[teamId]/route.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import { connectMongoDB } from "@/lib/mongodb";
import { NextResponse } from "next/server";
import { UsersDetails } from "@/models/Userdetails";
import { Event2 } from "@/models/event2.model";
import { Users } from "@/models/user";
import { Users } from "@/models/user.model";
import { NextResponse } from "next/server";

import { getTokenDetails } from "../../../../../utils/authuser";
import { generateTokens } from "../../../login/generateTokensTeam/route";
import UserDetails from "@/components/userDetails";
import { TeamModel } from "@/models/TeamDetails";
import { getToken } from "next-auth/jwt";
import { getTokenDetails } from "../../../../../utils/authuser";

export async function POST(req, { params }) {
try {
Expand Down
3 changes: 1 addition & 2 deletions app/api/register/route.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { connectMongoDB } from "@/lib/mongodb";
import { Users } from "@/models/user.model";
import { NextResponse } from "next/server";
import {Users} from "@/models/user";
import {generateTokens} from "../login/generateTokensUser/route"


export async function POST(req){
Expand Down
2 changes: 1 addition & 1 deletion app/api/userDetails/route.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { connectMongoDB } from '@/lib/mongodb';
import { Users } from '@/models/user.js';
import { Users } from '@/models/user.model.js';
import { getTokenDetails } from '@/utils/authuser.js';
import { getToken } from 'next-auth/jwt';
import { NextResponse } from 'next/server';
Expand Down
61 changes: 0 additions & 61 deletions models/TeamDetails.js

This file was deleted.

26 changes: 0 additions & 26 deletions models/teamToken.js

This file was deleted.

34 changes: 0 additions & 34 deletions models/user.js

This file was deleted.

Loading

0 comments on commit 22fde2c

Please sign in to comment.