Skip to content

Commit

Permalink
thjs-63: * fix shared workspace linter
Browse files Browse the repository at this point in the history
  • Loading branch information
v0ldemar01 committed Dec 16, 2023
1 parent f883416 commit 8dabef9
Show file tree
Hide file tree
Showing 29 changed files with 63 additions and 55 deletions.
5 changes: 3 additions & 2 deletions shared/src/libs/exceptions/http-error/http-error.exception.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { type ValueOf } from '~/libs/types/types.js';

import { ExceptionName } from '../../enums/enums.js';
import { HttpCode } from '../../packages/http/http.js';

Expand All @@ -10,9 +11,9 @@ type Constructor = {
};

class HttpError extends Error {
status: ValueOf<typeof HttpCode>;
public status: ValueOf<typeof HttpCode>;

constructor({
public constructor({
status = HttpCode.INTERNAL_SERVER_ERROR,
message = DEFAULT_MESSAGE
}: Partial<Constructor> = {}) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ExceptionMessage, ExceptionName } from '../../enums/enums.js';

class InvalidCredentialsError extends Error {
constructor(message: string = ExceptionMessage.INCORRECT_EMAIL) {
public constructor(message: string = ExceptionMessage.INCORRECT_EMAIL) {
super(message);
this.name = ExceptionName.INVALID_CREDENTIALS;
}
Expand Down
1 change: 0 additions & 1 deletion shared/src/libs/helpers/any/any.ts

This file was deleted.

4 changes: 3 additions & 1 deletion shared/src/libs/helpers/date/get-diff/get-diff.helper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { dayjs } from '../dayjs/dayjs.js';

const getDiff = (a, b) => dayjs(a).diff(b);
const getDiff = (a: Date | string, b: Date | string): number => {
return dayjs(a).diff(b);
};

export { getDiff };
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { dayjs } from '../dayjs/dayjs.js';

const getFromNowTime = date => dayjs(date).fromNow();
const getFromNowTime = (date: Date): string => dayjs(date).fromNow();

export { getFromNowTime };
2 changes: 1 addition & 1 deletion shared/src/packages/comment/comment.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export { CommentPayloadKey, CommentsApiPath } from './libs/enums/enums.js';
export {
type CommentWithUserNestedRelations,
type Comment,
type CommentWithUserNestedRelations,
type CreateCommentRequestDto,
type GetCommentByIdResponseDto
} from './libs/types/types.js';
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { UserWithImageRelation } from '~/packages/user/user.js';
import { Comment } from './comment.type.js';
import { type UserWithImageRelation } from '~/packages/user/user.js';

import { type Comment } from './comment.type.js';

type CommentWithUserNestedRelations = Comment &
Record<'user', UserWithImageRelation>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Comment } from './comment.type.js';
import { type Comment } from './comment.type.js';

type CreateCommentRequestDto = Pick<Comment, 'body' | 'postId'>;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CommentWithUserNestedRelations } from './comment-with-user-nested-relations.type.js';
import { type CommentWithUserNestedRelations } from './comment-with-user-nested-relations.type.js';

type GetCommentByIdResponseDto = CommentWithUserNestedRelations | null;

Expand Down
4 changes: 2 additions & 2 deletions shared/src/packages/comment/libs/types/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { type CommentWithUserNestedRelations } from './comment-with-user-nested-relations.type.js';
export { type Comment } from './comment.type.js';
export { type GetCommentByIdResponseDto } from './get-comment-by-id-response-dto.type.js';
export { type CommentWithUserNestedRelations } from './comment-with-user-nested-relations.type.js';
export { type CreateCommentRequestDto } from './create-comment-request-dto.type.js';
export { type GetCommentByIdResponseDto } from './get-comment-by-id-response-dto.type.js';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Image } from './image.type.js';
import { type Image } from './image.type.js';

type UploadImageResponseDto = Image;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PostReaction } from './post-reaction.type.js';
import { type PostReaction } from './post-reaction.type.js';

type CreatePostReactionRequestDto = Pick<PostReaction, 'postId' | 'isLike'>;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PostReactionWithPostRelation } from './post-reaction-with-post-relation.type.js';
import { type PostReactionWithPostRelation } from './post-reaction-with-post-relation.type.js';

type CreatePostReactionResponseDto =
| Record<string, never>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Post } from './post.type.js';
import { type Post } from './post.type.js';

type CreatePostRequestDto = Pick<Post, 'body' | 'imageId'>;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PostFilter } from './post-filter.type.js';
import { type PostFilter } from './post-filter.type.js';

type GetPostsByFilterRequestDto = PostFilter;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PostWithImageUserNestedRelationsWithCount } from './post-with-image-user-nested-relations-with-count.type.js';
import { type PostWithImageUserNestedRelationsWithCount } from './post-with-image-user-nested-relations-with-count.type.js';

type GetPostsByFilterResponseDto = PostWithImageUserNestedRelationsWithCount[];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Post } from '~/packages/post/post.js';
import { PostReaction } from './post-reaction.type.js';
import { type Post } from '~/packages/post/post.js';

import { type PostReaction } from './post-reaction.type.js';

type PostReactionWithPostRelation = PostReaction & Record<'post', Post>;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { CommentWithUserNestedRelations } from '~/packages/comment/comment.js';
import { PostWithImageUserNestedRelationsWithCount } from './post-with-image-user-nested-relations-with-count.type.js';
import { type CommentWithUserNestedRelations } from '~/packages/comment/comment.js';

import { type PostWithImageUserNestedRelationsWithCount } from './post-with-image-user-nested-relations-with-count.type.js';

type PostWithCommentImageUserNestedRelationsWithCount =
PostWithImageUserNestedRelationsWithCount &
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { UserWithImageRelation } from '~/packages/user/user.js';
import { Post } from './post.type.js';
import { Image } from '~/packages/image/image.js';
import { type Image } from '~/packages/image/image.js';
import { type UserWithImageRelation } from '~/packages/user/user.js';

import { type Post } from './post.type.js';

type PostWithImageUserNestedRelationsWithCount = Post &
Record<'image', Image> &
Expand Down
18 changes: 9 additions & 9 deletions shared/src/packages/post/libs/types/types.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export { type CreatePostReactionRequestDto } from './create-post-reaction-request-dto.type.js';
export { type CreatePostReactionResponseDto } from './create-post-reaction-response-dto.type.js';
export { type CreatePostRequestDto } from './create-post-request-dto.type.js';
export { type GetPostByIdResponseDto } from './get-post-by-id-response-dto.type.js';
export { type GetPostsByFilterRequestDto } from './get-posts-by-filter-request-dto.type.js';
export { type GetPostsByFilterResponseDto } from './get-posts-by-filter-response-dto.type.js';
export { type Post } from './post.type.js';
export { type PostReactionWithPostRelation } from './post-reaction-with-post-relation.type.js';
export { type PostFilter } from './post-filter.type.js';
export { type PostReaction } from './post-reaction.type.js';
export { type PostWithImageUserNestedRelationsWithCount } from './post-with-image-user-nested-relations-with-count.type.js';
export { type PostReactionWithPostRelation } from './post-reaction-with-post-relation.type.js';
export { type PostWithCommentImageUserNestedRelationsWithCount } from './post-with-comment-image-user-nested-relations-with-count.type.js';
export { type PostFilter } from './post-filter.type.js';
export { type GetPostsByFilterRequestDto } from './get-posts-by-filter-request-dto.type.js';
export { type GetPostsByFilterResponseDto } from './get-posts-by-filter-response-dto.type.js';
export { type GetPostByIdResponseDto } from './get-post-by-id-response-dto.type.js';
export { type CreatePostRequestDto } from './create-post-request-dto.type.js';
export { type CreatePostReactionRequestDto } from './create-post-reaction-request-dto.type.js';
export { type CreatePostReactionResponseDto } from './create-post-reaction-response-dto.type.js';
export { type PostWithImageUserNestedRelationsWithCount } from './post-with-image-user-nested-relations-with-count.type.js';
16 changes: 8 additions & 8 deletions shared/src/packages/post/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ export {
PostsApiPath
} from './libs/enums/enums.js';
export {
type CreatePostReactionRequestDto,
type CreatePostReactionResponseDto,
type CreatePostRequestDto,
type GetPostByIdResponseDto,
type GetPostsByFilterRequestDto,
type GetPostsByFilterResponseDto,
type Post,
type PostFilter,
type PostReaction,
type PostReactionWithPostRelation,
type PostWithImageUserNestedRelationsWithCount,
type GetPostsByFilterRequestDto,
type GetPostsByFilterResponseDto,
type CreatePostRequestDto,
type GetPostByIdResponseDto,
type CreatePostReactionRequestDto,
type CreatePostReactionResponseDto,
type PostWithCommentImageUserNestedRelationsWithCount
type PostWithCommentImageUserNestedRelationsWithCount,
type PostWithImageUserNestedRelationsWithCount
} from './libs/types/types.js';
6 changes: 3 additions & 3 deletions shared/src/packages/user/libs/types/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export { type User } from './user.type.js';
export { type UserAuthResponse } from './user-auth-response.type.js';
export { type UserLoginRequestDto } from './user-login-request-dto.type.js';
export { type UserRegisterRequestDto } from './user-register-request-dto.type.js';
export { type UserLoginResponseDto } from './user-login-response-dto.type.js';
export { type UserRegisterRequestDto } from './user-register-request-dto.type.js';
export { type UserRegisterResponseDto } from './user-register-response-dto.type.js';
export { type UserWithImageRelation } from './user-with-image-relation.type.js';
export { type User } from './user.type.js';
export { type UserWithPassword } from './user-with-password.type.js';
export { type UserRegisterResponseDto } from './user-register-response-dto.type.js';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UserWithImageRelation } from './user-with-image-relation.type.js';
import { type UserWithImageRelation } from './user-with-image-relation.type.js';

type UserAuthResponse = UserWithImageRelation;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UserAuthResponse } from './user-auth-response.type.js';
import { type UserAuthResponse } from './user-auth-response.type.js';

type UserLoginResponseDto = {
user: UserAuthResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UserLoginResponseDto } from './user-login-response-dto.type.js';
import { type UserLoginResponseDto } from './user-login-response-dto.type.js';

type UserRegisterResponseDto = UserLoginResponseDto;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Image } from '~/packages/image/image.js';
import { User } from './user.type.js';
import { type Image } from '~/packages/image/image.js';

import { type User } from './user.type.js';

type UserWithImageRelation = User & {
image: Image | null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { User } from './user.type.js';
import { type User } from './user.type.js';

type UserWithPassword = User & Record<'password', string>;

Expand Down
6 changes: 3 additions & 3 deletions shared/src/packages/user/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export {
type User,
type UserAuthResponse,
type UserLoginRequestDto,
type UserRegisterRequestDto,
type UserLoginResponseDto,
type UserRegisterRequestDto,
type UserRegisterResponseDto,
type UserWithImageRelation,
type UserWithPassword,
type UserRegisterResponseDto
type UserWithPassword
} from './libs/types/types.js';
1 change: 1 addition & 0 deletions shared/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"extends": "../tsconfig.json",
"include": ["src/**/*.ts"],
"exclude": ["node_modules/*"],
"compilerOptions": {
Expand Down

0 comments on commit 8dabef9

Please sign in to comment.