Skip to content

Commit ab92eb3

Browse files
committed
refactor(imports): standardize import paths by removing file extensions
- Updated import statements across multiple DTO files to remove the '.js' extension for consistency and clarity. - This change enhances maintainability and aligns with best practices for module imports.
1 parent 8057048 commit ab92eb3

10 files changed

Lines changed: 14 additions & 29 deletions

File tree

apps/backend/src/song/song.util.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,10 @@ export const generateSongId = () => {
3838
export function uploadSongResponseDtoFromSongWithUser(
3939
song: SongWithUser,
4040
): UploadSongResponseDto {
41-
const uploaderDoc = song.uploader as SongWithUser['uploader'] & {
42-
_id?: { toString(): string };
43-
};
44-
const uploaderId = uploaderDoc._id?.toString() ?? '';
45-
4641
return {
4742
publicId: song.publicId,
4843
title: song.title,
4944
uploader: {
50-
id: uploaderId,
5145
username: song.uploader.username,
5246
profileImage: song.uploader.profileImage,
5347
},
@@ -62,7 +56,6 @@ export function songViewDtoFromSongDocument(song: SongWithUser): SongViewDto {
6256
publicId: song.publicId,
6357
createdAt: song.createdAt,
6458
uploader: {
65-
id: song.uploader.id,
6659
username: song.uploader.username,
6760
profileImage: song.uploader.profileImage,
6861
},

packages/validation/src/common/jsonStringField.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { describe, expect, it } from 'bun:test';
22

33
import { z } from 'zod';
44

5-
import { jsonStringField } from './jsonStringField.js';
5+
import { jsonStringField } from './jsonStringField';
66

77
describe('jsonStringField', () => {
88
it('parses a valid JSON string and validates against the inner schema', () => {

packages/validation/src/song/FeaturedSongsDto.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { z } from 'zod';
22

3-
import { songPreviewDtoSchema } from './SongPreview.dto.js';
3+
import { songPreviewDtoSchema } from './SongPreview.dto';
44

55
export const featuredSongsDtoSchema = z.object({
66
hour: z.array(songPreviewDtoSchema),

packages/validation/src/song/SongPage.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { z } from 'zod';
22

3-
import { songPreviewDtoSchema } from './SongPreview.dto.js';
3+
import { songPreviewDtoSchema } from './SongPreview.dto';
44

55
export const songPageDtoSchema = z.object({
66
content: z.array(songPreviewDtoSchema),

packages/validation/src/song/SongPreview.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { z } from 'zod';
22

33
import { UPLOAD_CONSTANTS } from '@nbw/config';
44

5-
import type { VisibilityType } from './uploadMeta.js';
5+
import type { VisibilityType } from './uploadMeta';
66

77
const songPreviewUploaderSchema = z.object({
88
username: z.string(),

packages/validation/src/song/SongSearchParams.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { z } from 'zod';
22

3-
import { SongOrderType, SongSortType } from './SongListQuery.dto.js';
3+
import { SongOrderType, SongSortType } from './SongListQuery.dto';
44

55
export const songSearchParamsSchema = z.object({
66
q: z.string().optional(),

packages/validation/src/song/SongView.dto.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import { z } from 'zod';
22

3-
import { songStatsSchema } from './SongStats.js';
4-
import type {
5-
CategoryType,
6-
LicenseType,
7-
VisibilityType,
8-
} from './uploadMeta.js';
3+
import { songStatsSchema } from './SongStats';
4+
import type { CategoryType, LicenseType, VisibilityType } from './uploadMeta';
95

106
export const songViewUploaderSchema = z.object({
117
username: z.string(),

packages/validation/src/song/UploadSongDto.dto.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
import { z } from 'zod';
22

3-
import { jsonStringField } from '@nbw/validation/src';
4-
53
import { UPLOAD_CONSTANTS } from '@nbw/config';
4+
import { jsonStringField } from '@nbw/validation/src';
65

7-
import { thumbnailDataSchema } from './ThumbnailData.dto.js';
8-
import type {
9-
CategoryType,
10-
LicenseType,
11-
VisibilityType,
12-
} from './uploadMeta.js';
6+
import { thumbnailDataSchema } from './ThumbnailData.dto';
7+
import type { CategoryType, LicenseType, VisibilityType } from './uploadMeta';
138

149
const visibility = Object.keys(UPLOAD_CONSTANTS.visibility) as Readonly<
1510
string[]

packages/validation/src/song/UploadSongResponseDto.dto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { z } from 'zod';
22

3-
import { songViewUploaderSchema } from './SongView.dto.js';
3+
import { songViewUploaderSchema } from './SongView.dto';
44

55
export const uploadSongResponseDtoSchema = z.object({
66
publicId: z.string().min(1),

packages/validation/src/user/UserIndexQuery.dto.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import { z } from 'zod';
33
import {
44
pageQueryDTOSchema,
55
type PageQueryInput,
6-
} from '../common/PageQuery.dto.js';
7-
import { getUserSchema } from './GetUser.dto.js';
6+
} from '../common/PageQuery.dto';
7+
8+
import { getUserSchema } from './GetUser.dto';
89

910
/**
1011
* `GET /user` query: always paginated, optionally filtered by email/id/username.

0 commit comments

Comments
 (0)