Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
♻️ Normalize domain URL
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Nov 2, 2020
1 parent b50daca commit 3253de5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/modules/domains/domains.dto.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsArray, IsNotEmpty, IsOptional, IsString } from 'class-validator';
import { IsNotEmpty, IsString } from 'class-validator';

export class CreateDomainDto {
@IsString()
Expand Down
3 changes: 3 additions & 0 deletions src/modules/domains/domains.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
DOMAIN_VERIFICATION_TXT,
} from './domains.constants';
import { DomainVerificationMethods } from './domains.interface';
import { URL } from 'url';

@Injectable()
export class DomainsService {
Expand All @@ -37,6 +38,8 @@ export class DomainsService {
groupId: number,
data: Omit<Omit<domainsCreateInput, 'group'>, 'verificationCode'>,
): Promise<domains> {
const fullUrl = new URL(data.domain);
data.domain = fullUrl.hostname;
const verificationCode = this.tokensService.generateUuid();
return this.prisma.domains.create({
data: {
Expand Down

0 comments on commit 3253de5

Please sign in to comment.