From 5983d79307142f018cd07b1e994d14c610f65115 Mon Sep 17 00:00:00 2001
From: tushar5526 <codingid6@gmail.com>
Date: Wed, 28 Dec 2022 14:12:36 +0530
Subject: [PATCH] feat: added student and tutor getdata paths

---
 src/app.controller.ts | 10 ++++++++++
 src/app.service.ts    | 17 ++++++++++++++++-
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/src/app.controller.ts b/src/app.controller.ts
index ae571fa..287e752 100644
--- a/src/app.controller.ts
+++ b/src/app.controller.ts
@@ -28,4 +28,14 @@ export class AppController {
   getUserCredentials(@Param() params) {
     return this.appService.getUserCredentials(params.id);
   }
+
+  @Get('student/:id')
+  getStudent(@Param() params) {
+    return this.appService.getStudentById(params.id);
+  }
+
+  @Get('tutor/:id')
+  getTutor(@Param() params) {
+    return this.appService.getTutorById(params.id);
+  }
 }
diff --git a/src/app.service.ts b/src/app.service.ts
index b0ad5f4..02c7bbe 100644
--- a/src/app.service.ts
+++ b/src/app.service.ts
@@ -1,6 +1,5 @@
 import { Injectable, Inject } from '@nestjs/common';
 import { MSSQL_CONNECTION } from './constants';
-import * as bcrypt from 'bcrypt';
 import * as CryptoJS from 'crypto';
 
 @Injectable()
@@ -108,4 +107,20 @@ export class AppService {
     });
     return cred_res[0];
   }
+
+  async getTutorById(id: string) {
+    const db = await this.conn.connect();
+    const res = await db.query(
+      `Select * from test.dbo.Master_Tutor_Basic_Info where TutorKey='${id}'`,
+    );
+    return res.recordset[0];
+  }
+
+  async getStudentById(id: string) {
+    const db = await this.conn.connect();
+    const res = await db.query(
+      `Select * from test.dbo.Master_StudentProfile where StudentProfileKey='${id}'`,
+    );
+    return res.recordset[0];
+  }
 }
-- 
GitLab