Skip to content

Commit

Permalink
Last commitment of 2023. Thank you all for coming in my life. Not nec…
Browse files Browse the repository at this point in the history
…essarily good, not necessarily bad, neither praiseworthy nor blameworthy. But all are valuable pieces of luggage for me to move forward. Thanks for everything, 2023.
  • Loading branch information
huytran17 committed Dec 31, 2023
1 parent 793b68c commit 316e227
Show file tree
Hide file tree
Showing 84 changed files with 86 additions and 128 deletions.
4 changes: 2 additions & 2 deletions core/server/src/use-cases/admin/create-admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ export interface ICreateAdminData {

export type ICreateAdmin = ({
adminDetails,
}: ICreateAdminData) => Promise<Admin | null>;
}: ICreateAdminData) => Promise<Admin>;

export default function makeCreateAdmin({
adminDb,
}: {
adminDb: IAdminDb;
}): ICreateAdmin {
return async function createAdmin({ adminDetails }): Promise<Admin | null> {
return async function createAdmin({ adminDetails }) {
return await adminDb.insert(adminDetails);
};
}
2 changes: 1 addition & 1 deletion core/server/src/use-cases/admin/delete-admin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Admin from "../../database/entities/admin";
import IAdminDb from "../../data-access/interfaces/admin-db";

export type IDeleteAdmin = ({ _id }: { _id: string }) => Promise<Admin | null>;
export type IDeleteAdmin = ({ _id }: { _id: string }) => Promise<Admin>;

export default function makeDeleteAdmin({
adminDb,
Expand Down
6 changes: 1 addition & 5 deletions core/server/src/use-cases/admin/get-admin-by-email.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import Admin from "../../database/entities/admin";
import IAdminDb from "../../data-access/interfaces/admin-db";

export type IGetAdminByEmail = ({
email,
}: {
email: string;
}) => Promise<Admin | null>;
export type IGetAdminByEmail = ({ email }: { email: string }) => Promise<Admin>;

export default function makeGetAdminByEmail({
adminDb,
Expand Down
2 changes: 1 addition & 1 deletion core/server/src/use-cases/admin/get-admin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Admin from "../../database/entities/admin";
import IAdminDb from "../../data-access/interfaces/admin-db";

export type IGetAdmin = ({ _id }: { _id: string }) => Promise<Admin | null>;
export type IGetAdmin = ({ _id }: { _id: string }) => Promise<Admin>;

export default function makeGetAdmin({
adminDb,
Expand Down
2 changes: 1 addition & 1 deletion core/server/src/use-cases/admin/get-admins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Logger } from "winston";
import Admin from "../../database/entities/admin";
import IAdminDb from "../../data-access/interfaces/admin-db";

export type IGetAdmins = () => Promise<Admin[] | null>;
export type IGetAdmins = () => Promise<Admin[]>;

export default function makeGetAdmins({
adminDb,
Expand Down
2 changes: 1 addition & 1 deletion core/server/src/use-cases/admin/get-one-admin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Admin from "../../database/entities/admin";
import IAdminDb from "../../data-access/interfaces/admin-db";

export type IGetOneAdmin = () => Promise<Admin | null>;
export type IGetOneAdmin = () => Promise<Admin>;

export default function makeGetOneAdmin({
adminDb,
Expand Down
6 changes: 1 addition & 5 deletions core/server/src/use-cases/admin/hard-delete-admin.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import Admin from "../../database/entities/admin";
import IAdminDb from "../../data-access/interfaces/admin-db";

export type IHardDeleteAdmin = ({
_id,
}: {
_id: string;
}) => Promise<Admin | null>;
export type IHardDeleteAdmin = ({ _id }: { _id: string }) => Promise<Admin>;

export default function makeHardDeleteAdmin({
adminDb,
Expand Down
2 changes: 1 addition & 1 deletion core/server/src/use-cases/admin/update-admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface IUpdateAdminData {

export type IUpdateAdmin = ({
adminDetails,
}: IUpdateAdminData) => Promise<Admin | null>;
}: IUpdateAdminData) => Promise<Admin>;

export default function makeUpdateAdmin({
adminDb,
Expand Down
2 changes: 1 addition & 1 deletion core/server/src/use-cases/category/create-category.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface ICreateCategoryData {

export type ICreateCategory = ({
categoryDetails,
}: ICreateCategoryData) => Promise<Category | null>;
}: ICreateCategoryData) => Promise<Category>;

export default function makeCreateCategory({
categoryDb,
Expand Down
6 changes: 1 addition & 5 deletions core/server/src/use-cases/category/delete-category.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import Category from "../../database/entities/category";
import ICategoryDb from "../../data-access/interfaces/category-db";

export type IDeleteCategory = ({
_id,
}: {
_id: string;
}) => Promise<Category | null>;
export type IDeleteCategory = ({ _id }: { _id: string }) => Promise<Category>;

export default function makeDeleteCategory({
categoryDb,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Category from "../../database/entities/category";
import ICategoryDb from "../../data-access/interfaces/category-db";

export type IGetCategoriesForSEO = () => Promise<Category[] | null>;
export type IGetCategoriesForSEO = () => Promise<Category[]>;

export default function makeGetCategoriesForSEO({
categoryDb,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export type IGetCategoriesPaginated = ({
query: string;
page: number;
entries_per_page: number;
}) => Promise<IPaginatedCategoryResult | null>;
}) => Promise<IPaginatedCategoryResult>;

export default function makeGetCategoriesPaginated({
categoryDb,
Expand Down
2 changes: 1 addition & 1 deletion core/server/src/use-cases/category/get-categories.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Category from "../../database/entities/category";
import ICategoryDb from "../../data-access/interfaces/category-db";

export type IGetCategories = () => Promise<Category[] | null>;
export type IGetCategories = () => Promise<Category[]>;

export default function makeGetCategories({
categoryDb,
Expand Down
2 changes: 1 addition & 1 deletion core/server/src/use-cases/category/get-category-by-slug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type IGetCategoryBySlug = ({
slug,
}: {
slug: string;
}) => Promise<Category | null>;
}) => Promise<Category>;

export default function makeGetCategoryBySlug({
categoryDb,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type IGetCategoryByTitle = ({
}: {
title: string;
is_include_deleted?: boolean;
}) => Promise<Category | null>;
}) => Promise<Category>;

export default function makeGetCategoryByTitle({
categoryDb,
Expand Down
2 changes: 1 addition & 1 deletion core/server/src/use-cases/category/get-category.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type IGetCategory = ({
}: {
_id: string;
is_include_deleted?: boolean;
}) => Promise<Category | null>;
}) => Promise<Category>;

export default function makeGetCategory({
categoryDb,
Expand Down
2 changes: 1 addition & 1 deletion core/server/src/use-cases/category/hard-delete-category.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type IHardDeleteCategory = ({
_id,
}: {
_id: string;
}) => Promise<Category | null>;
}) => Promise<Category>;

export default function makeHardDeleteCategory({
categoryDb,
Expand Down
2 changes: 1 addition & 1 deletion core/server/src/use-cases/category/update-category.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface IUpdateCategoryData {

export type IUpdateCategory = ({
categoryDetails,
}: IUpdateCategoryData) => Promise<Category | null>;
}: IUpdateCategoryData) => Promise<Category>;

export default function makeUpdateCategory({
categoryDb,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface ICreateCommentLikeData {

export type ICreateCommentLike = ({
commentLikeDetails,
}: ICreateCommentLikeData) => Promise<CommentLike | null>;
}: ICreateCommentLikeData) => Promise<CommentLike>;

export default function makeCreateCommentLike({
commentLikeDb,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type IGetCommentLikeByUserAndComment = ({
}: {
user_id: string;
comment_id: string;
}) => Promise<CommentLike | null>;
}) => Promise<CommentLike>;

export default function makeGetCommentLikeByUserAndComment({
commentLikeDb,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type IHardDeleteCommentLike = ({
_id,
}: {
_id: string;
}) => Promise<CommentLike | null>;
}) => Promise<CommentLike>;

export default function makeHardDeleteCommentLike({
commentLikeDb,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface IUpdateCommentLikeData {

export type IUpdateCommentLike = ({
commentLikeDetails,
}: IUpdateCommentLikeData) => Promise<CommentLike | null>;
}: IUpdateCommentLikeData) => Promise<CommentLike>;

export default function makeUpdateCommentLike({
commentLikeDb,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export type ICountCommentsByPost = ({
post_id,
}: {
post_id: string;
}) => Promise<number | null>;
}) => Promise<number>;

export default function makeCountCommentsByPost({
commentDb,
Expand Down
2 changes: 1 addition & 1 deletion core/server/src/use-cases/comment/create-comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface ICreateCommentData {

export type ICreateComment = ({
commentDetails,
}: ICreateCommentData) => Promise<Comment | null>;
}: ICreateCommentData) => Promise<Comment>;

export default function makeCreateComment({
commentDb,
Expand Down
2 changes: 1 addition & 1 deletion core/server/src/use-cases/comment/get-comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type IGetComment = ({
_id: string;
is_only_parent?: boolean;
is_show_children?: boolean;
}) => Promise<Comment | null>;
}) => Promise<Comment>;

export default function makeGetComment({
commentDb,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type IGetCommentsByParent = ({
parent_id,
}: {
parent_id: string;
}) => Promise<Comment[] | null>;
}) => Promise<Comment[]>;

export default function makeGetCommentsByParent({
commentDb,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type IGetCommentsByPostPaginated = (
page: number;
entries_per_page: number;
}
) => Promise<IPaginatedCommentResult | null>;
) => Promise<IPaginatedCommentResult>;

export default function makeGetCommentsByPostPaginated({
commentDb,
Expand Down
2 changes: 1 addition & 1 deletion core/server/src/use-cases/comment/get-comments.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Comment from "../../database/entities/comment";
import ICommentDb from "../../data-access/interfaces/comment-db";

export type IGetComments = () => Promise<Comment[] | null>;
export type IGetComments = () => Promise<Comment[]>;

export default function makeGetComments({
commentDb,
Expand Down
6 changes: 1 addition & 5 deletions core/server/src/use-cases/comment/hard-delete-comment.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import Comment from "../../database/entities/comment";
import ICommentDb from "../../data-access/interfaces/comment-db";

export type IHardDeleteComment = ({
_id,
}: {
_id: string;
}) => Promise<Comment | null>;
export type IHardDeleteComment = ({ _id }: { _id: string }) => Promise<Comment>;

export default function makeHardDeleteComment({
commentDb,
Expand Down
2 changes: 1 addition & 1 deletion core/server/src/use-cases/comment/reply-comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface IReplyCommentData {

export type IReplyComment = ({
commentDetails,
}: IReplyCommentData) => Promise<Comment | null>;
}: IReplyCommentData) => Promise<Comment>;

export default function makeReplyComment({
commentDb,
Expand Down
2 changes: 1 addition & 1 deletion core/server/src/use-cases/comment/update-comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface IUpdateCommentData {

export type IUpdateComment = ({
commentDetails,
}: IUpdateCommentData) => Promise<Comment | null>;
}: IUpdateCommentData) => Promise<Comment>;

export default function makeUpdateComment({
commentDb,
Expand Down
2 changes: 1 addition & 1 deletion core/server/src/use-cases/gallery/create-gallery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface ICreateGalleryData {

export type ICreateGallery = ({
galleryDetails,
}: ICreateGalleryData) => Promise<Gallery | null>;
}: ICreateGalleryData) => Promise<Gallery>;

export default function makeCreateGallery({
galleryDb,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type IGetGalleriesByParent = ({
parent_id,
}: {
parent_id: string;
}) => Promise<Gallery[] | null>;
}) => Promise<Gallery[]>;

export default function makeGetGalleriesByParent({
galleryDb,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type IGetGalleriesPaginated = (
}: {
is_parent?: boolean;
}
) => Promise<IPaginatedGalleryResult | null>;
) => Promise<IPaginatedGalleryResult>;

export default function makeGetGalleriesPaginated({
galleryDb,
Expand Down
2 changes: 1 addition & 1 deletion core/server/src/use-cases/gallery/get-gallery.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Gallery from "../../database/entities/gallery";
import IGalleryDb from "../../data-access/interfaces/gallery-db";

export type IGetGallery = ({ _id }: { _id: string }) => Promise<Gallery | null>;
export type IGetGallery = ({ _id }: { _id: string }) => Promise<Gallery>;

export default function makeGetGallery({
galleryDb,
Expand Down
6 changes: 1 addition & 5 deletions core/server/src/use-cases/gallery/hard-delete-gallery.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import Gallery from "../../database/entities/gallery";
import IGalleryDb from "../../data-access/interfaces/gallery-db";

export type IHardDeleteGallery = ({
_id,
}: {
_id: string;
}) => Promise<Gallery | null>;
export type IHardDeleteGallery = ({ _id }: { _id: string }) => Promise<Gallery>;

export default function makeHardDeleteGallery({
galleryDb,
Expand Down
2 changes: 1 addition & 1 deletion core/server/src/use-cases/gallery/update-gallery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface IUpdateGalleryData {

export type IUpdateGallery = ({
galleryDetails,
}: IUpdateGalleryData) => Promise<Gallery | null>;
}: IUpdateGalleryData) => Promise<Gallery>;

export default function makeUpdateGallery({
galleryDb,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface ICreatePasswordResetData {

export type ICreatePasswordReset = ({
passwordResetDetails,
}: ICreatePasswordResetData) => Promise<PasswordReset | null>;
}: ICreatePasswordResetData) => Promise<PasswordReset>;

export default function makeCreatePasswordReset({
passwordResetDb,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type IGetPasswordResetByCode = ({
security_code,
}: {
security_code: string;
}) => Promise<PasswordReset | null>;
}) => Promise<PasswordReset>;

export default function makeGetPasswordResetByCode({
passwordResetDb,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type IGetPasswordResetByEmail = ({
email,
}: {
email: string;
}) => Promise<PasswordReset | null>;
}) => Promise<PasswordReset>;

export default function makeGetPasswordResetByEmail({
passwordResetDb,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type IGetPasswordReset = ({
_id,
}: {
_id: string;
}) => Promise<PasswordReset | null>;
}) => Promise<PasswordReset>;

export default function makeGetPasswordReset({
passwordResetDb,
Expand Down
Loading

0 comments on commit 316e227

Please sign in to comment.