1
This commit is contained in:
@@ -428,7 +428,8 @@ export class RuntimeRepository implements RuntimeRepositoryPort {
|
||||
landmark_count AS "landmarkCount"
|
||||
FROM custom_world_profiles
|
||||
WHERE user_id = $1
|
||||
AND profile_id = $2`,
|
||||
AND profile_id = $2
|
||||
AND deleted_at IS NULL`,
|
||||
[userId, profileId],
|
||||
);
|
||||
|
||||
@@ -887,6 +888,7 @@ export class RuntimeRepository implements RuntimeRepositoryPort {
|
||||
landmark_count AS "landmarkCount"
|
||||
FROM custom_world_profiles
|
||||
WHERE user_id = $1
|
||||
AND deleted_at IS NULL
|
||||
ORDER BY updated_at DESC
|
||||
LIMIT $2`,
|
||||
[userId, MAX_CUSTOM_WORLD_PROFILES],
|
||||
@@ -923,6 +925,7 @@ export class RuntimeRepository implements RuntimeRepositoryPort {
|
||||
ON CONFLICT (user_id, profile_id) DO UPDATE SET
|
||||
payload_json = EXCLUDED.payload_json,
|
||||
updated_at = EXCLUDED.updated_at,
|
||||
deleted_at = NULL,
|
||||
author_display_name = EXCLUDED.author_display_name,
|
||||
world_name = EXCLUDED.world_name,
|
||||
subtitle = EXCLUDED.subtitle,
|
||||
@@ -959,10 +962,17 @@ export class RuntimeRepository implements RuntimeRepositoryPort {
|
||||
}
|
||||
|
||||
async deleteCustomWorldProfile(userId: string, profileId: string) {
|
||||
const deletedAt = new Date().toISOString();
|
||||
await this.db.query(
|
||||
`DELETE FROM custom_world_profiles
|
||||
WHERE user_id = $1 AND profile_id = $2`,
|
||||
[userId, profileId],
|
||||
`UPDATE custom_world_profiles
|
||||
SET deleted_at = $1,
|
||||
updated_at = $1,
|
||||
visibility = 'draft',
|
||||
published_at = NULL
|
||||
WHERE user_id = $2
|
||||
AND profile_id = $3
|
||||
AND deleted_at IS NULL`,
|
||||
[deletedAt, userId, profileId],
|
||||
);
|
||||
|
||||
return this.listCustomWorldProfiles(userId);
|
||||
@@ -1172,6 +1182,7 @@ export class RuntimeRepository implements RuntimeRepositoryPort {
|
||||
landmark_count AS "landmarkCount"
|
||||
FROM custom_world_profiles
|
||||
WHERE visibility = 'published'
|
||||
AND deleted_at IS NULL
|
||||
ORDER BY published_at DESC, updated_at DESC
|
||||
LIMIT $1`,
|
||||
[MAX_PUBLIC_CUSTOM_WORLD_PROFILES],
|
||||
@@ -1202,7 +1213,8 @@ export class RuntimeRepository implements RuntimeRepositoryPort {
|
||||
FROM custom_world_profiles
|
||||
WHERE user_id = $1
|
||||
AND profile_id = $2
|
||||
AND visibility = 'published'`,
|
||||
AND visibility = 'published'
|
||||
AND deleted_at IS NULL`,
|
||||
[ownerUserId, profileId],
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user