@@ -7,7 +7,14 @@ import {
77import db from '../config/db' ;
88import { ServerError } from '../service/error' ;
99
10+ /**
11+ * Visitor-related data processing class
12+ */
1013class VisitorRepository {
14+ /**
15+ * Today number of visitors and total number of visitors inquiry method
16+ * @returns `{ todayCount: number, totalCount: number }`
17+ */
1118 async getVisitorCnt ( ) : Promise < VisitorDto > {
1219 let conn ;
1320 try {
@@ -28,6 +35,10 @@ class VisitorRepository {
2835 }
2936 }
3037
38+ /**
39+ * Today's visits and total visits increase method
40+ * @returns `boolean` Whether to update
41+ */
3142 async updateTodayVisitorCnt ( ) : Promise < number > {
3243 let conn ;
3344 try {
@@ -48,6 +59,11 @@ class VisitorRepository {
4859 }
4960 }
5061
62+ /**
63+ * Inquery today's date for visitor count table
64+ * @returns `string` today's date
65+ * @example 2022-09-12 00:00:00
66+ */
5167 async getVisitorTodayDate ( ) {
5268 let conn ;
5369 try {
@@ -66,6 +82,12 @@ class VisitorRepository {
6682 }
6783 }
6884
85+ /**
86+ * Request date and number of visitors today, total number of visitors update method
87+ * @params
88+ * @todayDate `string` today date
89+ * @returns `boolean` Whether to update
90+ */
6991 async updateTodayAndToTalVisitorCnt ( todayDate : string ) {
7092 let conn ;
7193 try {
@@ -86,6 +108,11 @@ class VisitorRepository {
86108 }
87109 }
88110
111+ /**
112+ * Visit comment generation method
113+ * @params `{ nickname: string, password: string, description: string }`
114+ * @returns `number` Unique ID of the updated visit comment
115+ */
89116 async createComment ( {
90117 nickname,
91118 password,
@@ -113,6 +140,11 @@ class VisitorRepository {
113140 }
114141 }
115142
143+ /**
144+ * Visit comment inquery method for ID
145+ * @params `number` Unique ID of the inquery target
146+ * @returns `{ id: number, nickname: string, description: string, date: string }`
147+ */
116148 async getVisitorCommentById (
117149 visitorCommentId : number
118150 ) : Promise < VisitorCmtEntity > {
@@ -132,6 +164,13 @@ class VisitorRepository {
132164 }
133165 }
134166
167+ /**
168+ * Save visit comment modification method
169+ * @params
170+ * @visitorCommentId `number` Unique ID to be modified
171+ * @description `string` Modified comments
172+ * @returns `boolean` Whether to update
173+ */
135174 async updateVisitorComment (
136175 visitorCommentId : number ,
137176 description : string
@@ -153,6 +192,10 @@ class VisitorRepository {
153192 }
154193 }
155194
195+ /**
196+ * All visit comment inquery method
197+ * @returns `[{ id: number, nickname: string, description: string, date: string }]`
198+ */
156199 async getVisitorComments ( ) : Promise < VisitorCmtEntity [ ] > {
157200 let conn ;
158201 try {
@@ -170,6 +213,12 @@ class VisitorRepository {
170213 }
171214 }
172215
216+ /**
217+ * Delete visiting comments with unique ID method
218+ * @params
219+ * @id `number` Unique ID for deletion
220+ * @returns `boolean` Whether to update
221+ */
173222 async deleteVisitorCommentById ( id : number ) : Promise < number > {
174223 let conn ;
175224 try {
0 commit comments