Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capitalize first letter on Signup, Mentor & Mentee Applications #167

Merged
merged 2 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { JWT_SECRET } from '../configs/envConfig'
import Profile from '../entities/profile.entity'
import { type CreateProfile, type ApiResponse } from '../types'
import {
capitalizeFirstLetter,
getPasswordChangedEmailContent,
getPasswordResetEmailContent
} from '../utils'
Expand Down Expand Up @@ -35,8 +36,8 @@ export const registerUser = async (
const newProfile = profileRepository.create({
primary_email: email,
password: hashedPassword,
first_name,
last_name,
first_name: capitalizeFirstLetter(first_name),
last_name: capitalizeFirstLetter(last_name),
image_url: ''
})

Expand Down
6 changes: 5 additions & 1 deletion src/services/mentee.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import {
getEmailContent,
getMentorNotifyEmailContent,
getMenteePublicData
getMenteePublicData,
capitalizeFirstLetter
} from '../utils'
import { sendEmail } from './admin/email.service'

Expand Down Expand Up @@ -78,6 +79,9 @@
}
}

application.firstName = capitalizeFirstLetter(application.firstName as string)

Check failure on line 82 in src/services/mentee.service.ts

View workflow job for this annotation

GitHub Actions / build

Replace `application.firstName·as·string` with `⏎······application.firstName·as·string⏎····`
application.lastName = capitalizeFirstLetter(application.lastName as string)

Check failure on line 84 in src/services/mentee.service.ts

View workflow job for this annotation

GitHub Actions / build

Delete `····`
const newMentee = new Mentee(
MenteeApplicationStatus.PENDING,
application,
Expand Down
5 changes: 4 additions & 1 deletion src/services/mentor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import type Profile from '../entities/profile.entity'
import { MentorApplicationStatus } from '../enums'
import { type PaginatedApiResponse } from '../types'
import { getEmailContent, getMentorPublicData } from '../utils'
import { capitalizeFirstLetter, getEmailContent, getMentorPublicData } from '../utils'

Check failure on line 8 in src/services/mentor.service.ts

View workflow job for this annotation

GitHub Actions / build

Replace `·capitalizeFirstLetter,·getEmailContent,·getMentorPublicData·` with `⏎··capitalizeFirstLetter,⏎··getEmailContent,⏎··getMentorPublicData⏎`
import { sendEmail } from './admin/email.service'

export const createMentor = async (
Expand Down Expand Up @@ -72,6 +72,9 @@
}
}

application.firstName = capitalizeFirstLetter(application.firstName as string)

Check failure on line 75 in src/services/mentor.service.ts

View workflow job for this annotation

GitHub Actions / build

Replace `application.firstName·as·string` with `⏎······application.firstName·as·string⏎····`
application.lastName = capitalizeFirstLetter(application.lastName as string)

const newMentor = new Mentor(
MentorApplicationStatus.PENDING,
category,
Expand Down
6 changes: 6 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
subject: string
message: string
}
): any => {

Check warning on line 103 in src/utils.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
const templatePath = path.join(__dirname, 'templates', `${templateName}.ejs`)

return new Promise<string>((resolve, reject) => {
Expand Down Expand Up @@ -286,3 +286,9 @@
`
}
}

export const capitalizeFirstLetter = (

Check failure on line 290 in src/utils.ts

View workflow job for this annotation

GitHub Actions / build

Replace `⏎··word:·string⏎` with `word:·string`
word: string
): string => {
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()
}

Check failure on line 294 in src/utils.ts

View workflow job for this annotation

GitHub Actions / build

Insert `⏎`
Loading