Skip to content

Commit a766f69

Browse files
committed
feat: integrate deepFreeze for LinkRegexes in UpdateUserProfile DTO
1 parent 1d8fe63 commit a766f69

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

shared/validation/user/dto/UpdateUserProfile.dto.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ describe('UpdateUserProfileDto', () => {
88

99
userLinks.github = 'https://github.com/tomast1337';
1010
userLinks.youtube = 'https://www.youtube.com/@Bentroen_';
11+
1112
userLinks.spotify =
1213
'https://open.spotify.com/artist/1McMsnEElThX1knmY4oliG?si=v95i3XbRRgKT9JwyiFiFEg';
14+
1315
userLinks.bandcamp = 'https://igorrr.bandcamp.com/';
1416
userLinks.facebook = 'https://www.facebook.com/MrBean';
1517
userLinks.reddit = 'https://www.reddit.com/user/Unidan/';

shared/validation/user/dto/UpdateUserProfile.dto.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ApiProperty } from '@nestjs/swagger';
2+
import { deepFreeze } from '@shared/validation/common/deepFreeze';
23
import { Type } from 'class-transformer';
34
import {
45
IsOptional,
@@ -9,7 +10,7 @@ import {
910
MinLength,
1011
} from 'class-validator';
1112

12-
export const LinkRegexes = {
13+
export const LinkRegexes = deepFreeze({
1314
bandcamp: /https?:\/\/[a-zA-Z0-9_-]+\.bandcamp\.com\/?/,
1415
discord: /https?:\/\/(www\.)?discord\.com\/[a-zA-Z0-9_]+/,
1516
facebook: /https?:\/\/(www\.)?facebook\.com\/[a-zA-Z0-9_]+/,
@@ -26,7 +27,7 @@ export const LinkRegexes = {
2627
twitch: /https?:\/\/(www\.)?twitch\.tv\/[a-zA-Z0-9_]+/,
2728
x: /https?:\/\/(www\.)?x\.com\/[a-zA-Z0-9_]+/,
2829
youtube: /https?:\/\/(www\.)?youtube\.com\/@?[a-zA-Z0-9_-]+/,
29-
};
30+
});
3031

3132
export class UserLinks {
3233
@IsOptional()

0 commit comments

Comments
 (0)