Skip to content

Commit

Permalink
refactor: apply review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-pajak committed Nov 4, 2024
1 parent d5af24f commit 19182b2
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 18 deletions.
14 changes: 7 additions & 7 deletions apps/api/src/categories/api/categories.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@ import {
type UUIDType,
} from "src/common";
import { CurrentUser } from "src/common/decorators/user.decorator";
import { UserRole } from "src/users/schemas/user-roles";
import type { UserRole } from "src/users/schemas/user-roles";
import { CategoriesService } from "../categories.service";
import {
AllCategoriesResponse,
CategorySchema,
type AllCategoriesResponse,
type CategorySchema,
categorySchema,
} from "../schemas/category.schema";
import {
SortCategoryFieldsOptions,
type SortCategoryFieldsOptions,
sortCategoryFieldsOptions,
} from "../schemas/categoryQuery";
import {
CreateCategoryBody,
type CreateCategoryBody,
createCategorySchema,
} from "../schemas/createCategorySchema";
import {
UpdateCategoryBody,
type UpdateCategoryBody,
updateCategorySchema,
} from "../schemas/updateCategorySchema";

Expand Down Expand Up @@ -108,7 +108,7 @@ export class CategoriesController {
const { id } =
await this.categoriesService.createCategory(createCategoryBody);

return new BaseResponse({ id: id, message: "Category created" });
return new BaseResponse({ id, message: "Category created" });
}

@Patch(":id")
Expand Down
1 change: 1 addition & 0 deletions apps/api/src/users/api/users.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ export class UsersController {
}

@Post("create")
@Roles("admin")
@Validate({
response: baseResponse(
Type.Object({ id: UUIDSchema, message: Type.String() }),
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/users/users.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export class UsersService {
subject: "Welcome to the Platform!",
text,
html,
from: "[email protected]",
from: process.env.SES_EMAIL || "",
});

return createdUser;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion apps/web/app/api/mutations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export { useChangePassword } from "./useChangePassword";
export { useClearQuizProgress } from "./useClearQuizProgress";
export { useCreateCourse } from "./useCreateCourse";
export { useCreateNewPassword } from "./useCreateNewPassword";
export { useCreateUser } from "./useCreateUser";
export { useCreateUser } from "./admin/useCreateUser";
export { useDeleteLessonItem } from "./useDeleteLessonItem";
export { useEnrollCourse } from "./useEnrollCourse";
export { useLoginUser } from "./useLoginUser";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useSortable } from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import { GetAllLessonsResponse } from "~/api/generated-api";
import Viewer from "~/components/RichText/Viever";

type TransformedLesson = GetAllLessonsResponse["data"][number] & {
columnId: string;
Expand Down Expand Up @@ -30,9 +31,7 @@ export function LessonCard({ lesson }: LessonCardProps) {
<img src={lesson.imageUrl} alt="" className="w-16 h-16 rounded-md" />
<div>
<h4 className="font-medium">{lesson.title}</h4>
<p className="text-sm text-gray-600 line-clamp-4">
{lesson.description}
</p>
<Viewer content={lesson.description} />
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/modules/Admin/Users/CreateNewUser.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
import { CreatePageHeader } from "~/modules/Admin/components";
import { queryClient } from "~/api/queryClient";
import { ALL_COURSES_QUERY_KEY } from "~/api/queries/useCourses";
import { useCreateUser } from "~/api/mutations/useCreateUser";
import { useCreateUser } from "~/api/mutations/admin/useCreateUser";
import { useNavigate } from "@remix-run/react";

const formSchema = z.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { cn } from "~/lib/utils";
import CustomErrorBoundary from "~/modules/common/ErrorBoundary/ErrorBoundary";
import { PaymentModal } from "~/modules/stripe/PaymentModal";
import CourseProgress from "~/components/CourseProgress";
import Viewer from "~/components/RichText/Viever";

export const CourseViewMainCard = ({
course,
Expand Down Expand Up @@ -52,7 +53,7 @@ export const CourseViewMainCard = ({

const firstUncompletedLesson =
course.lessons.find(
(lesson) => (lesson.itemsCompletedCount ?? 0) < lesson.itemsCount
(lesson) => (lesson.itemsCompletedCount ?? 0) < lesson.itemsCount,
)?.id ?? last(course.lessons)?.id;

const handleEnroll = () => {
Expand Down Expand Up @@ -90,9 +91,7 @@ export const CourseViewMainCard = ({
{title}
</h4>
<div className="min-h-0 scrollbar-thin overflow-auto">
<p className="mt-4 text-neutral-900 leading-7 font-normal">
{description}
</p>
<Viewer content={description} />
</div>
<div className="mt-auto">
{!isAdmin && isEnrolled && (
Expand Down Expand Up @@ -125,7 +124,7 @@ export const CourseViewMainCard = ({
{
"bg-white border border-secondary-500 text-secondary-700 w-full mt-3":
isEnrolled,
}
},
)}
onClick={handleUnenroll}
>
Expand Down

0 comments on commit 19182b2

Please sign in to comment.