Skip to content

Commit 1426142

Browse files
committed
cleanup jsdocs
1 parent e46db9b commit 1426142

File tree

3 files changed

+22
-18
lines changed

3 files changed

+22
-18
lines changed

server/types/apiKey.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Model, Document, Types } from 'mongoose';
22
import { VirtualId, MongooseTimestamps } from './mongoose';
33
import { Error, RouteParam } from './express';
44

5+
// -------- MONGOOSE --------
56
/** Full Api Key interface */
67
export interface IApiKey extends VirtualId, MongooseTimestamps {
78
label: string;
@@ -27,20 +28,24 @@ export interface SanitisedApiKey
2728
/** Mongoose model for API Key */
2829
export interface ApiKeyModel extends Model<ApiKeyDocument> {}
2930

30-
// HTTP
31+
// -------- API --------
3132
/**
3233
* Response body for userController.createApiKey & userController.removeApiKey
3334
* - Either an ApiKeyResponse or Error
3435
*/
3536
export type ApiKeyResponseOrError = ApiKeyResponse | Error;
3637

38+
/** Response for api-key related endpoints, containing list of keys */
3739
export interface ApiKeyResponse {
3840
apiKeys: ApiKeyDocument[];
3941
}
4042

43+
/** userController.createApiKey - Request */
4144
export interface CreateApiKeyRequestBody {
4245
label: string;
4346
}
47+
48+
/** userController.removeApiKey - Request */
4449
export interface RemoveApiKeyRequestParams extends RouteParam {
4550
keyId: string;
4651
}

server/types/user.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { EmailConfirmationStates } from './email';
55
import { ApiKeyDocument } from './apiKey';
66
import { Error, GenericResponseBody, RouteParam } from './express';
77

8+
// -------- MONGOOSE --------
89
/** Full User interface */
910
export interface IUser extends VirtualId, MongooseTimestamps {
1011
name: string;
@@ -76,14 +77,13 @@ export interface UserModel extends Model<UserDocument> {
7677
EmailConfirmation(): typeof EmailConfirmationStates;
7778
}
7879

79-
// HTTP:
80+
// -------- API --------
8081
/**
8182
* Response body used for User related routes
8283
* Contains either the Public (sanitised) User or an Error
8384
*/
8485
export type PublicUserOrError = PublicUser | Error;
8586

86-
// authManagement:
8787
/**
8888
* Note: This type should probably be updated to be removed in the future and use just PublicUserOrError
8989
* - Contains either a GenericResponseBody for when there is no user found or attached to a request
@@ -93,6 +93,7 @@ export type PublicUserOrErrorOrGeneric =
9393
| PublicUserOrError
9494
| GenericResponseBody;
9595

96+
/** userController.updateSettings - Request */
9697
export interface UpdateSettingsRequestBody {
9798
username: string;
9899
email: string;
@@ -101,38 +102,39 @@ export interface UpdateSettingsRequestBody {
101102
}
102103

103104
/**
104-
* Response body used for unlinkGithub and unlinkGoogle
105+
* userContoller.unlinkGithub & userContoller.unlinkGoogle - Response
105106
* - If user is not logged in, a GenericResponseBody with 404 is returned
106107
* - If user is logged in, PublicUserOrError is returned
107108
*/
108109
export type UnlinkThirdPartyResponseBody = PublicUserOrErrorOrGeneric;
109110

111+
/** userController.resetPasswordInitiate - Request */
110112
export interface ResetPasswordInitiateRequestBody {
111113
email: string;
112114
}
113115

114-
/**
115-
* Request params used for validateResetPasswordToken & updatePassword
116-
*/
116+
/** userContoller.validateResetPasswordToken & userController.updatePassword - Request */
117117
export interface ResetOrUpdatePasswordRequestParams extends RouteParam {
118118
token: string;
119119
}
120+
/** userController.updatePassword - Request */
120121
export interface UpdatePasswordRequestBody {
121122
password: string;
122123
}
123-
124-
// signup:
124+
/** userController.createUser - Request */
125125
export interface CreateUserRequestBody {
126126
username: string;
127127
email: string;
128128
password: string;
129129
}
130+
/** userController.duplicateUserCheck - Query */
130131
export interface DuplicateUserCheckQuery {
131132
// eslint-disable-next-line camelcase
132133
check_type: 'email' | 'username';
133134
email?: string;
134135
username?: string;
135136
}
137+
/** userController.verifyEmail - Query */
136138
export interface VerifyEmailQuery {
137139
t: string;
138140
}

server/types/userPreferences.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,16 @@ export enum CookieConsentOptions {
2929
ALL = 'all'
3030
}
3131

32-
// HTTP:
33-
34-
export type UpdatePreferencesResponseBody = UserPreferences | Error;
35-
/**
36-
* user.controller.updatePreferences
37-
*/
32+
// -------- API --------
33+
/** user.controller.updatePreferences - Request */
3834
export interface UpdatePreferencesRequestBody {
3935
preferences: Partial<UserPreferences>;
4036
}
4137

42-
/**
43-
* user.controller.updateCookieConsent
44-
*/
38+
/** userController.updatePreferences - Response */
39+
export type UpdatePreferencesResponseBody = UserPreferences | Error;
40+
41+
/** user.controller.updateCookieConsent - Request */
4542
export interface UpdateCookieConsentRequestBody {
4643
cookieConsent: CookieConsentOptions;
4744
}

0 commit comments

Comments
 (0)