Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
7089880
docs: commands for tests
samTime101 Sep 15, 2025
2782b9d
added: testing packages
samTime101 Sep 15, 2025
6b65be8
added: vitest
samTime101 Sep 15, 2025
5375ac9
feat: pnpm packages
samTime101 Sep 15, 2025
8d4a695
feat: connect vitest->tsconfig
samTime101 Sep 15, 2025
21cf00d
feat: all in one file
samTime101 Sep 15, 2025
222e474
feat: export for testing
samTime101 Sep 15, 2025
affec90
feat: all in one file
samTime101 Sep 15, 2025
fe4128b
feat: all service in one file
samTime101 Sep 15, 2025
ba62431
feat: testing for creating event
samTime101 Sep 15, 2025
7d3af66
docs: get event docs
samTime101 Sep 15, 2025
15c5e19
docs: list event docs
samTime101 Sep 15, 2025
2454cbf
feat: event list test 'GET'
samTime101 Sep 15, 2025
58eb3f7
feat: event with id test 'GET'
samTime101 Sep 15, 2025
092c2b6
Merge branch 'BIC-DevSphere:develop' into develop
samTime101 Sep 15, 2025
2552940
prisma pull auto generated
samTime101 Sep 15, 2025
a78608b
Merge branch 'develop' into develop
samTime101 Sep 15, 2025
8c88395
restore: previous implementation
samTime101 Sep 15, 2025
4135d62
fix: error and response return
samTime101 Sep 15, 2025
7c13920
Merge pull request #23 from BIC-DevSphere/main
adgator101 Sep 16, 2025
3044545
pull: changes on db pull
samTime101 Sep 16, 2025
0fc1a4f
pull: addition on db pull
samTime101 Sep 16, 2025
72873fc
fix: new return convention
samTime101 Sep 16, 2025
d7f0f75
fix: new return convention on service
samTime101 Sep 16, 2025
57a39be
fix: added new event id
samTime101 Sep 16, 2025
5420570
Merge branch 'develop' into develop
samTime101 Sep 16, 2025
0ddccb6
auto generated from prisma pull
samTime101 Sep 16, 2025
6c407b8
remove: introspected file
samTime101 Sep 16, 2025
9ab0e82
restore: auth.prisma from 2637bcd
samTime101 Sep 16, 2025
c30803e
remove: old migrations
samTime101 Sep 16, 2025
0a936bd
test: for member creation
samTime101 Sep 16, 2025
d9b755d
test: for user signin
samTime101 Sep 16, 2025
3f6e165
feat: implement member update functionality and enhance member schema
Kushal096 Sep 16, 2025
50303a7
refactor: rename member routes file and update import path
Kushal096 Sep 16, 2025
459f3cb
refactor: remove unused member removal functionality from controller …
Kushal096 Sep 16, 2025
8348805
Merge pull request #15 from samTime101/develop
Aayush0966 Sep 16, 2025
c577f4f
Merge branch 'develop' of https://github.com/Kushal096/devsphere-back…
Kushal096 Sep 17, 2025
9213af0
workflow: for test
samTime101 Sep 17, 2025
f0c580a
docs: run test locally
samTime101 Sep 17, 2025
157d048
fixes: removed unwanted runs
samTime101 Sep 17, 2025
5902a6f
fixes: use github env secret for database
samTime101 Sep 17, 2025
65e3e67
rename: default action name ->Tests for endpoints using vitest
samTime101 Sep 17, 2025
3d6a3c8
feat: updateEvent implementation
samTime101 Sep 17, 2025
deef112
test: for update event
samTime101 Sep 17, 2025
767274f
Merge pull request #29 from samTime101/develop
Aayush0966 Sep 17, 2025
3a43bdd
Merge branch 'develop' into feat/unit-test
samTime101 Sep 17, 2025
08350ea
Merge branch 'develop' of https://github.com/Kushal096/devsphere-back…
Kushal096 Sep 17, 2025
4288f30
refactor: simplify updateMember logic by removing status toggle
Kushal096 Sep 17, 2025
2c21d5d
Merge pull request #30 from samTime101/feat/unit-test
Aayush0966 Sep 17, 2025
8c2c192
Merge pull request #31 from Kushal096/members
Aayush0966 Sep 17, 2025
203fd66
Merge branch 'develop' of https://github.com/Kushal096/devsphere-back…
Kushal096 Sep 17, 2025
dfa51bd
fix: endpoints renamed
samTime101 Sep 17, 2025
bfa6272
fix: renamed endpoints
samTime101 Sep 17, 2025
116d467
refactor: improve error handling in member-related responses and upda…
Kushal096 Sep 17, 2025
7904be3
Merge branch 'members' into develop
Kushal096 Sep 17, 2025
dcbbfc4
Merge pull request #33 from Kushal096/develop
Aayush0966 Sep 17, 2025
f72cba7
Merge branch 'BIC-DevSphere:develop' into develop
samTime101 Sep 17, 2025
840cf81
refactor: added auth middleware
samTime101 Sep 17, 2025
1c53a19
Merge branch 'develop' of github.com:samTime101/devsphere-backend-mai…
samTime101 Sep 17, 2025
ac7d090
Merge pull request #32 from samTime101/develop
adgator101 Sep 17, 2025
d45b86a
refactor: correct unit tests mocking the middleware for events
samTime101 Sep 17, 2025
5ecefe9
refactor: correct unit tests mocking the middleware for member
samTime101 Sep 17, 2025
64e8540
Merge branch 'BIC-DevSphere:develop' into develop
samTime101 Sep 17, 2025
7599d05
Merge pull request #34 from samTime101/develop
Aayush0966 Sep 17, 2025
58f776a
feat: implement Create, List, and Update Member APIs with pagination …
Kushal096 Sep 18, 2025
03fc31d
fix: run tests sequentially and increase test timeout
samTime101 Sep 18, 2025
bf3defd
refactor: moved to lib/zod
samTime101 Sep 18, 2025
d81dff9
refactor: updated and optimized tests
samTime101 Sep 18, 2025
3dd4507
add: event delete route
samTime101 Sep 18, 2025
623a523
feat: manual mapping of returned data with event delete service
samTime101 Sep 18, 2025
8b4ff61
removed and moved unwanted declared types
samTime101 Sep 18, 2025
d69fb35
update: imports for eventschema and type
samTime101 Sep 18, 2025
df3943e
feat: updated import and event-delete controller
samTime101 Sep 18, 2025
5919bee
feat: implemented zod validation and before signup hooks on better auth
Aayush0966 Sep 18, 2025
841dfcc
Merge pull request #37 from Aayush0966/develop
Aayush0966 Sep 18, 2025
47ea544
Merge pull request #35 from Kushal096/develop
Aayush0966 Sep 18, 2025
3299c1a
refactor: removed isAdmin and added isMod to both
samTime101 Sep 18, 2025
da90e33
fix: bypassed both middlewares
samTime101 Sep 18, 2025
57f149f
feat: enhance member creation and update validation with detailed err…
Kushal096 Sep 18, 2025
9022fdb
feat: add auth middleware to member routes for enhanced security
Kushal096 Sep 18, 2025
028e7b5
Merge pull request #36 from samTime101/feat/delete-events
adgator101 Sep 18, 2025
5e964df
feat: actual test executionorder on the basis of import order
samTime101 Sep 18, 2025
1837410
feat: added test run script
samTime101 Sep 18, 2025
02d5966
refactor: commented unwanted code line
samTime101 Sep 18, 2025
b0f2264
docs(refactor) : corrected the test running command
samTime101 Sep 18, 2025
07019f0
docs(refactor) : corrected the test running command
samTime101 Sep 18, 2025
3e007a3
fix: corrected test running script
samTime101 Sep 18, 2025
dad00dd
fix: typo
samTime101 Sep 18, 2025
6d56880
Merge pull request #38 from Kushal096/develop
Aayush0966 Sep 18, 2025
e7389ab
Merge pull request #39 from samTime101/fix/ordered-tests
Aayush0966 Sep 18, 2025
5ccef11
feat: implement user management features with CRUD operations and val…
Aayush0966 Sep 18, 2025
6cda082
feat: add docs and validation middleware for the request payloads
Aayush0966 Sep 18, 2025
42635f3
feat: disable better auth signups and fix small bug on isAdmin
Aayush0966 Sep 18, 2025
2c8569a
Merge pull request #40 from Aayush0966/develop
Aayush0966 Sep 18, 2025
86099b4
feat: add axios dependency and update API routes in index.ts
adgator101 Sep 19, 2025
af76132
feat: implement tag management service and controller with CRUD opera…
adgator101 Sep 19, 2025
bb689fd
feat: enhance member management with query validation and retrieval f…
Kushal096 Sep 19, 2025
0ef3f39
Merge pull request #41 from adgator101/develop
Aayush0966 Sep 20, 2025
304d7cc
feat: integrate cloudinary for image uploads and configure multer sto…
Aayush0966 Sep 20, 2025
ff9c432
Merge pull request #43 from Aayush0966/develop
adgator101 Sep 21, 2025
523824b
Merge branch 'BIC-DevSphere:develop' into develop
Kushal096 Sep 21, 2025
90cd84b
refactor: reorder member router methods for clarity
Kushal096 Sep 21, 2025
7e44b58
refactor: update member service to use schema types for create and up…
Kushal096 Sep 21, 2025
898f7b6
feat: implement contributor management with github API implementation…
adgator101 Sep 21, 2025
0a60ba7
feat: implement project management features including CRUD operations…
adgator101 Sep 21, 2025
bf3ac19
refactor: clean up tag service code and add checkTagExists method
adgator101 Sep 21, 2025
5a7232f
refactor: streamline member router and update member service logic fo…
Kushal096 Sep 21, 2025
a0ac391
refactor: enhance project schema validation messages and improve proj…
adgator101 Sep 21, 2025
32f8968
docs: add project creation, listing, and updating documentation with …
adgator101 Sep 21, 2025
bbf0111
Merge pull request #42 from Kushal096/develop
Aayush0966 Sep 21, 2025
28f024a
fix: disable signin test for now
samTime101 Sep 22, 2025
22896c4
update: pnpm lock file
samTime101 Sep 22, 2025
bf1aff9
Merge branch 'develop' of github.com:samTime101/devsphere-backend-mai…
samTime101 Sep 22, 2025
48cdd6f
feat: add GitHub services for fetching contributors and contributor d…
adgator101 Sep 22, 2025
c15250b
refactor: migrate contributor fetching logic to githubServices and st…
adgator101 Sep 22, 2025
ff04085
feat: implement tag association and contributor addition during proje…
adgator101 Sep 22, 2025
a79850f
chore: update .env.example to include additional environment variables
adgator101 Sep 22, 2025
2cd2e1b
refactor: rename addContributorToProject method to associateContribut…
adgator101 Sep 22, 2025
0014581
fix: improve error handling for missing GitHub token in fetchContribu…
adgator101 Sep 22, 2025
3bc10da
Merge pull request #44 from adgator101/develop
adgator101 Sep 22, 2025
2d484d7
Merge branch 'BIC-DevSphere:develop' into develop
samTime101 Sep 22, 2025
c7e4a4d
Merge pull request #45 from samTime101/develop
Aayush0966 Sep 23, 2025
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
6 changes: 5 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
DATABASE_URL=
CORS_ORIGIN=
BETTER_AUTH_SECRET=
BETTER_AUTH_URL=
BETTER_AUTH_URL=
NODE_ENV=
JWT_ACCESS_SECRET=
JWT_REFRESH_SECRET=
GITHUB_TOKEN=
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# https://docs.github.com/en/actions/tutorials/build-and-test-code/nodejs
# SAMIP REGMI
# SEP 17 2025

# SURUMA CHAI GITHUB DOCS BATA LEKHEKO THEYE
# LOCALLY DOCKER RA ACT SANGA CHALO TARA GITHUB MA CHAI PROBLEM AAYO
# SO I REMOVED SOME THINGS LIKE CACHING AND STUFF
name: Tests for endpoints using vitest

# CURRENTLY IT RUNS ON EVERY PUSH ON ANY BRANCH
# HAMILE **develop** KO LAGI MATRA BANAUDA PANI HUNXA
on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5 # CHECKOUT THE REPO -> FROM DOCS
- uses: actions/setup-node@v4 # SETUP NODE -> FROM DOCS
with:
node-version: '22.17.0' #MY NODE VERSION
- name: Install pnpm # INSTALL PNPM
run: npm install -g pnpm@10.16.1 #YO CHAI MERO MA VAKO VERSION HO HAI LOL
- run: pnpm install
- name: prisma ko client generate # GENERATE PRISMA CLIENT
run: pnpm prisma generate
# PACKAGE JSON MA VAKO SCRIPT RUN GARNE
# BECAUSE IT IS RUNNING A SINGLE TEST FILE WITH ORDER
- run: pnpm run test
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }} # DATABASE URL FROM GITHUB SECRETS
CI: true # THE CI ENV VARIABLE IS NEEDED FOR VITEST TO RUN IN GITHUB ACTIONS
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,26 @@ The API is running at [http://localhost:3000](http://localhost:3000).
- `npm run db:studio`: Open database studio UI
- `npm run db:generate`: Generate prisma client






## Tests

- `npx vitest src/tests/events/create.test.ts` : target a particular file
- `npm run test` : test all






## Workflow test

**Make sure u have `docker` and `act` installed**

- mock the push using `act push` **ONLY USE THIS COMMAND FOR FIRST TIME**
- now check if the images are installed on docker `docker images`
- now everytime u call use `act push --reuse` so instead of creating new image it uses the existing image

129 changes: 129 additions & 0 deletions docs/CLOUDINARY_UPLOAD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# CLOUDINARY IMAGE UPLOAD

## Overview
Upload images to Cloudinary cloud storage using controller-service pattern.

## Setup Required
Environment variables in `.env`:
```
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
```

## Implementation Example: Update Profile with Image

### 1. Router
```typescript
// user.router.ts
import upload from '@/lib/multer';
import { userController } from '@/controllers/user.controller';

router.patch('/profile', upload.single('profileImage'), userController.updateProfile);
```

### 2. Controller
```typescript
// user.controller.ts
import { userService } from '@/services/user.service';

export const userController = {
updateProfile: async (req: Request, res: Response) => {
try {
const userId = req.user.id; // from auth middleware
const updateData = req.body;
const imageFile = req.file;

const result = await userService.updateProfile(userId, updateData, imageFile);

res.status(200).json({
success: true,
message: 'Profile updated successfully',
data: result
});
} catch (error) {
res.status(500).json({
success: false,
message: 'Failed to update profile'
});
}
}
};
```

### 3. Service
```typescript
// user.service.ts
import { uploadImageToCloudinary } from '@/utils/cloudinary.uploader';
import prisma from '@/db/prisma';

export const userService = {
updateProfile: async (userId: string, updateData: any, imageFile?: Express.Multer.File) => {
let profileImageUrl = undefined;

// Upload image if provided
if (imageFile) {
const uploadResult = await uploadImageToCloudinary(imageFile.path, {
folder: 'profile_images'
});

if (uploadResult.success) {
profileImageUrl = uploadResult.url;
} else {
throw new Error('Image upload failed');
}
}

// Update user in database
const updatedUser = await prisma.user.update({
where: { id: userId },
data: {
...updateData,
...(profileImageUrl && { profileImage: profileImageUrl })
}
});

return updatedUser;
}
};
```

## Request Format
```
PATCH /api/user/profile
Content-Type: multipart/form-data

profileImage: [file]
name: "John Doe"
bio: "Software Developer"
```

## Response Format

### Success (200)
```json
{
"success": true,
"message": "Profile updated successfully",
"data": {
"id": "user123",
"name": "John Doe",
"bio": "Software Developer",
"profileImage": "https://res.cloudinary.com/your-cloud/image/upload/v1234567890/profile_images/filename.jpg"
}
}
```

### Error (500)
```json
{
"success": false,
"message": "Failed to update profile"
}
```

## Notes
- Uses multer for handling multipart form data
- Images uploaded to `profile_images` folder in Cloudinary
- Supports JPG, PNG, JPEG, WEBP formats
- Image upload is optional in the example
47 changes: 47 additions & 0 deletions docs/GETEVENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# GET EVENT(GET)

```
/api/event/id/<id>
```

## VALID GET (200)

```json
{
"success": true,
"message": "EVENT FETCHED SUCCESSFULLY",
"data": {
"name": "ABCD",
"description": "ALPHABET",
"status": "UPCOMING",
"eventSchedule": [
{
"id": "fcbe5081-3f6e-4696-bb2b-19f7758a6425",
"startDate": "2025-09-15T10:00:00.000Z",
"endDate": "2025-09-15T12:00:00.000Z",
"description": "TODAY IS FIRST DAY",
"eventId": "4786f250-3fda-48a5-80ea-de84fdf9076f"
},
{
"id": "aa11b7ed-a465-4098-897c-5ce847b71549",
"startDate": "2025-09-16T12:00:00.000Z",
"endDate": "2025-09-16T14:00:00.000Z",
"description": "TODAY IS SECOND DAY",
"eventId": "4786f250-3fda-48a5-80ea-de84fdf9076f"
}
]
},
"code": 200
}
```

## INVALID GET (404)

```json
{
"success": false,
"error": "EVENT NOT FOUND",
"details": null,
"code": 404
}
```
105 changes: 105 additions & 0 deletions docs/LISTEVENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# LIST EVENT(GET)

```
/api/event/list
```

## GET (200)

```json
{
"success": true,
"message": "EVENTS FETCHED SUCCESSFULLY",
"data": [
{
"id": "4786f250-3fda-48a5-80ea-de84fdf9076f",
"name": "ABCD",
"description": "ALPHABET",
"status": "UPCOMING",
"eventSchedule": [
{
"id": "fcbe5081-3f6e-4696-bb2b-19f7758a6425",
"startDate": "2025-09-15T10:00:00.000Z",
"endDate": "2025-09-15T12:00:00.000Z",
"description": "TODAY IS FIRST DAY",
"eventId": "4786f250-3fda-48a5-80ea-de84fdf9076f"
},
{
"id": "aa11b7ed-a465-4098-897c-5ce847b71549",
"startDate": "2025-09-16T12:00:00.000Z",
"endDate": "2025-09-16T14:00:00.000Z",
"description": "TODAY IS SECOND DAY",
"eventId": "4786f250-3fda-48a5-80ea-de84fdf9076f"
}
]
},
{
"id": "e5ae4620-b899-4486-83d9-a622074933f4",
"name": "NEW EVENT",
"description": "NEW EVENT",
"status": "UPCOMING",
"eventSchedule": [
{
"id": "95e60be8-4feb-47f1-b6fc-ae30ddc3f073",
"startDate": "2025-09-15T10:00:00.000Z",
"endDate": "2025-09-15T12:00:00.000Z",
"description": "TODAY IS FIRST DAY",
"eventId": "e5ae4620-b899-4486-83d9-a622074933f4"
},
{
"id": "b11fd7e1-7aae-49fd-9638-98fad118e3f3",
"startDate": "2025-09-16T12:00:00.000Z",
"endDate": "2025-09-16T14:00:00.000Z",
"description": "TODAY IS SECOND DAY",
"eventId": "e5ae4620-b899-4486-83d9-a622074933f4"
}
]
},
{
"id": "c4514d94-4b7a-4834-8e16-e3e42618244e",
"name": "COMPLETED EVENT",
"description": "NEW EVENT",
"status": "COMPLETED",
"eventSchedule": [
{
"id": "81c70f52-8386-4317-bd09-80247de1c289",
"startDate": "2025-09-15T10:00:00.000Z",
"endDate": "2025-09-15T12:00:00.000Z",
"description": "TODAY IS FIRST DAY",
"eventId": "c4514d94-4b7a-4834-8e16-e3e42618244e"
},
{
"id": "2ebff3bc-80b7-4507-8c5c-fda1ce92ea2f",
"startDate": "2025-09-16T12:00:00.000Z",
"endDate": "2025-09-16T14:00:00.000Z",
"description": "TODAY IS SECOND DAY",
"eventId": "c4514d94-4b7a-4834-8e16-e3e42618244e"
}
]
},
{
"id": "aeb58d3f-e5d1-4e3f-95d7-d447d858ffd4",
"name": "COMPLETED TEST",
"description": "NEW EVENT",
"status": "COMPLETED",
"eventSchedule": [
{
"id": "3d71c36a-119e-41d6-b3f8-bf354a27280b",
"startDate": "2025-09-15T10:00:00.000Z",
"endDate": "2025-09-15T12:00:00.000Z",
"description": "TODAY IS FIRST DAY",
"eventId": "aeb58d3f-e5d1-4e3f-95d7-d447d858ffd4"
},
{
"id": "7f6f780f-1845-4b04-92a6-6c6974ca6820",
"startDate": "2025-09-16T12:00:00.000Z",
"endDate": "2025-09-16T14:00:00.000Z",
"description": "TODAY IS SECOND DAY",
"eventId": "aeb58d3f-e5d1-4e3f-95d7-d447d858ffd4"
}
]
}
],
"code": 200
}
```
Loading