mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-05-19 06:17:04 -04:00
Rename love_likes
This commit is contained in:
@@ -20,10 +20,10 @@ export const getLikesAndShipsMain = async (userId: string) => {
|
||||
created_time: number
|
||||
}>(
|
||||
`
|
||||
select target_id, love_likes.created_time
|
||||
from love_likes
|
||||
join profiles on profiles.user_id = love_likes.target_id
|
||||
join users on users.id = love_likes.target_id
|
||||
select target_id, profile_likes.created_time
|
||||
from profile_likes
|
||||
join profiles on profiles.user_id = profile_likes.target_id
|
||||
join users on users.id = profile_likes.target_id
|
||||
where creator_id = $1
|
||||
and looking_for_matches
|
||||
and profiles.pinned_url is not null
|
||||
@@ -42,10 +42,10 @@ export const getLikesAndShipsMain = async (userId: string) => {
|
||||
created_time: number
|
||||
}>(
|
||||
`
|
||||
select creator_id, love_likes.created_time
|
||||
from love_likes
|
||||
join profiles on profiles.user_id = love_likes.creator_id
|
||||
join users on users.id = love_likes.creator_id
|
||||
select creator_id, profile_likes.created_time
|
||||
from profile_likes
|
||||
join profiles on profiles.user_id = profile_likes.creator_id
|
||||
join users on users.id = profile_likes.creator_id
|
||||
where target_id = $1
|
||||
and looking_for_matches
|
||||
and profiles.pinned_url is not null
|
||||
|
||||
@@ -17,7 +17,7 @@ export const getHasFreeLike = async (userId: string) => {
|
||||
const likeGivenToday = await pg.oneOrNone<object>(
|
||||
`
|
||||
select 1
|
||||
from love_likes
|
||||
from profile_likes
|
||||
where creator_id = $1
|
||||
and created_time at time zone 'UTC' at time zone 'America/Los_Angeles' >= (now() at time zone 'UTC' at time zone 'America/Los_Angeles')::date
|
||||
and created_time at time zone 'UTC' at time zone 'America/Los_Angeles' < ((now() at time zone 'UTC' at time zone 'America/Los_Angeles')::date + interval '1 day')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createSupabaseDirectClient } from 'shared/supabase/init'
|
||||
import { APIError, APIHandler } from './helpers/endpoint'
|
||||
import { createLoveLikeNotification } from 'shared/create-love-notification'
|
||||
import { createProfileLikeNotification } from 'shared/create-love-notification'
|
||||
import { getHasFreeLike } from './has-free-like'
|
||||
import { log } from 'shared/utils'
|
||||
import { tryCatch } from 'common/util/try-catch'
|
||||
@@ -15,7 +15,7 @@ export const likeProfile: APIHandler<'like-profile'> = async (props, auth) => {
|
||||
if (remove) {
|
||||
const { error } = await tryCatch(
|
||||
pg.none(
|
||||
'delete from love_likes where creator_id = $1 and target_id = $2',
|
||||
'delete from profile_likes where creator_id = $1 and target_id = $2',
|
||||
[creatorId, targetUserId]
|
||||
)
|
||||
)
|
||||
@@ -28,8 +28,8 @@ export const likeProfile: APIHandler<'like-profile'> = async (props, auth) => {
|
||||
|
||||
// Check if like already exists
|
||||
const { data: existing } = await tryCatch(
|
||||
pg.oneOrNone<Row<'love_likes'>>(
|
||||
'select * from love_likes where creator_id = $1 and target_id = $2',
|
||||
pg.oneOrNone<Row<'profile_likes'>>(
|
||||
'select * from profile_likes where creator_id = $1 and target_id = $2',
|
||||
[creatorId, targetUserId]
|
||||
)
|
||||
)
|
||||
@@ -48,8 +48,8 @@ export const likeProfile: APIHandler<'like-profile'> = async (props, auth) => {
|
||||
|
||||
// Insert the new like
|
||||
const { data, error } = await tryCatch(
|
||||
pg.one<Row<'love_likes'>>(
|
||||
'insert into love_likes (creator_id, target_id) values ($1, $2) returning *',
|
||||
pg.one<Row<'profile_likes'>>(
|
||||
'insert into profile_likes (creator_id, target_id) values ($1, $2) returning *',
|
||||
[creatorId, targetUserId]
|
||||
)
|
||||
)
|
||||
@@ -59,7 +59,7 @@ export const likeProfile: APIHandler<'like-profile'> = async (props, auth) => {
|
||||
}
|
||||
|
||||
const continuation = async () => {
|
||||
await createLoveLikeNotification(data)
|
||||
await createProfileLikeNotification(data)
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user