Abdul Rehman commited on
Commit
5c5e635
·
1 Parent(s): ed2136f

detail page

Browse files
.history/package_20240903233217.json DELETED
@@ -1,82 +0,0 @@
1
- {
2
- "name": "property",
3
- "version": "0.0.1",
4
- "description": "",
5
- "author": "",
6
- "private": true,
7
- "license": "UNLICENSED",
8
- "scripts": {
9
- "build": "nest build",
10
- "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
11
- "start": "nest start",
12
- "start:dev": "nest start --watch",
13
- "start:debug": "nest start --debug --watch",
14
- "start:prod": "node dist/main",
15
- "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
16
- "test": "jest",
17
- "test:watch": "jest --watch",
18
- "test:cov": "jest --coverage",
19
- "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
20
- "test:e2e": "jest --config ./test/jest-e2e.json"
21
- },
22
- "dependencies": {
23
- "@nestjs/common": "^10.0.0",
24
- "@nestjs/core": "^10.0.0",
25
- "@nestjs/jwt": "^10.2.0",
26
- "@nestjs/passport": "^10.0.3",
27
- "@nestjs/platform-express": "^10.0.0",
28
- "bcrypt": "^5.1.1",
29
- "body-parser": "^1.20.2",
30
- "class-transformer": "^0.5.1",
31
- "class-validator": "^0.14.1",
32
- "cors": "^2.8.5",
33
- "i18n-ts": "^1.0.5",
34
- "jwt-decode": "^4.0.0",
35
- "mongoose": "^8.6.0",
36
- "passport-custom": "^1.1.1",
37
- "passport-jwt": "^4.0.1",
38
- "passport-local": "^1.0.0",
39
- "reflect-metadata": "^0.2.0",
40
- "rxjs": "^7.8.1"
41
- },
42
- "devDependencies": {
43
- "@nestjs/cli": "^10.0.0",
44
- "@nestjs/schematics": "^10.0.0",
45
- "@nestjs/testing": "^10.0.0",
46
- "@types/express": "^4.17.17",
47
- "@types/jest": "^29.5.2",
48
- "@types/node": "^20.3.1",
49
- "@types/supertest": "^6.0.0",
50
- "@typescript-eslint/eslint-plugin": "^8.0.0",
51
- "@typescript-eslint/parser": "^8.0.0",
52
- "eslint": "^8.42.0",
53
- "eslint-config-prettier": "^9.0.0",
54
- "eslint-plugin-prettier": "^5.0.0",
55
- "jest": "^29.5.0",
56
- "prettier": "^3.0.0",
57
- "source-map-support": "^0.5.21",
58
- "supertest": "^7.0.0",
59
- "ts-jest": "^29.1.0",
60
- "ts-loader": "^9.4.3",
61
- "ts-node": "^10.9.1",
62
- "tsconfig-paths": "^4.2.0",
63
- "typescript": "^5.1.3"
64
- },
65
- "jest": {
66
- "moduleFileExtensions": [
67
- "js",
68
- "json",
69
- "ts"
70
- ],
71
- "rootDir": "src",
72
- "testRegex": ".*\\.spec\\.ts$",
73
- "transform": {
74
- "^.+\\.(t|j)s$": "ts-jest"
75
- },
76
- "collectCoverageFrom": [
77
- "**/*.(t|j)s"
78
- ],
79
- "coverageDirectory": "../coverage",
80
- "testEnvironment": "node"
81
- }
82
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.history/package_20240904233750.json DELETED
@@ -1,82 +0,0 @@
1
- {
2
- "name": "property",
3
- "version": "0.0.1",
4
- "description": "",
5
- "author": "",
6
- "private": true,
7
- "license": "UNLICENSED",
8
- "scripts": {
9
- "build": "nest build",
10
- "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
11
- "start": "nest start",
12
- "start:dev": "nest start --watch",
13
- "start:debug": "nest start --debug --watch",
14
- "start:prod": "node dist/main",
15
- "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
16
- "test": "jest",
17
- "test:watch": "jest --watch",
18
- "test:cov": "jest --coverage",
19
- "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
20
- "test:e2e": "jest --config ./test/jest-e2e.json"
21
- },
22
- "dependencies": {
23
- "@nestjs/common": "^10.0.0",
24
- "@nestjs/core": "^10.0.0",
25
- "@nestjs/jwt": "^10.2.0",
26
- "@nestjs/passport": "^10.0.3",
27
- "@nestjs/platform-express": "^10.0.0",
28
- "bcrypt": "^5.1.1",
29
- "body-parser": "^1.20.2",
30
- "class-transformer": "^0.5.1",
31
- "class-validator": "^0.14.1",
32
- "cors": "^2.8.5",
33
- "i18n-ts": "^1.0.5",
34
- "jwt-decode": "^4.0.0",
35
- "mongoose": "^8.6.0",
36
- "passport-custom": "^1.1.1",
37
- "passport-jwt": "^4.0.1",
38
- "passport-local": "^1.0.0",
39
- "reflect-metadata": "^0.2.0",
40
- "rxjs": "^7.8.1"
41
- },
42
- "devDependencies": {
43
- "@nestjs/cli": "^10.0.0",
44
- "@nestjs/schematics": "^10.0.0",
45
- "@nestjs/testing": "^10.0.0",
46
- "@types/express": "^4.17.17",
47
- "@types/jest": "^29.5.2",
48
- "@types/node": "^20.3.1",
49
- "@types/supertest": "^6.0.0",
50
- "@typescript-eslint/eslint-plugin": "^8.0.0",
51
- "@typescript-eslint/parser": "^8.0.0",
52
- "eslint": "^8.42.0",
53
- "eslint-config-prettier": "^9.0.0",
54
- "eslint-plugin-prettier": "^5.0.0",
55
- "jest": "^29.5.0",
56
- "prettier": "^3.0.0",
57
- "source-map-support": "^0.5.21",
58
- "supertest": "^7.0.0",
59
- "ts-jest": "^29.1.0",
60
- "ts-loader": "^9.4.3",
61
- "ts-node": "^10.9.1",
62
- "tsconfig-paths": "^4.2.0",
63
- "typescript": "^5.1.3"
64
- },
65
- "jest": {
66
- "moduleFileExtensions": [
67
- "js",
68
- "json",
69
- "ts"
70
- ],
71
- "rootDir": "src",
72
- "testRegex": ".*\\.spec\\.ts$",
73
- "transform": {
74
- "^.+\\.(t|j)s$": "ts-jest"
75
- },
76
- "collectCoverageFrom": [
77
- "**/*.(t|j)s"
78
- ],
79
- "coverageDirectory": "../coverage",
80
- "testEnvironment": "node"
81
- }
82
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.history/src/main_20240903214937.ts DELETED
@@ -1,23 +0,0 @@
1
- import { NestFactory } from '@nestjs/core';
2
- import { AppModule } from './app.module';
3
- import * as bodyParser from 'body-parser';
4
- import { ValidationPipe } from '@nestjs/common';
5
-
6
- async function bootstrap() {
7
- const app = await NestFactory.create(AppModule);
8
-
9
- app.useGlobalPipes(new ValidationPipe());
10
-
11
- // Enable CORS for all origins and all methods
12
- app.enableCors({
13
- origin: '*', // Allow all origins
14
- methods: '*', // Allow all methods
15
- credentials: true,
16
- });
17
-
18
- app.use(bodyParser.urlencoded({ extended: true }));
19
- app.use(bodyParser.json());
20
-
21
- await app.listen(8080);
22
- }
23
- bootstrap();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.history/src/main_20240905002057.ts DELETED
@@ -1,24 +0,0 @@
1
- import { NestFactory } from '@nestjs/core';
2
- import { AppModule } from './app.module';
3
- import * as bodyParser from 'body-parser';
4
- import { ValidationPipe } from '@nestjs/common';
5
-
6
- async function bootstrap() {
7
- const app = await NestFactory.create(AppModule);
8
-
9
- app.useGlobalPipes(new ValidationPipe());
10
-
11
- // Enable CORS for all origins and all methods
12
- app.enableCors({
13
- // origin: '*', // Allow all origins
14
- origin: ['https://property-fe-h8e2.vercel.app', 'http://localhost:3000'], // Replace with your frontend domain or use '*'
15
- methods: '*', // Allow all methods
16
- credentials: true,
17
- });
18
-
19
- app.use(bodyParser.urlencoded({ extended: true }));
20
- app.use(bodyParser.json());
21
-
22
- await app.listen(8080);
23
- }
24
- bootstrap();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.history/src/modules/property/property.controller_20240903221404.ts DELETED
@@ -1,100 +0,0 @@
1
- import {
2
- Body,
3
- Controller,
4
- Get,
5
- HttpStatus,
6
- Post,
7
- Query,
8
- Req,
9
- Res,
10
- UseGuards,
11
- } from '@nestjs/common';
12
- import { Response } from 'express';
13
- import { CommonServices } from '../shared/common.service';
14
- import { PropertyService } from './property.service';
15
-
16
- @Controller('property')
17
- export class PropertyController extends CommonServices {
18
- constructor(private readonly propertyService: PropertyService) {
19
- super();
20
- }
21
-
22
- @Get('')
23
- async getPropertListings(@Res() res: Response, @Req() req): Promise<any> {
24
- try {
25
- const response = await this.propertyService.sharedFind({});
26
- return this.sendResponse(
27
- this.messages.Success,
28
- response ?? 'NOT_FOUND',
29
- HttpStatus.OK,
30
- res,
31
- );
32
- } catch (error) {
33
- return this.sendResponse(
34
- 'Internal server Error',
35
- {},
36
- HttpStatus.INTERNAL_SERVER_ERROR,
37
- res,
38
- );
39
- }
40
- }
41
-
42
- /**
43
- *
44
- * @param query
45
- * @param res
46
- * @param req
47
- */
48
- @Get('/listings/dashboard')
49
- async getDashboardLisings(@Res() res, @Req() req) {
50
- try {
51
- const listings = await this.propertyService.propertyRepository
52
- .find({})
53
- .sort({ _id: -1 })
54
- .limit(20);
55
-
56
- this.sendResponse(this.messages.Success, listings, HttpStatus.OK, res);
57
- } catch (error) {
58
- console.error('error', error);
59
- this.sendResponse(
60
- this.messages.Error,
61
- null,
62
- HttpStatus.INTERNAL_SERVER_ERROR,
63
- res,
64
- );
65
- }
66
- }
67
-
68
- /**
69
- *
70
- * @param query
71
- * @param res
72
- * @param req
73
- */
74
- @Get('/listings')
75
- async getDashboardActiveUsers(@Query() query, @Res() res, @Req() req) {
76
- try {
77
- const page = Number(query.page);
78
- const resPerPage = query.resPerPage ? Number(query.resPerPage) : 20;
79
- const search = query.search;
80
-
81
- console.log(`search =>`, search);
82
-
83
- const activeUsers = await this.propertyService.propertyLisitng(
84
- page,
85
- resPerPage,
86
- search,
87
- );
88
-
89
- this.sendResponse(this.messages.Success, activeUsers, HttpStatus.OK, res);
90
- } catch (error) {
91
- console.error('error', error);
92
- this.sendResponse(
93
- this.messages.Error,
94
- null,
95
- HttpStatus.INTERNAL_SERVER_ERROR,
96
- res,
97
- );
98
- }
99
- }
100
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.history/src/modules/property/property.controller_20240904225916.ts DELETED
@@ -1,100 +0,0 @@
1
- import {
2
- Body,
3
- Controller,
4
- Get,
5
- HttpStatus,
6
- Post,
7
- Query,
8
- Req,
9
- Res,
10
- UseGuards,
11
- } from '@nestjs/common';
12
- import { Response } from 'express';
13
- import { CommonServices } from '../shared/common.service';
14
- import { PropertyService } from './property.service';
15
-
16
- @Controller('property')
17
- export class PropertyController extends CommonServices {
18
- constructor(private readonly propertyService: PropertyService) {
19
- super();
20
- }
21
-
22
- @Get('')
23
- async getPropertListings(@Res() res: Response, @Req() req): Promise<any> {
24
- try {
25
- const response = await this.propertyService.sharedFind({});
26
- return this.sendResponse(
27
- this.messages.Success,
28
- response ?? 'NOT_FOUND',
29
- HttpStatus.OK,
30
- res,
31
- );
32
- } catch (error) {
33
- return this.sendResponse(
34
- 'Internal server Error',
35
- {},
36
- HttpStatus.INTERNAL_SERVER_ERROR,
37
- res,
38
- );
39
- }
40
- }
41
-
42
- /**
43
- *
44
- * @param query
45
- * @param res
46
- * @param req
47
- */
48
- @Get('/listings/dashboard')
49
- async getDashboardLisings(@Res() res, @Req() req) {
50
- try {
51
- const listings = await this.propertyService.propertyRepository
52
- .find({})
53
- .sort({ _id: -1 })
54
- .limit(20);
55
-
56
- this.sendResponse(this.messages.Success, listings, HttpStatus.OK, res);
57
- } catch (error) {
58
- console.error('error', error);
59
- this.sendResponse(
60
- this.messages.Error,
61
- null,
62
- HttpStatus.INTERNAL_SERVER_ERROR,
63
- res,
64
- );
65
- }
66
- }
67
-
68
- /**
69
- *
70
- * @param query
71
- * @param res
72
- * @param req
73
- */
74
- @Get('/listings')
75
- async getDashboardActiveUsers(@Query() query, @Res() res, @Req() req) {
76
- try {
77
- const page = Number(query.page);
78
- const resPerPage = query.resPerPage ? Number(query.resPerPage) : 20;
79
- const search = query.search;
80
-
81
- console.log(`search =>`, query);
82
-
83
- const activeUsers = await this.propertyService.propertyLisitng(
84
- page,
85
- resPerPage,
86
- search,
87
- );
88
-
89
- this.sendResponse(this.messages.Success, activeUsers, HttpStatus.OK, res);
90
- } catch (error) {
91
- console.error('error', error);
92
- this.sendResponse(
93
- this.messages.Error,
94
- null,
95
- HttpStatus.INTERNAL_SERVER_ERROR,
96
- res,
97
- );
98
- }
99
- }
100
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.history/src/modules/property/property.controller_20240904230453.ts DELETED
@@ -1,100 +0,0 @@
1
- import {
2
- Body,
3
- Controller,
4
- Get,
5
- HttpStatus,
6
- Post,
7
- Query,
8
- Req,
9
- Res,
10
- UseGuards,
11
- } from '@nestjs/common';
12
- import { Response } from 'express';
13
- import { CommonServices } from '../shared/common.service';
14
- import { PropertyService } from './property.service';
15
-
16
- @Controller('property')
17
- export class PropertyController extends CommonServices {
18
- constructor(private readonly propertyService: PropertyService) {
19
- super();
20
- }
21
-
22
- @Get('')
23
- async getPropertListings(@Res() res: Response, @Req() req): Promise<any> {
24
- try {
25
- const response = await this.propertyService.sharedFind({});
26
- return this.sendResponse(
27
- this.messages.Success,
28
- response ?? 'NOT_FOUND',
29
- HttpStatus.OK,
30
- res,
31
- );
32
- } catch (error) {
33
- return this.sendResponse(
34
- 'Internal server Error',
35
- {},
36
- HttpStatus.INTERNAL_SERVER_ERROR,
37
- res,
38
- );
39
- }
40
- }
41
-
42
- /**
43
- *
44
- * @param query
45
- * @param res
46
- * @param req
47
- */
48
- @Get('/listings/dashboard')
49
- async getDashboardLisings(@Res() res, @Req() req) {
50
- try {
51
- const listings = await this.propertyService.propertyRepository
52
- .find({})
53
- .sort({ _id: -1 })
54
- .limit(20);
55
-
56
- this.sendResponse(this.messages.Success, listings, HttpStatus.OK, res);
57
- } catch (error) {
58
- console.error('error', error);
59
- this.sendResponse(
60
- this.messages.Error,
61
- null,
62
- HttpStatus.INTERNAL_SERVER_ERROR,
63
- res,
64
- );
65
- }
66
- }
67
-
68
- /**
69
- *
70
- * @param query
71
- * @param res
72
- * @param req
73
- */
74
- @Get('/listings')
75
- async getDashboardActiveUsers(@Query() query, @Res() res, @Req() req) {
76
- try {
77
- const page = Number(query.page);
78
- const resPerPage = query.resPerPage ? Number(query.resPerPage) : 20;
79
- const search = query.search || ''; // Default to empty search if not provided
80
-
81
- console.log(`search =>`, query);
82
-
83
- const activeUsers = await this.propertyService.propertyLisitng(
84
- page,
85
- resPerPage,
86
- search,
87
- );
88
-
89
- this.sendResponse(this.messages.Success, activeUsers, HttpStatus.OK, res);
90
- } catch (error) {
91
- console.error('error', error);
92
- this.sendResponse(
93
- this.messages.Error,
94
- null,
95
- HttpStatus.INTERNAL_SERVER_ERROR,
96
- res,
97
- );
98
- }
99
- }
100
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.history/src/modules/property/property.controller_20240904230611.ts DELETED
@@ -1,100 +0,0 @@
1
- import {
2
- Body,
3
- Controller,
4
- Get,
5
- HttpStatus,
6
- Post,
7
- Query,
8
- Req,
9
- Res,
10
- UseGuards,
11
- } from '@nestjs/common';
12
- import { Response } from 'express';
13
- import { CommonServices } from '../shared/common.service';
14
- import { PropertyService } from './property.service';
15
-
16
- @Controller('property')
17
- export class PropertyController extends CommonServices {
18
- constructor(private readonly propertyService: PropertyService) {
19
- super();
20
- }
21
-
22
- @Get('')
23
- async getPropertListings(@Res() res: Response, @Req() req): Promise<any> {
24
- try {
25
- const response = await this.propertyService.sharedFind({});
26
- return this.sendResponse(
27
- this.messages.Success,
28
- response ?? 'NOT_FOUND',
29
- HttpStatus.OK,
30
- res,
31
- );
32
- } catch (error) {
33
- return this.sendResponse(
34
- 'Internal server Error',
35
- {},
36
- HttpStatus.INTERNAL_SERVER_ERROR,
37
- res,
38
- );
39
- }
40
- }
41
-
42
- /**
43
- *
44
- * @param query
45
- * @param res
46
- * @param req
47
- */
48
- @Get('/listings/dashboard')
49
- async getDashboardLisings(@Res() res, @Req() req) {
50
- try {
51
- const listings = await this.propertyService.propertyRepository
52
- .find({})
53
- .sort({ _id: -1 })
54
- .limit(20);
55
-
56
- this.sendResponse(this.messages.Success, listings, HttpStatus.OK, res);
57
- } catch (error) {
58
- console.error('error', error);
59
- this.sendResponse(
60
- this.messages.Error,
61
- null,
62
- HttpStatus.INTERNAL_SERVER_ERROR,
63
- res,
64
- );
65
- }
66
- }
67
-
68
- /**
69
- *
70
- * @param query
71
- * @param res
72
- * @param req
73
- */
74
- @Get('/listings')
75
- async getDashboardActiveUsers(@Query() query, @Res() res, @Req() req) {
76
- try {
77
- const page = Number(query.page);
78
- const resPerPage = query.resPerPage ? Number(query.resPerPage) : 20;
79
- const search = query.search || ''; // Default to empty search if not provided
80
-
81
- console.log(`search =>`, query);
82
-
83
- const listings = await this.propertyService.propertyLisitng(
84
- page,
85
- resPerPage,
86
- search,
87
- );
88
-
89
- this.sendResponse(this.messages.Success, listings, HttpStatus.OK, res);
90
- } catch (error) {
91
- console.error('error', error);
92
- this.sendResponse(
93
- this.messages.Error,
94
- null,
95
- HttpStatus.INTERNAL_SERVER_ERROR,
96
- res,
97
- );
98
- }
99
- }
100
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.history/src/modules/property/property.controller_20240904230817.ts DELETED
@@ -1,100 +0,0 @@
1
- import {
2
- Body,
3
- Controller,
4
- Get,
5
- HttpStatus,
6
- Post,
7
- Query,
8
- Req,
9
- Res,
10
- UseGuards,
11
- } from '@nestjs/common';
12
- import { Response } from 'express';
13
- import { CommonServices } from '../shared/common.service';
14
- import { PropertyService } from './property.service';
15
-
16
- @Controller('property')
17
- export class PropertyController extends CommonServices {
18
- constructor(private readonly propertyService: PropertyService) {
19
- super();
20
- }
21
-
22
- @Get('')
23
- async getPropertListings(@Res() res: Response, @Req() req): Promise<any> {
24
- try {
25
- const response = await this.propertyService.sharedFind({});
26
- return this.sendResponse(
27
- this.messages.Success,
28
- response ?? 'NOT_FOUND',
29
- HttpStatus.OK,
30
- res,
31
- );
32
- } catch (error) {
33
- return this.sendResponse(
34
- 'Internal server Error',
35
- {},
36
- HttpStatus.INTERNAL_SERVER_ERROR,
37
- res,
38
- );
39
- }
40
- }
41
-
42
- /**
43
- *
44
- * @param query
45
- * @param res
46
- * @param req
47
- */
48
- @Get('/listings/dashboard')
49
- async getDashboardLisings(@Res() res, @Req() req) {
50
- try {
51
- const listings = await this.propertyService.propertyRepository
52
- .find({})
53
- .sort({ _id: -1 })
54
- .limit(20);
55
-
56
- this.sendResponse(this.messages.Success, listings, HttpStatus.OK, res);
57
- } catch (error) {
58
- console.error('error', error);
59
- this.sendResponse(
60
- this.messages.Error,
61
- null,
62
- HttpStatus.INTERNAL_SERVER_ERROR,
63
- res,
64
- );
65
- }
66
- }
67
-
68
- /**
69
- *
70
- * @param query
71
- * @param res
72
- * @param req
73
- */
74
- @Get('/listings')
75
- async getDashboardActiveUsers(@Query() query, @Res() res, @Req() req) {
76
- try {
77
- const page = Number(query.page);
78
- const resPerPage = query.resPerPage ? Number(query.resPerPage) : 20;
79
- const search = query.search || ''; // Default to empty search if not provided
80
-
81
- console.log(`search =>`, query);
82
-
83
- const listings = await this.propertyService.propertyLisitng(
84
- page,
85
- resPerPage,
86
- search,
87
- );
88
-
89
- this.sendResponse(this.messages.Success, listings, HttpStatus.OK, res);
90
- } catch (error) {
91
- console.error('error', error);
92
- this.sendResponse(
93
- this.messages.Error,
94
- null,
95
- HttpStatus.INTERNAL_SERVER_ERROR,
96
- res,
97
- );
98
- }
99
- }
100
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.history/src/modules/property/property.service_20240903213534.ts DELETED
@@ -1,44 +0,0 @@
1
- import { Inject, Injectable } from '@nestjs/common';
2
- import { Model, Types } from 'mongoose';
3
- import { sharedCrudService } from '../shared/sharedCrud.services';
4
- import { PROPERTY_REPOSITORY } from 'src/constants';
5
- import { IPropertyDocument } from './property.schema';
6
-
7
- @Injectable()
8
- export class PropertyService extends sharedCrudService {
9
- constructor(
10
- @Inject(PROPERTY_REPOSITORY)
11
- readonly propertyRepository: Model<IPropertyDocument>,
12
- ) {
13
- super(propertyRepository);
14
- }
15
-
16
- async propertyLisitng(
17
- page: number,
18
- resPerPage: number,
19
- search: string,
20
- ): Promise<any> {
21
- const query = [];
22
- query.push({ id: { $exists: true } });
23
-
24
- if (search) query.push({ title: { $regex: search, $options: 'i' } });
25
-
26
- const [users, cusersCount] = await Promise.all([
27
- this.propertyRepository
28
- .find({ $and: [...query] })
29
- .sort({ createdAt: -1 })
30
- .skip(resPerPage * (page - 1))
31
- .limit(resPerPage)
32
- .exec(),
33
- this.propertyRepository.countDocuments({ $and: [...query] }).exec(),
34
- ]);
35
-
36
- return {
37
- users,
38
- current_page: page,
39
- pages: Math.ceil(cusersCount / resPerPage),
40
- total_users: cusersCount,
41
- per_page: resPerPage,
42
- };
43
- }
44
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.history/src/modules/property/property.service_20240904230816.ts DELETED
@@ -1,44 +0,0 @@
1
- import { Inject, Injectable } from '@nestjs/common';
2
- import { Model, Types } from 'mongoose';
3
- import { sharedCrudService } from '../shared/sharedCrud.services';
4
- import { PROPERTY_REPOSITORY } from 'src/constants';
5
- import { IPropertyDocument } from './property.schema';
6
-
7
- @Injectable()
8
- export class PropertyService extends sharedCrudService {
9
- constructor(
10
- @Inject(PROPERTY_REPOSITORY)
11
- readonly propertyRepository: Model<IPropertyDocument>,
12
- ) {
13
- super(propertyRepository);
14
- }
15
-
16
- async propertyLisitng(
17
- page: number,
18
- resPerPage: number,
19
- search: string,
20
- ): Promise<any> {
21
- const query = [];
22
- query.push({ id: { $exists: true } });
23
-
24
- if (search) query.push({ title: { $regex: search, $options: 'i' } });
25
-
26
- const [listings, tLisitngsCount] = await Promise.all([
27
- this.propertyRepository
28
- .find({ $and: [...query] })
29
- .sort({ createdAt: -1 })
30
- .skip(resPerPage * (page - 1))
31
- .limit(resPerPage)
32
- .exec(),
33
- this.propertyRepository.countDocuments({ $and: [...query] }).exec(),
34
- ]);
35
-
36
- return {
37
- listings,
38
- current_page: page,
39
- pages: Math.ceil(tLisitngsCount / resPerPage),
40
- total_listings: tLisitngsCount,
41
- per_page: resPerPage,
42
- };
43
- }
44
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.history/vercel_20240904233652.json DELETED
File without changes
.history/vercel_20240904233655.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "version": 2,
3
- "builds": [
4
- {
5
- "src": "dist/main.js",
6
- "use": "@vercel/node"
7
- }
8
- ],
9
- "routes": [
10
- {
11
- "src": "/(.*)",
12
- "dest": "/dist/main.js"
13
- }
14
- ]
15
- }
16
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.history/vercel_20240904234136.json DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "version": 2,
3
- "routes": [
4
- {
5
- "src": "/(.*)",
6
- "headers": {
7
- "Access-Control-Allow-Origin": "*",
8
- "Access-Control-Allow-Methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
9
- "Access-Control-Allow-Headers": "Content-Type, Authorization"
10
- },
11
- "dest": "/dist/main.js"
12
- }
13
- ]
14
- }
15
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.history/vercel_20240904234423.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "version": 2,
3
- "builds": [
4
- {
5
- "src": "dist/main.js",
6
- "use": "@vercel/node"
7
- }
8
- ],
9
- "routes": [
10
- {
11
- "src": "/(.*)",
12
- "headers": {
13
- "Access-Control-Allow-Origin": "*",
14
- "Access-Control-Allow-Methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
15
- "Access-Control-Allow-Headers": "Content-Type, Authorization"
16
- },
17
- "dest": "/dist/main.js"
18
- }
19
- ]
20
- }
21
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.history/vercel_20240905000611.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "version": 2,
3
- "builds": [
4
- {
5
- "src": "src/main.js",
6
- "use": "@vercel/node"
7
- }
8
- ],
9
- "routes": [
10
- {
11
- "src": "/(.*)",
12
- "headers": {
13
- "Access-Control-Allow-Origin": "*",
14
- "Access-Control-Allow-Methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
15
- "Access-Control-Allow-Headers": "Content-Type, Authorization"
16
- },
17
- "dest": "/dist/main.js"
18
- }
19
- ]
20
- }
21
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.history/vercel_20240905000636.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "version": 2,
3
- "builds": [
4
- {
5
- "src": "src/main.js",
6
- "use": "@vercel/node"
7
- }
8
- ],
9
- "routes": [
10
- {
11
- "src": "/(.*)",
12
- "headers": {
13
- "Access-Control-Allow-Origin": "*",
14
- "Access-Control-Allow-Methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
15
- "Access-Control-Allow-Headers": "Content-Type, Authorization"
16
- },
17
- "dest": "/src/main.js"
18
- }
19
- ]
20
- }
21
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.history/vercel_20240905000650.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "version": 2,
3
- "builds": [
4
- {
5
- "src": "src/main.js",
6
- "use": "@vercel/node"
7
- }
8
- ],
9
- "routes": [
10
- {
11
- "src": "/(.*)",
12
- "headers": {
13
- "Access-Control-Allow-Origin": "*",
14
- "Access-Control-Allow-Methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
15
- "Access-Control-Allow-Headers": "Content-Type, Authorization"
16
- },
17
- "dest": "/src/main.js"
18
- }
19
- ]
20
- }
21
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.history/vercel_20240905000653.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "version": 2,
3
- "builds": [
4
- {
5
- "src": "src/main.js",
6
- "use": "@vercel/node"
7
- }
8
- ],
9
- "routes": [
10
- {
11
- "src": "/(.*)",
12
- "headers": {
13
- "Access-Control-Allow-Origin": "*",
14
- "Access-Control-Allow-Methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
15
- "Access-Control-Allow-Headers": "Content-Type, Authorization"
16
- },
17
- "dest": "/src/main.js"
18
- }
19
- ]
20
- }
21
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.history/vercel_20240905000757.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "version": 2,
3
- "builds": [
4
- {
5
- "src": "src/main.ts",
6
- "use": "@vercel/node"
7
- }
8
- ],
9
- "routes": [
10
- {
11
- "src": "/(.*)",
12
- "dest": "src/main.ts",
13
- "methods": ["GET", "POST", "PUT", "DELETE"]
14
- }
15
- ]
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.history/vercel_20240905002105.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "version": 2,
3
- "builds": [
4
- {
5
- "src": "dist/main.ts",
6
- "use": "@vercel/node"
7
- }
8
- ],
9
- "routes": [
10
- {
11
- "src": "/(.*)",
12
- "dest": "dist/main.ts",
13
- "methods": ["GET", "POST", "PUT", "DELETE"]
14
- }
15
- ]
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.history/vercel_20240905002203.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "version": 2,
3
- "builds": [
4
- {
5
- "src": "dist/main.js",
6
- "use": "@vercel/node"
7
- }
8
- ],
9
- "routes": [
10
- {
11
- "src": "/(.*)",
12
- "dest": "dist/main.js",
13
- "methods": ["GET", "POST", "PUT", "DELETE"]
14
- }
15
- ]
16
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/modules/property/property.controller.ts CHANGED
@@ -97,4 +97,30 @@ export class PropertyController extends CommonServices {
97
  );
98
  }
99
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  }
 
97
  );
98
  }
99
  }
100
+
101
+ /**
102
+ *
103
+ * @param query
104
+ * @param res
105
+ * @param req
106
+ */
107
+ @Get('/detail')
108
+ async getPropertyDetails(@Query() query, @Res() res, @Req() req) {
109
+ try {
110
+ const id = query.id;
111
+
112
+ const property =
113
+ await this.propertyService.propertyRepository.findById(id);
114
+
115
+ this.sendResponse(this.messages.Success, property, HttpStatus.OK, res);
116
+ } catch (error) {
117
+ console.error('error', error);
118
+ this.sendResponse(
119
+ this.messages.Error,
120
+ null,
121
+ HttpStatus.INTERNAL_SERVER_ERROR,
122
+ res,
123
+ );
124
+ }
125
+ }
126
  }