@hed-hog/lms 0.0.320 → 0.0.322

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hed-hog/lms",
3
- "version": "0.0.320",
3
+ "version": "0.0.322",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "dependencies": {
@@ -9,15 +9,15 @@
9
9
  "@nestjs/core": "^11",
10
10
  "@nestjs/jwt": "^11",
11
11
  "@nestjs/mapped-types": "*",
12
- "@hed-hog/api-types": "0.0.1",
13
- "@hed-hog/contact": "0.0.318",
12
+ "@hed-hog/api": "0.0.8",
14
13
  "@hed-hog/api-prisma": "0.0.6",
15
- "@hed-hog/core": "0.0.318",
14
+ "@hed-hog/api-types": "0.0.1",
16
15
  "@hed-hog/api-pagination": "0.0.7",
17
16
  "@hed-hog/api-locale": "0.0.14",
18
- "@hed-hog/api": "0.0.8",
19
- "@hed-hog/finance": "0.0.318",
20
- "@hed-hog/category": "0.0.318"
17
+ "@hed-hog/finance": "0.0.322",
18
+ "@hed-hog/category": "0.0.322",
19
+ "@hed-hog/contact": "0.0.322",
20
+ "@hed-hog/core": "0.0.322"
21
21
  },
22
22
  "exports": {
23
23
  ".": {
@@ -4,10 +4,10 @@ import {
4
4
  IsInt,
5
5
  IsISO8601,
6
6
  IsNotEmpty,
7
- IsOptional,
8
- IsString,
9
- Matches,
10
- MaxLength,
7
+ IsOptional,
8
+ IsString,
9
+ Matches,
10
+ MaxLength,
11
11
  Min,
12
12
  ValidateNested,
13
13
  } from 'class-validator';
@@ -127,10 +127,10 @@ export class CreateClassGroupDto {
127
127
  @IsOptional()
128
128
  location?: string;
129
129
 
130
- @IsString()
131
- @MaxLength(500)
132
- @IsOptional()
133
- virtualRoomUrl?: string;
130
+ @IsString()
131
+ @MaxLength(500)
132
+ @IsOptional()
133
+ virtualRoomUrl?: string;
134
134
 
135
135
  @ValidateNested()
136
136
  @Type(() => ClassGroupSessionTemplateDto)
@@ -822,60 +822,60 @@ export class CourseService {
822
822
  }
823
823
  }
824
824
 
825
- private async syncCourseImages(
826
- courseId: number,
827
- data: {
828
- logoFileId?: number | null;
829
- bannerFileId?: number | null;
830
- },
831
- ) {
832
- if (data.logoFileId !== undefined) {
833
- await this.syncCourseImage(courseId, data.logoFileId, 'course-logo');
834
- }
835
-
836
- if (data.bannerFileId !== undefined) {
837
- await this.syncCourseImage(courseId, data.bannerFileId, 'course-banner');
838
- }
839
- }
840
-
841
- private async syncCourseImage(
842
- courseId: number,
843
- fileId: number | null,
844
- imageTypeSlug: CourseImageTypeSlug,
845
- ) {
846
- if (fileId === null) {
847
- await this.removeCourseImage(courseId, imageTypeSlug);
848
- return;
849
- }
850
-
851
- await this.upsertCourseImage(courseId, fileId, imageTypeSlug);
852
- }
853
-
854
- private async removeCourseImage(
855
- courseId: number,
856
- imageTypeSlug: CourseImageTypeSlug,
857
- ) {
858
- const imageType = await this.prisma.image_type.findFirst({
859
- where: {
860
- slug: imageTypeSlug,
861
- applies_to_course: true,
862
- },
863
- select: { id: true },
864
- });
865
-
866
- if (!imageType) {
867
- return;
868
- }
869
-
870
- await this.prisma.course_image.deleteMany({
871
- where: {
872
- course_id: courseId,
873
- image_type_id: imageType.id,
874
- },
875
- });
876
- }
877
-
878
- private async upsertCourseImage(
825
+ private async syncCourseImages(
826
+ courseId: number,
827
+ data: {
828
+ logoFileId?: number | null;
829
+ bannerFileId?: number | null;
830
+ },
831
+ ) {
832
+ if (data.logoFileId !== undefined) {
833
+ await this.syncCourseImage(courseId, data.logoFileId, 'course-logo');
834
+ }
835
+
836
+ if (data.bannerFileId !== undefined) {
837
+ await this.syncCourseImage(courseId, data.bannerFileId, 'course-banner');
838
+ }
839
+ }
840
+
841
+ private async syncCourseImage(
842
+ courseId: number,
843
+ fileId: number | null,
844
+ imageTypeSlug: CourseImageTypeSlug,
845
+ ) {
846
+ if (fileId === null) {
847
+ await this.removeCourseImage(courseId, imageTypeSlug);
848
+ return;
849
+ }
850
+
851
+ await this.upsertCourseImage(courseId, fileId, imageTypeSlug);
852
+ }
853
+
854
+ private async removeCourseImage(
855
+ courseId: number,
856
+ imageTypeSlug: CourseImageTypeSlug,
857
+ ) {
858
+ const imageType = await this.prisma.image_type.findFirst({
859
+ where: {
860
+ slug: imageTypeSlug,
861
+ applies_to_course: true,
862
+ },
863
+ select: { id: true },
864
+ });
865
+
866
+ if (!imageType) {
867
+ return;
868
+ }
869
+
870
+ await this.prisma.course_image.deleteMany({
871
+ where: {
872
+ course_id: courseId,
873
+ image_type_id: imageType.id,
874
+ },
875
+ });
876
+ }
877
+
878
+ private async upsertCourseImage(
879
879
  courseId: number,
880
880
  fileId: number,
881
881
  imageTypeSlug: CourseImageTypeSlug,
@@ -104,11 +104,11 @@ export class CreateCourseDto {
104
104
  @IsOptional()
105
105
  instructorIds?: number[];
106
106
 
107
- @IsInt()
108
- @IsOptional()
109
- logoFileId?: number | null;
110
-
111
- @IsInt()
112
- @IsOptional()
113
- bannerFileId?: number | null;
114
- }
107
+ @IsInt()
108
+ @IsOptional()
109
+ logoFileId?: number | null;
110
+
111
+ @IsInt()
112
+ @IsOptional()
113
+ bannerFileId?: number | null;
114
+ }