Skip to content

Commit a8da974

Browse files
committed
[Update] Modify TypeDoc #15
1 parent a242b4f commit a8da974

File tree

5 files changed

+32
-36
lines changed

5 files changed

+32
-36
lines changed

server/app/src/apis/module/error.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,9 @@ import {
66
import { Response } from 'express';
77

88
/**
9-
* @typedef {Object} ErrorResponse
10-
* @property {number} statusCode error code
11-
* @property {msg} msg error message
12-
*/
13-
14-
/**
15-
* @description Response branch processing logic for each error code
16-
* @param {unknown | ServerError | BadRequestError | NotFoundError} err error types
17-
* @param {Response} res
9+
* Branch handling of error code capabilities for error codes
10+
* @param err `{ unknown | ServerError | BadRequestError | NotFoundError }`
11+
* @param res
1812
* @returns {Response<ErrorResponse>} res
1913
*/
2014
function errorResposne(

server/app/src/apis/module/validator.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import { IsOptional, Length } from 'class-validator';
22

3-
/**
4-
* @description class for validation
5-
*/
63
class VisitorCommentValidator {
74
@IsOptional()
85
@Length(0, 20)

server/app/src/apis/visitor/visitor.ctrl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { VisitorCmtDto } from './visitor';
99
* Visitor increase and lookup API
1010
* @url /apis/visitor/count
1111
* @method patch
12-
* @resBody `{ statusCode: number, todayCount: number, totalCount: number, todayDate: string }`
12+
* @resBody `{ statusCode: number, todayCount: number, totalCount: number }`
1313
* success response body
1414
* @resBody `{ statusCode: number, msg: string }` fail response body
1515
*/

server/app/src/apis/visitor/visitor.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { RowDataPacket } from 'mysql2';
33
export interface VisitorDto extends RowDataPacket {
44
todayCount: number;
55
totalCount: number;
6-
todayDate: string;
6+
todayDate?: string;
77
}
88

99
export interface VisitorCmtDto {

server/app/src/service/visitor.ts

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ interface Response {
1010
}
1111

1212

13+
/**
14+
* Service class for visitors
15+
*/
1316
class 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

Comments
 (0)