Skip to content

Commit 9a09a5a

Browse files
Add base API path and update swagger api
1 parent 7c27d1b commit 9a09a5a

9 files changed

Lines changed: 142 additions & 54 deletions

File tree

client/app/_lib/services/mapService.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function useMapData() {
3939
}
4040

4141
export const getAllPlaces = async (): Promise<FeatureCollection> => {
42-
const { data } = await axios.get(`${process.env.NEXT_PUBLIC_API_BASE}/features`);
42+
const { data } = await axios.get(`${process.env.NEXT_PUBLIC_API_BASE}/places`);
4343

4444
const features = data.features || data.results || [];
4545

@@ -55,7 +55,6 @@ export const getAllPlaces = async (): Promise<FeatureCollection> => {
5555
return geoData;
5656
};
5757

58-
5958
export const searchPlacesByKeyword = async (query:any): Promise<FeatureCollection> => {
6059

6160
const { data } = await axios.get(`${process.env.NEXT_PUBLIC_API_BASE}/search?searchKeyword=${query}`);

client/app/_lib/services/viewService.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const getPlaceViewDetails = async ({
77
}: QueryFunctionContext<[string, string]>) => {
88
const [, id] = queryKey;
99

10-
const response = await axios.get(`${process.env.NEXT_PUBLIC_API_BASE}/featuresDetails?featureId=${id}`);
10+
const response = await axios.get(`${process.env.NEXT_PUBLIC_API_BASE}/placeDetails?featureId=${id}`);
1111

1212
return response.data;
1313
};

server/.gitignore

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,26 @@
1-
node_modules
2-
# Keep environment variables out of version control
1+
# Node modules
2+
node_modules/
3+
4+
# Environment variables
35
.env
46

5-
/generated/prisma
7+
# Prisma generated client and studio files
8+
/generated/prisma/
9+
10+
# Logs
11+
logs
12+
*.log
13+
npm-debug.log*
14+
yarn-debug.log*
15+
yarn-error.log*
16+
17+
# Optional npm cache
18+
.npm
19+
20+
# TypeScript build output
21+
dist/
22+
build/
623

7-
/generated/prisma
24+
# IDE files (optional)
25+
.vscode/
26+
.idea/

server/src/api/places/features.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const feature = async (req: Request, res: Response, next: NextFunction) => {
1414
}
1515
};
1616

17-
export const getFeatureDetails = async (
17+
export const getPlaceDetails = async (
1818
req: Request,
1919
res: Response,
2020
next: NextFunction

server/src/api/reviews/reviews.controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export const getReviewsByFeatureId = async (
203203
): Promise<void> => {
204204
const { reviewId } = req.query;
205205
const { prisma } = res.locals;
206-
206+
console.log("reviewId==>",reviewId)
207207
try {
208208
const schema = Joi.object({
209209
reviewId: Joi.string().required(),
@@ -224,7 +224,7 @@ export const getReviewsByFeatureId = async (
224224
userId: res.locals.user?.id,
225225
}
226226
});
227-
227+
console.log("reviews=>",reviews)
228228
res
229229
.status(StatusCodes.OK)
230230
.json({

server/src/routes/location.routes.ts

Whitespace-only changes.

server/src/routes/places.routes.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Router } from 'express';
2-
import getAllPlacesController, { getFeatureDetails } from '../api/places/features.controller';
2+
import getAllPlacesController, { getPlaceDetails } from '../api/places/features.controller';
33

44
const placesRouter = Router();
5-
placesRouter.get('/features', getAllPlacesController);
6-
placesRouter.get('/featuresDetails', getFeatureDetails);
5+
placesRouter.get('/places', getAllPlacesController);
6+
placesRouter.get('/placeDetails', getPlaceDetails);
77

88
export default placesRouter;

server/src/routes/user.routes.ts

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,6 @@
11
import { Router } from 'express';
22
import createUser, { getUserProfile, updateUser } from '../api/user/user.controller';
33
import { middleware } from '../../middleware/middleware';
4-
/**
5-
* @swagger
6-
* /api/signup:
7-
* post:
8-
* summary: Register a new user
9-
* tags: [Users]
10-
* requestBody:
11-
* required: true
12-
* content:
13-
* application/json:
14-
* schema:
15-
* type: object
16-
* required:
17-
* - name
18-
* - email
19-
* - password
20-
* - lat
21-
* - lng
22-
* - location
23-
* properties:
24-
* name:
25-
* type: string
26-
* email:
27-
* type: string
28-
* password:
29-
* type: string
30-
* lat:
31-
* type: number
32-
* lng:
33-
* type: number
34-
* location:
35-
* type: string
36-
* responses:
37-
* 201:
38-
* description: User created successfully
39-
* 400:
40-
* description: Validation error
41-
* 404:
42-
* description: Email already exists
43-
*/
44-
454
const router = Router();
465
router.post('/signup', createUser);
476
router.put('/updateUser',middleware, updateUser);

server/swagger-output.json

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,117 @@
197197
}
198198
}
199199
}
200+
},
201+
"/api/authenticate": {
202+
"get": {
203+
"description": "",
204+
"responses": {
205+
"default": {
206+
"description": ""
207+
}
208+
}
209+
}
210+
},
211+
"/api/createReviews": {
212+
"post": {
213+
"description": "",
214+
"parameters": [
215+
{
216+
"name": "body",
217+
"in": "body",
218+
"schema": {
219+
"type": "object",
220+
"properties": {
221+
"featureId": {
222+
"example": "any"
223+
},
224+
"rating": {
225+
"example": "any"
226+
},
227+
"comment": {
228+
"example": "any"
229+
}
230+
}
231+
}
232+
}
233+
],
234+
"responses": {
235+
"default": {
236+
"description": ""
237+
}
238+
}
239+
}
240+
},
241+
"/api/updateReviews": {
242+
"put": {
243+
"description": "",
244+
"parameters": [
245+
{
246+
"name": "body",
247+
"in": "body",
248+
"schema": {
249+
"type": "object",
250+
"properties": {
251+
"reviewId": {
252+
"example": "any"
253+
},
254+
"rating": {
255+
"example": "any"
256+
},
257+
"comment": {
258+
"example": "any"
259+
}
260+
}
261+
}
262+
}
263+
],
264+
"responses": {
265+
"default": {
266+
"description": ""
267+
}
268+
}
269+
}
270+
},
271+
"/api/deleteReviews": {
272+
"delete": {
273+
"description": "",
274+
"parameters": [
275+
{
276+
"name": "body",
277+
"in": "body",
278+
"schema": {
279+
"type": "object",
280+
"properties": {
281+
"reviewId": {
282+
"example": "any"
283+
}
284+
}
285+
}
286+
}
287+
],
288+
"responses": {
289+
"default": {
290+
"description": ""
291+
}
292+
}
293+
}
294+
},
295+
"/api/getFeatureReviews": {
296+
"get": {
297+
"description": "",
298+
"parameters": [
299+
{
300+
"name": "reviewId",
301+
"in": "query",
302+
"type": "string"
303+
}
304+
],
305+
"responses": {
306+
"default": {
307+
"description": ""
308+
}
309+
}
310+
}
200311
}
201312
}
202313
}

0 commit comments

Comments
 (0)