Skip to content

Commit ea18781

Browse files
committed
Rename lover -> profile
1 parent 593617c commit ea18781

File tree

86 files changed

+601
-746
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+601
-746
lines changed

backend/api/src/app.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import {blockUser, unblockUser} from './block-user'
1212
import {getCompatibleProfilesHandler} from './compatible-profiles'
1313
import {createComment} from './create-comment'
1414
import {createCompatibilityQuestion} from './create-compatibility-question'
15-
import {createProfile} from './create-lover'
15+
import {createProfile} from './create-profile'
1616
import {createUser} from './create-user'
1717
import {getCompatibilityQuestions} from './get-compatibililty-questions'
1818
import {getLikesAndShips} from './get-likes-and-ships'
19-
import {getProfileAnswers} from './get-lover-answers'
19+
import {getProfileAnswers} from './get-profile-answers'
2020
import {getProfiles} from './get-profiles'
2121
import {getSupabaseToken} from './get-supabase-token'
2222
import {getDisplayUser, getUser} from './get-user'
@@ -25,15 +25,15 @@ import {hasFreeLike} from './has-free-like'
2525
import {health} from './health'
2626
import {type APIHandler, typedEndpoint} from './helpers/endpoint'
2727
import {hideComment} from './hide-comment'
28-
import {likeProfile} from './like-lover'
28+
import {likeProfile} from './like-profile'
2929
import {markAllNotifsRead} from './mark-all-notifications-read'
3030
import {removePinnedPhoto} from './remove-pinned-photo'
3131
import {report} from './report'
3232
import {searchLocation} from './search-location'
3333
import {searchNearCity} from './search-near-city'
3434
import {shipProfiles} from './ship-profiles'
35-
import {starProfile} from './star-lover'
36-
import {updateProfile} from './update-lover'
35+
import {starProfile} from './star-profile'
36+
import {updateProfile} from './update-profile'
3737
import {updateMe} from './update-me'
3838
import {deleteMe} from './delete-me'
3939
import {getCurrentPrivateUser} from './get-current-private-user'
@@ -134,20 +134,20 @@ const handlers: { [k in APIPath]: APIHandler<k> } = {
134134
'ban-user': banUser,
135135
report: report,
136136
'create-user': createUser,
137-
'create-lover': createProfile,
137+
'create-profile': createProfile,
138138
me: getMe,
139139
'me/private': getCurrentPrivateUser,
140140
'me/update': updateMe,
141141
'update-notif-settings': updateNotifSettings,
142142
'me/delete': deleteMe,
143-
'update-lover': updateProfile,
144-
'like-lover': likeProfile,
143+
'update-profile': updateProfile,
144+
'like-profile': likeProfile,
145145
'ship-profiles': shipProfiles,
146146
'get-likes-and-ships': getLikesAndShips,
147147
'has-free-like': hasFreeLike,
148-
'star-lover': starProfile,
148+
'star-profile': starProfile,
149149
'get-profiles': getProfiles,
150-
'get-lover-answers': getProfileAnswers,
150+
'get-profile-answers': getProfileAnswers,
151151
'get-compatibility-questions': getCompatibilityQuestions,
152152
'remove-pinned-photo': removePinnedPhoto,
153153
'create-comment': createComment,

backend/api/src/compatible-profiles.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,32 @@ export const getCompatibleProfilesHandler: APIHandler<
1515
}
1616

1717
export const getCompatibleProfiles = async (userId: string) => {
18-
const lover = await getProfile(userId)
18+
const profile = await getProfile(userId)
1919

20-
log('got lover', {
21-
id: lover?.id,
22-
userId: lover?.user_id,
23-
username: lover?.user?.username,
20+
log('got profile', {
21+
id: profile?.id,
22+
userId: profile?.user_id,
23+
username: profile?.user?.username,
2424
})
2525

26-
if (!lover) throw new APIError(404, 'Profile not found')
26+
if (!profile) throw new APIError(404, 'Profile not found')
2727

28-
const profiles = await getGenderCompatibleProfiles(lover)
28+
const profiles = await getGenderCompatibleProfiles(profile)
2929

30-
const loverAnswers = await getCompatibilityAnswers([
30+
const profileAnswers = await getCompatibilityAnswers([
3131
userId,
3232
...profiles.map((l) => l.user_id),
3333
])
34-
log('got lover answers ' + loverAnswers.length)
34+
log('got profile answers ' + profileAnswers.length)
3535

36-
const answersByUserId = groupBy(loverAnswers, 'creator_id')
37-
const loverCompatibilityScores = Object.fromEntries(
36+
const answersByUserId = groupBy(profileAnswers, 'creator_id')
37+
const profileCompatibilityScores = Object.fromEntries(
3838
profiles.map(
3939
(l) =>
4040
[
4141
l.user_id,
4242
getCompatibilityScore(
43-
answersByUserId[lover.user_id] ?? [],
43+
answersByUserId[profile.user_id] ?? [],
4444
answersByUserId[l.user_id] ?? []
4545
),
4646
] as const
@@ -49,13 +49,13 @@ export const getCompatibleProfiles = async (userId: string) => {
4949

5050
const sortedCompatibleProfiles = sortBy(
5151
profiles,
52-
(l) => loverCompatibilityScores[l.user_id].score
52+
(l) => profileCompatibilityScores[l.user_id].score
5353
).reverse()
5454

5555
return {
5656
status: 'success',
57-
lover,
57+
profile,
5858
compatibleProfiles: sortedCompatibleProfiles,
59-
loverCompatibilityScores,
59+
profileCompatibilityScores,
6060
}
6161
}

backend/api/src/create-comment.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ export const createComment: APIHandler<'create-comment'> = async (
3232
if (!onUser) throw new APIError(404, 'User not found')
3333

3434
const pg = createSupabaseDirectClient()
35-
const comment = await pg.one<Row<'lover_comments'>>(
36-
`insert into lover_comments (user_id, user_name, user_username, user_avatar_url, on_user_id, content, reply_to_comment_id)
35+
const comment = await pg.one<Row<'profile_comments'>>(
36+
`insert into profile_comments (user_id, user_name, user_username, user_avatar_url, on_user_id, content, reply_to_comment_id)
3737
values ($1, $2, $3, $4, $5, $6, $7) returning *`,
3838
[
3939
creator.id,
@@ -104,7 +104,7 @@ const createNewCommentOnProfileNotification = async (
104104
createdTime: Date.now(),
105105
isSeen: false,
106106
sourceId: commentId.toString(),
107-
sourceType: 'comment_on_lover',
107+
sourceType: 'comment_on_profile',
108108
sourceUpdateType: 'created',
109109
sourceUserName: creator.name,
110110
sourceUserUsername: creator.username,
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { updateUser } from 'shared/supabase/users'
88
import { tryCatch } from 'common/util/try-catch'
99
import { insert } from 'shared/supabase/utils'
1010

11-
export const createProfile: APIHandler<'create-lover'> = async (body, auth) => {
11+
export const createProfile: APIHandler<'create-profile'> = async (body, auth) => {
1212
const pg = createSupabaseDirectClient()
1313

1414
const { data: existingUser } = await tryCatch(
@@ -40,7 +40,7 @@ export const createProfile: APIHandler<'create-lover'> = async (body, auth) => {
4040
}
4141

4242
log('Created user', data)
43-
await track(user.id, 'create lover', { username: user.username })
43+
await track(user.id, 'create profile', { username: user.username })
4444

4545
return data
4646
}

backend/api/src/create-user.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export const createUser: APIHandler<'create-user'> = async (
123123
log('created user ', { username: user.username, firebaseId: auth.uid })
124124

125125
const continuation = async () => {
126-
await track(auth.uid, 'create lover', { username: user.username })
126+
await track(auth.uid, 'create profile', { username: user.username })
127127
}
128128

129129
return {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { type APIHandler } from 'api/helpers/endpoint'
22
import { createSupabaseDirectClient } from 'shared/supabase/init'
33
import { Row } from 'common/supabase/utils'
44

5-
export const getProfileAnswers: APIHandler<'get-lover-answers'> = async (
5+
export const getProfileAnswers: APIHandler<'get-profile-answers'> = async (
66
props,
77
_auth
88
) => {

backend/api/src/hide-comment.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ export const hideComment: APIHandler<'hide-comment'> = async (
1010
auth
1111
) => {
1212
const pg = createSupabaseDirectClient()
13-
const comment = await pg.oneOrNone<Row<'lover_comments'>>(
14-
`select * from lover_comments where id = $1`,
13+
const comment = await pg.oneOrNone<Row<'profile_comments'>>(
14+
`select * from profile_comments where id = $1`,
1515
[commentId]
1616
)
1717
if (!comment) {
@@ -26,7 +26,7 @@ export const hideComment: APIHandler<'hide-comment'> = async (
2626
throw new APIError(403, 'You are not allowed to hide this comment')
2727
}
2828

29-
await pg.none(`update lover_comments set hidden = $2 where id = $1`, [
29+
await pg.none(`update profile_comments set hidden = $2 where id = $1`, [
3030
commentId,
3131
hide,
3232
])
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { log } from 'shared/utils'
66
import { tryCatch } from 'common/util/try-catch'
77
import { Row } from 'common/supabase/utils'
88

9-
export const likeProfile: APIHandler<'like-lover'> = async (props, auth) => {
9+
export const likeProfile: APIHandler<'like-profile'> = async (props, auth) => {
1010
const { targetUserId, remove } = props
1111
const creatorId = auth.uid
1212

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { tryCatch } from 'common/util/try-catch'
55
import { Row } from 'common/supabase/utils'
66
import { insert } from 'shared/supabase/utils'
77

8-
export const starProfile: APIHandler<'star-lover'> = async (props, auth) => {
8+
export const starProfile: APIHandler<'star-profile'> = async (props, auth) => {
99
const { targetUserId, remove } = props
1010
const creatorId = auth.uid
1111

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { tryCatch } from 'common/util/try-catch'
77
import { update } from 'shared/supabase/utils'
88
import { type Row } from 'common/supabase/utils'
99

10-
export const updateProfile: APIHandler<'update-lover'> = async (
10+
export const updateProfile: APIHandler<'update-profile'> = async (
1111
parsedBody,
1212
auth
1313
) => {
@@ -25,7 +25,7 @@ export const updateProfile: APIHandler<'update-lover'> = async (
2525
}
2626

2727
!parsedBody.last_online_time &&
28-
log('Updating lover', { userId: auth.uid, parsedBody })
28+
log('Updating profile', { userId: auth.uid, parsedBody })
2929

3030
await removePinnedUrlFromPhotoUrls(parsedBody)
3131
if (parsedBody.avatar_url) {
@@ -37,8 +37,8 @@ export const updateProfile: APIHandler<'update-lover'> = async (
3737
)
3838

3939
if (error) {
40-
log('Error updating lover', error)
41-
throw new APIError(500, 'Error updating lover')
40+
log('Error updating profile', error)
41+
throw new APIError(500, 'Error updating profile')
4242
}
4343

4444
return data

0 commit comments

Comments
 (0)