Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
590a561
Merge pull request #75 from DevClans/auspy
auspy Feb 27, 2024
3f71ceb
Merge pull request #76 from DevClans/auspy
auspy Feb 27, 2024
2cfa58c
Merge pull request #77 from DevClans/auspy
auspy Feb 27, 2024
4e2594d
Merge pull request #78 from DevClans/auspy
auspy Feb 27, 2024
615bb45
Merge pull request #79 from DevClans/auspy
auspy Feb 27, 2024
b680459
Merge pull request #80 from DevClans/auspy
auspy Feb 27, 2024
61f054f
Merge pull request #81 from DevClans/auspy
auspy Feb 27, 2024
112f2d8
Merge pull request #82 from DevClans/auspy
auspy Feb 27, 2024
696796e
Merge pull request #83 from DevClans/auspy
auspy Feb 28, 2024
a11cb7a
Merge pull request #84 from DevClans/auspy
auspy Mar 2, 2024
ac15a97
feat: added team code, joining functionality
sidxh Mar 17, 2024
cd4dd88
fix: updated github configs
sidxh Mar 19, 2024
9ff8879
updated config
Satvik1769 Mar 20, 2024
eed0371
feat:add team member
Satvik1769 Mar 21, 2024
300a688
feat: add team member
Satvik1769 Mar 21, 2024
7c85282
feat: added copy functionality
Satvik1769 Mar 23, 2024
ac61c10
Merge pull request #85 from DevClans/satvik2
Satvik1769 Mar 23, 2024
368a179
Merge pull request #86 from DevClans/satvik
Satvik1769 Mar 23, 2024
fe3bcf5
feat: added resume uploading for user
sidxh Mar 29, 2024
27d6415
fix: resume link to the db
sidxh Mar 29, 2024
25a8d31
fix: resume link to the db
sidxh Mar 29, 2024
2b4e442
Merge pull request #88 from DevClans/auspy
auspy Mar 30, 2024
979e49e
feat: added page themes
sidxh Mar 30, 2024
011285f
Merge branch 'main' of https://github.com/DevClans/devclans into sidd…
sidxh Mar 30, 2024
7ca115c
fix: type errors
sidxh Apr 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
/.env
/devclans-local.pem
# dependencies
/node_modules
/.pnp
Expand Down
79 changes: 58 additions & 21 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,60 @@
{
"accessibility.alert.format": "never",
"accessibility.alert.save": "never",
"audioCues.volume": 0,
"audioCues.debouncePositionChanges": false,
"audioCues.diffLineDeleted": "off",
"audioCues.diffLineInserted": "off",
"audioCues.terminalQuickFix": "off",
"audioCues.terminalCommandFailed": "off",
"audioCues.taskFailed": "off",
"audioCues.taskCompleted": "off",
"audioCues.onDebugBreak": "off",
"audioCues.notebookCellFailed": "off",
"audioCues.notebookCellCompleted": "off",
"audioCues.noInlayHints": "off",
"audioCues.lineHasInlineSuggestion": "off",
"audioCues.lineHasFoldedArea": "off",
"audioCues.lineHasError": "off",
"audioCues.lineHasBreakpoint": "off",
"audioCues.diffLineModified": "off",
"audioCues.chatResponsePending": "off",
"editor.accessibilitySupport": "off"
"editor.accessibilitySupport": "off",
"accessibility.signals.sounds.volume": 0,
"accessibility.signals.debouncePositionChanges": false,
"accessibility.signals.lineHasError": {
"sound": "off"
},
"accessibility.signals.lineHasFoldedArea": {
"sound": "off"
},
"accessibility.signals.lineHasBreakpoint": {
"sound": "off"
},
"accessibility.signals.lineHasInlineSuggestion": {
"sound": "off"
},
"accessibility.signals.terminalQuickFix": {
"sound": "off"
},
"accessibility.signals.onDebugBreak": {
"sound": "off"
},
"accessibility.signals.noInlayHints": {
"sound": "off"
},
"accessibility.signals.taskCompleted": {
"sound": "off"
},
"accessibility.signals.taskFailed": {
"sound": "off"
},
"accessibility.signals.terminalCommandFailed": {
"sound": "off"
},
"accessibility.signals.notebookCellCompleted": {
"sound": "off"
},
"accessibility.signals.notebookCellFailed": {
"sound": "off"
},
"accessibility.signals.diffLineInserted": {
"sound": "off"
},
"accessibility.signals.diffLineDeleted": {
"sound": "off"
},
"accessibility.signals.diffLineModified": {
"sound": "off"
},
"accessibility.signals.chatResponsePending": {
"sound": "off"
},
"accessibility.signals.save": {
"announcement": "never"
},
"accessibility.signals.format": {
"announcement": "never"
},
"CodeGPT.apiKey": "Mistral"
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"axios": "^1.6.5",
"bson": "^6.2.0",
"fast-json-stable-stringify": "^2.1.0",
"fs": "0.0.1-security",
"github-calendar": "^2.3.2",
"github-calendar-graph": "^0.2.8",
"ioredis": "^5.3.2",
Expand Down
7 changes: 7 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 79 additions & 0 deletions public/config.github.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import { zodGithubAccessToken } from "@/zod/zod.common";
import { App, Octokit } from "octokit";
import fs from 'fs';

export const getOctokit = async ({
installationId,
accessToken,
}: {
installationId?: number;
accessToken?: string;
}) => {
try {
if (installationId) {
const appId = process.env.AUSPY_GITHUB_APP_ID;

const base64Key = process.env.AUSPY_GITHUB_PRIVATE_KEY;
if (!base64Key) {
throw new Error("Private Key not found");
}
// Decode the Base64-encoded key to binary data
const binaryKey = Buffer.from(base64Key, "base64");
// Convert the binary key to a string
const stringKey = binaryKey.toString("utf8");

if (!appId || !stringKey) {
throw new Error("App ID or Private Key not found");
}
const app = new App({
appId,
privateKey: stringKey,
});
return {
api: await app.getInstallationOctokit(installationId),
type: "app",
};


// const appId = process.env.AUSPY_GITHUB_APP_ID;
// const filepath = './devclans-local.pem';

// const base64Key = fs
// .readFileSync(filepath, "base64")
// .replace("-----BEGIN RSA PRIVATE KEY-----", "")
// .replace("-----END RSA PRIVATE KEY-----", "")
// .trim();
// // Decode the Base64-encoded key to binary data
// const binaryKey = Buffer.from(base64Key, "base64");

// // Convert the binary key to a string (optional)
// const stringKey = binaryKey.toString("utf8");
// // console.log("My key is: ", myKey);
// if (!appId || !base64Key) {
// throw new Error("App ID or Private Key not found");
// }
// const app = new App({
// appId,
// privateKey: stringKey,
// });
// return {
// api: await app.getInstallationOctokit(installationId),
// type: "app",
// };

} else if (zodGithubAccessToken.safeParse(accessToken).success) {
return {
api: new Octokit({
auth: accessToken,
}),
type: "auth",
};
} else {
return { api: new Octokit({}), type: "free" };
}
} catch (error) {
console.error("Error getting octokit", error);
return null;
}
};

Binary file added public/copy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion src/app/api/auth/github/appcallback/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ export const dynamic = "force-dynamic";
const handler = async (req: NextRequest) => {
try {
console.log(" start of github/appcallback");
// const code = req.nextUrl.searchParams.get("code");
const code = req.nextUrl.searchParams.get("code");
const setupAction = req.nextUrl.searchParams.get("setup_action");
console.log(setupAction, code);
console.log(req.nextUrl.searchParams.get("installation_id"))
const installId = zodGithubInstallationId.parse(
req.nextUrl.searchParams.get("installation_id")
);
Expand All @@ -26,6 +29,7 @@ const handler = async (req: NextRequest) => {
const userId = zodMongoId.parse(session?.user?._id);
// get installed repos
const reposData = await getInstalledReposFunc(installId, false);
console.log(reposData)
// get user profile
await updateData(userId, installId, reposData);
console.log("success of github/appcallback, redirecting");
Expand Down
42 changes: 42 additions & 0 deletions src/app/api/joinTeam/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// app/api/join-team/route.ts
import { NextRequest, NextResponse } from 'next/server';
import dbConnect from '@/lib/dbConnect';
import { ProjectModel } from '@/mongodb/models';
import { getServerSession } from 'next-auth';
import { authOptions } from '@/utils/auth/auth';
export async function POST(req: NextRequest,res:NextResponse) {
const session: any = await getServerSession(authOptions);
console.log(session);
const userId = session.user._id;
const { teamCode } = await req.json();
try {


await dbConnect();

// Find the project with the provided team code
const project = await ProjectModel.findOne({ teamCode });

if (!project) {
return NextResponse.json({ error: 'Project not found' }, { status: 404 });
}


console.log(userId);

// Add the user's ID to the contributors array
if(userId){
project.team.push(userId);
await project.save();
return NextResponse.json({ message: 'Joined team successfully' });
}
else{
return NextResponse.json({ error: 'User not found' }, { status: 404 });
}


} catch (error) {
console.error('Error joining team:', error);
return NextResponse.json({ error: 'Internal Server Error' }, { status: 500 });
}
}
2 changes: 1 addition & 1 deletion src/app/api/project/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getDataQuery } from "@/utils/getDataQuery";

async function handler(req: Request) {
async function handler(req: Request):Promise<any>{
return getDataQuery(req.url);
}

Expand Down
15 changes: 14 additions & 1 deletion src/app/api/uploadthing/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ export const ourFileRouter = {
console.log("file url", file.url);
return { uploadedBy: metadata.userId };
}),

// Add the resumeUploader endpoint
resumeUploader: f({ pdf: { maxFileSize: "2MB", maxFileCount: 1 } })
.middleware(async ({ req }) => {
const user = await auth(req);
if (!user) throw new Error("Unauthorized");
return { userId: user.id };
})
.onUploadComplete(async ({ metadata, file }) => {
console.log("Resume upload complete for userId:", metadata.userId);
console.log("Resume file url", file.url);
return { uploadedBy: metadata.userId };
}),
} satisfies FileRouter;

export type OurFileRouter = typeof ourFileRouter;
export type OurFileRouter = typeof ourFileRouter;
2 changes: 1 addition & 1 deletion src/app/explore/projects/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const Projects = async ({ params, searchParams }: Partial<PageProps>) => {
const projects: ProjectSearchItemProps[] =
(await Fetch({
endpoint: "/project" + (str ? `?${str}` : ""),
revalidate: 3600 * 3, // TODO - set revalidate time
revalidate: 1, // TODO - set revalidate time
})) || [];
console.log(
Array.isArray(projects) && projects.length > 0,
Expand Down
54 changes: 54 additions & 0 deletions src/app/join-team/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// pages/join-team.tsx
"use client";
import { ButtonBlue } from '@/components';
import { useState } from 'react';

const JoinTeamPage = () => {
const [teamCode, setTeamCode] = useState('');
const [message, setMessage] = useState('');

const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();

try {
const response = await fetch('/api/joinTeam', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ teamCode }),
});

const data = await response.json();

if (response.ok) {
setMessage(data.message);
} else {
setMessage(data.error);
}
} catch (error) {
console.error('Error joining team :', error);
setMessage('An error occurred while joining the team');
}
};

return (
<div>
<h1 className='mt-20'>Join A Team</h1>
<form onSubmit={handleSubmit}>
<label className='text-lg flex flex-col my-8 gap-2'>
Team Code:
<input
type="text"
value={teamCode}
onChange={(e) => setTeamCode(e.target.value)}
/>
</label>
<ButtonBlue className="mt-6" type="submit" label="Join Team" />
</form>
{message && <p>{message}</p>}
</div>
);
};

export default JoinTeamPage;
1 change: 1 addition & 0 deletions src/app/project/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export async function generateMetadata({
console.error("Project not found in open graph image");
return {};
}
console.log("This us Data:",data)
const { title, desc, imgs, skills, repoDetails, domain } = data;
const img =
Array.isArray(imgs) && imgs.length > 0
Expand Down
4 changes: 4 additions & 0 deletions src/components/AccountMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ export default function AccountMenu({
title: "Edit Profile",
link: editProfile(userState?._id as string),
},
{
title:"Join Team",
link:"/join-team"
}
];
const handleClose = () => {
setAnchorEl(null);
Expand Down
Loading