Skip to content

Commit f353e59

Browse files
committed
Rename lovers -> profiles
1 parent a4cc3e1 commit f353e59

35 files changed

+301
-163
lines changed

backend/api/src/app.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {log} from 'shared/monitoring/log'
99
import {metrics} from 'shared/monitoring/metrics'
1010
import {banUser} from './ban-user'
1111
import {blockUser, unblockUser} from './block-user'
12-
import {getCompatibleLoversHandler} from './compatible-lovers'
12+
import {getCompatibleLoversHandler} from './compatible-profiles'
1313
import {createComment} from './create-comment'
1414
import {createCompatibilityQuestion} from './create-compatibility-question'
1515
import {createLover} from './create-lover'
@@ -31,7 +31,7 @@ import {removePinnedPhoto} from './remove-pinned-photo'
3131
import {report} from './report'
3232
import {searchLocation} from './search-location'
3333
import {searchNearCity} from './search-near-city'
34-
import {shipLovers} from './ship-lovers'
34+
import {shipLovers} from './ship-profiles'
3535
import {starLover} from './star-lover'
3636
import {updateLover} from './update-lover'
3737
import {updateMe} from './update-me'
@@ -142,7 +142,7 @@ const handlers: { [k in APIPath]: APIHandler<k> } = {
142142
'me/delete': deleteMe,
143143
'update-lover': updateLover,
144144
'like-lover': likeLover,
145-
'ship-lovers': shipLovers,
145+
'ship-profiles': shipLovers,
146146
'get-likes-and-ships': getLikesAndShips,
147147
'has-free-like': hasFreeLike,
148148
'star-lover': starLover,
@@ -153,7 +153,7 @@ const handlers: { [k in APIPath]: APIHandler<k> } = {
153153
'create-comment': createComment,
154154
'hide-comment': hideComment,
155155
'create-compatibility-question': createCompatibilityQuestion,
156-
'compatible-lovers': getCompatibleLoversHandler,
156+
'compatible-profiles': getCompatibleLoversHandler,
157157
'search-location': searchLocation,
158158
'search-near-city': searchNearCity,
159159
'create-private-user-message': createPrivateUserMessage,
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
import { log } from 'shared/utils'
1010

1111
export const getCompatibleLoversHandler: APIHandler<
12-
'compatible-lovers'
12+
'compatible-profiles'
1313
> = async (props) => {
1414
return getCompatibleLovers(props.userId)
1515
}
@@ -25,17 +25,17 @@ export const getCompatibleLovers = async (userId: string) => {
2525

2626
if (!lover) throw new APIError(404, 'Lover not found')
2727

28-
const lovers = await getGenderCompatibleLovers(lover)
28+
const profiles = await getGenderCompatibleLovers(lover)
2929

3030
const loverAnswers = await getCompatibilityAnswers([
3131
userId,
32-
...lovers.map((l) => l.user_id),
32+
...profiles.map((l) => l.user_id),
3333
])
3434
log('got lover answers ' + loverAnswers.length)
3535

3636
const answersByUserId = groupBy(loverAnswers, 'creator_id')
3737
const loverCompatibilityScores = Object.fromEntries(
38-
lovers.map(
38+
profiles.map(
3939
(l) =>
4040
[
4141
l.user_id,
@@ -48,7 +48,7 @@ export const getCompatibleLovers = async (userId: string) => {
4848
)
4949

5050
const sortedCompatibleLovers = sortBy(
51-
lovers,
51+
profiles,
5252
(l) => loverCompatibilityScores[l.user_id].score
5353
).reverse()
5454

backend/api/src/create-lover.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const createLover: APIHandler<'create-lover'> = async (body, auth) => {
1212
const pg = createSupabaseDirectClient()
1313

1414
const { data: existingUser } = await tryCatch(
15-
pg.oneOrNone<{ id: string }>('select id from lovers where user_id = $1', [
15+
pg.oneOrNone<{ id: string }>('select id from profiles where user_id = $1', [
1616
auth.uid,
1717
])
1818
)
@@ -31,7 +31,7 @@ export const createLover: APIHandler<'create-lover'> = async (body, auth) => {
3131
console.log('body', body)
3232

3333
const { data, error } = await tryCatch(
34-
insert(pg, 'lovers', { user_id: auth.uid, ...body })
34+
insert(pg, 'profiles', { user_id: auth.uid, ...body })
3535
)
3636

3737
if (error) {

backend/api/src/get-likes-and-ships.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ export const getLikesAndShipsMain = async (userId: string) => {
2222
`
2323
select target_id, love_likes.created_time
2424
from love_likes
25-
join lovers on lovers.user_id = love_likes.target_id
25+
join profiles on profiles.user_id = love_likes.target_id
2626
join users on users.id = love_likes.target_id
2727
where creator_id = $1
2828
and looking_for_matches
29-
and lovers.pinned_url is not null
29+
and profiles.pinned_url is not null
3030
and (data->>'isBannedFromPosting' != 'true' or data->>'isBannedFromPosting' is null)
3131
order by created_time desc
3232
`,
@@ -44,11 +44,11 @@ export const getLikesAndShipsMain = async (userId: string) => {
4444
`
4545
select creator_id, love_likes.created_time
4646
from love_likes
47-
join lovers on lovers.user_id = love_likes.creator_id
47+
join profiles on profiles.user_id = love_likes.creator_id
4848
join users on users.id = love_likes.creator_id
4949
where target_id = $1
5050
and looking_for_matches
51-
and lovers.pinned_url is not null
51+
and profiles.pinned_url is not null
5252
and (data->>'isBannedFromPosting' != 'true' or data->>'isBannedFromPosting' is null)
5353
order by created_time desc
5454
`,
@@ -71,11 +71,11 @@ export const getLikesAndShipsMain = async (userId: string) => {
7171
target1_id, target2_id, creator_id, love_ships.created_time,
7272
target1_id as target_id
7373
from love_ships
74-
join lovers on lovers.user_id = love_ships.target1_id
74+
join profiles on profiles.user_id = love_ships.target1_id
7575
join users on users.id = love_ships.target1_id
7676
where target2_id = $1
77-
and lovers.looking_for_matches
78-
and lovers.pinned_url is not null
77+
and profiles.looking_for_matches
78+
and profiles.pinned_url is not null
7979
and (users.data->>'isBannedFromPosting' != 'true' or users.data->>'isBannedFromPosting' is null)
8080
8181
union all
@@ -84,11 +84,11 @@ export const getLikesAndShipsMain = async (userId: string) => {
8484
target1_id, target2_id, creator_id, love_ships.created_time,
8585
target2_id as target_id
8686
from love_ships
87-
join lovers on lovers.user_id = love_ships.target2_id
87+
join profiles on profiles.user_id = love_ships.target2_id
8888
join users on users.id = love_ships.target2_id
8989
where target1_id = $1
90-
and lovers.looking_for_matches
91-
and lovers.pinned_url is not null
90+
and profiles.looking_for_matches
91+
and profiles.pinned_url is not null
9292
and (users.data->>'isBannedFromPosting' != 'true' or users.data->>'isBannedFromPosting' is null)
9393
`,
9494
[userId],

backend/api/src/get-profiles.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {type APIHandler} from 'api/helpers/endpoint'
22
import {convertRow} from 'shared/love/supabase'
33
import {createSupabaseDirectClient} from 'shared/supabase/init'
44
import {from, join, limit, orderBy, renderSql, select, where,} from 'shared/supabase/sql-builder'
5-
import {getCompatibleLovers} from 'api/compatible-lovers'
5+
import {getCompatibleLovers} from 'api/compatible-profiles'
66
import {intersection} from 'lodash'
77
import {MAX_INT, MIN_INT} from "common/constants";
88

@@ -60,7 +60,7 @@ export const loadProfiles = async (props: profileQueryType) => {
6060
}
6161

6262
const {compatibleLovers} = await getCompatibleLovers(compatibleWithUserId)
63-
const lovers = compatibleLovers.filter(
63+
const profiles = compatibleLovers.filter(
6464
(l) =>
6565
(!name || l.user.name.toLowerCase().includes(name.toLowerCase())) &&
6666
(!genders || genders.includes(l.gender)) &&
@@ -85,19 +85,19 @@ export const loadProfiles = async (props: profileQueryType) => {
8585
)
8686

8787
const cursor = after
88-
? lovers.findIndex((l) => l.id.toString() === after) + 1
88+
? profiles.findIndex((l) => l.id.toString() === after) + 1
8989
: 0
9090
console.log(cursor)
9191

92-
if (limitParam) return lovers.slice(cursor, cursor + limitParam)
92+
if (limitParam) return profiles.slice(cursor, cursor + limitParam)
9393

94-
return lovers
94+
return profiles
9595
}
9696

9797
const query = renderSql(
98-
select('lovers.*, name, username, users.data as user'),
99-
from('lovers'),
100-
join('users on users.id = lovers.user_id'),
98+
select('profiles.*, name, username, users.data as user'),
99+
from('profiles'),
100+
join('users on users.id = profiles.user_id'),
101101
where('looking_for_matches = true'),
102102
// where(`pinned_url is not null and pinned_url != ''`),
103103
where(
@@ -149,7 +149,7 @@ export const loadProfiles = async (props: profileQueryType) => {
149149
orderBy(`${orderByParam} desc`),
150150
after &&
151151
where(
152-
`lovers.${orderByParam} < (select lovers.${orderByParam} from lovers where id = $(after))`,
152+
`profiles.${orderByParam} < (select profiles.${orderByParam} from profiles where id = $(after))`,
153153
{after}
154154
),
155155

@@ -165,9 +165,9 @@ export const loadProfiles = async (props: profileQueryType) => {
165165

166166
export const getProfiles: APIHandler<'get-profiles'> = async (props, _auth) => {
167167
try {
168-
const lovers = await loadProfiles(props)
169-
return {status: 'success', lovers: lovers}
168+
const profiles = await loadProfiles(props)
169+
return {status: 'success', profiles: profiles}
170170
} catch {
171-
return {status: 'fail', lovers: []}
171+
return {status: 'fail', profiles: []}
172172
}
173173
}

backend/api/src/remove-pinned-photo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const removePinnedPhoto: APIHandler<'remove-pinned-photo'> = async (
1717

1818
const pg = createSupabaseDirectClient()
1919
const { error } = await tryCatch(
20-
pg.none('update lovers set pinned_url = null where user_id = $1', [userId])
20+
pg.none('update profiles set pinned_url = null where user_id = $1', [userId])
2121
)
2222

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

8-
export const shipLovers: APIHandler<'ship-lovers'> = async (props, auth) => {
8+
export const shipLovers: APIHandler<'ship-profiles'> = async (props, auth) => {
99
const { targetUserId1, targetUserId2, remove } = props
1010
const creatorId = auth.uid
1111

backend/api/src/update-lover.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const updateLover: APIHandler<'update-lover'> = async (
1515
const pg = createSupabaseDirectClient()
1616

1717
const { data: existingLover } = await tryCatch(
18-
pg.oneOrNone<Row<'lovers'>>('select * from lovers where user_id = $1', [
18+
pg.oneOrNone<Row<'profiles'>>('select * from profiles where user_id = $1', [
1919
auth.uid,
2020
])
2121
)
@@ -33,7 +33,7 @@ export const updateLover: APIHandler<'update-lover'> = async (
3333
}
3434

3535
const { data, error } = await tryCatch(
36-
update(pg, 'lovers', 'user_id', { user_id: auth.uid, ...parsedBody })
36+
update(pg, 'profiles', 'user_id', { user_id: auth.uid, ...parsedBody })
3737
)
3838

3939
if (error) {

backend/email/emails/functions/mock.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export const sinclairLover: LoverRow = {
3333
created_time: '2023-10-27T00:41:59.851776+00:00',
3434
last_online_time: '2024-05-17T02:11:48.83+00:00',
3535
last_modification_time: '2024-05-17T02:11:48.83+00:00',
36-
bio_text: 'Hello',
3736
city: 'San Francisco',
3837
gender: 'trans-female',
3938
pref_gender: ['female', 'trans-female'],
@@ -132,7 +131,6 @@ export const jamesLover: LoverRow = {
132131
created_time: '2023-10-21T21:18:26.691211+00:00',
133132
last_online_time: '2024-07-06T17:29:16.833+00:00',
134133
last_modification_time: '2024-05-17T02:11:48.83+00:00',
135-
bio_text: 'Hello',
136134
city: 'San Francisco',
137135
gender: 'male',
138136
pref_gender: ['female'],

backend/scripts/2025-04-23-migrate-social-links.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import { chunk } from 'lodash'
88
runScript(async ({ pg }) => {
99
const directClient = createSupabaseDirectClient()
1010

11-
// Get all users and their corresponding lovers
11+
// Get all users and their corresponding profiles
1212
const users = await directClient.manyOrNone(`
1313
select u.id, u.data, l.twitter
1414
from users u
15-
left join lovers l on l.user_id = u.id
15+
left join profiles l on l.user_id = u.id
1616
`)
1717

1818
log('Found', users.length, 'users to migrate')

0 commit comments

Comments
 (0)