@@ -10,11 +10,10 @@ interface Response {
1010}
1111
1212
13+ /**
14+ * Service class for visitors
15+ */
1316class Visitor {
14- /**
15- * @param {VisitorRepository } visitorRepository
16- * @param {any= } body
17- */
1817 private readonly visitorRepository : VisitorRepository ;
1918 readonly body ;
2019 constructor ( visitorRepository : VisitorRepository , body ?: any ) {
@@ -23,17 +22,17 @@ class Visitor {
2322 }
2423
2524 /**
26- * @description Method for retrieving number of visitors
27- * @returns { VisitorDto } visitorCnt
25+ * Method for retrieving number of visitors
26+ * @returns visitorCnt `{ todayCount: number, totalCount: number }`
2827 */
2928 async getVisitorCnt ( ) {
3029 const visitorCnt = await this . visitorRepository . getVisitorCnt ( ) ;
3130 return visitorCnt ;
3231 }
3332
3433 /**
35- * @description Update the number of visitors every time they visit your portfolio web
36- * @returns { VisitorDto } visitorCnt
34+ * Update the number of visitors every time they visit your portfolio web
35+ * @returns visitorCnt `{ todayCount: number, totalCount: number }`
3736 */
3837 async updateAndGetVisitorCnt ( ) {
3938 const todayDate = await this . visitorRepository . getVisitorTodayDate ( ) ;
@@ -59,7 +58,8 @@ class Visitor {
5958 }
6059
6160 /**
62- * @description Create visitor comment information
61+ * Create visitor comment information
62+ * @returns Promise to return a unique ID for the generated visit comment of the string type
6363 */
6464 async createComment ( ) : Promise < number > {
6565 const { body } = this ;
@@ -82,9 +82,9 @@ class Visitor {
8282 }
8383
8484 /**
85- * @description Method for password encryption
86- * @param { string } password
87- * @returns { Promise< string> }
85+ * Method for password encryption
86+ * @param password String type as value before encryption
87+ * @returns Encrypt password to return a promise of string type
8888 */
8989 private async encryptPassword ( password : string ) : Promise < string > {
9090 const saltRounds = 10 ;
@@ -99,8 +99,11 @@ class Visitor {
9999 }
100100
101101 /**
102- * @param {number } visitorCommentId update target id
103- * @returns {Promise<Response> }
102+ * Visit comment update method
103+ * @param visitorCommentId Unique ID for modification of number type
104+ * @returns `{ success: boolean, msg: string }`
105+ * The password matches to perform the operation and returns a successful result or a failure result.
106+ * Throw error if no data exists for requested id.
104107 */
105108 async updateCommentById ( visitorCommentId : number ) : Promise < Response > {
106109 const { password, description } : VisitorCmtDto = this . body ;
@@ -131,17 +134,18 @@ class Visitor {
131134 }
132135
133136 /**
134- * @param {string } password
135- * @param {string } encryptedPassword
136- * @returns {Promise<boolean> } password Verification
137+ * Methods to check for matching encrypted passwords
138+ * @param password Password Verification Target
139+ * @param encryptedPassword Valid password for string type
140+ * @returns Match comparison results to return success or reject due to error
137141 */
138142 private async comparePassword ( password : string , encryptedPassword : string ) {
139143 return await bcrypt . compare ( password , encryptedPassword ) ;
140144 }
141145
142- /**
143- * @description All visitor comment list retrieval methods
144- * @returns { Promise<{ visitorComments: VisitorCmtEntity[] }> }
146+ /**
147+ * Methods for querying all visitor comments
148+ * @returns `{ visitorComments: [{ id: number, nickname: string, description: string, date: string}]}`
145149 */
146150 async getVisitorComments ( ) : Promise < { visitorComments : VisitorCmtEntity [ ] } > {
147151 const visitorComments = await this . visitorRepository . getVisitorComments ( ) ;
@@ -150,8 +154,9 @@ class Visitor {
150154 }
151155
152156 /**
153- * @param {number } visitorCommentId visitor comment id you want to delete
154- * @returns {Promise<boolean> }
157+ * Method to delete visiting comments corresponding to IDs
158+ * @param visitorCommentId Unique ID for deletion of number type
159+ * @returns Returns an error because there is no target for deletion or returns true for success
155160 */
156161 async deleteVisitorCommentById ( visitorCommentId : number ) : Promise < boolean > {
157162 const visitorComment = await this . visitorRepository . getVisitorCommentById (
0 commit comments