11import { log } from "@/app.js" ;
2- import { userTable } from "@/shared-backend/schema.js" ;
2+ import { conversationTable , userTable } from "@/shared-backend/schema.js" ;
33import type { PostgresJsDatabase } from "drizzle-orm/postgres-js" ;
44import { eq } from "drizzle-orm" ;
55import { getAllUserComments , getUserPosts , getUserVotes } from "./user.js" ;
@@ -9,9 +9,7 @@ import { nowZeroMs } from "@/shared/util.js";
99import { logout } from "./auth.js" ;
1010import { httpErrors } from "@fastify/sensible" ;
1111import { MAX_LENGTH_USERNAME } from "@/shared/shared.js" ;
12- import type { AxiosInstance } from "axios" ;
1312import { castVoteForOpinionSlugIdFromUserId } from "./voting.js" ;
14- import * as polisService from "@/service/polis.js" ;
1513import { useCommonPost } from "./common.js" ;
1614
1715interface CheckUserNameExistProps {
@@ -614,14 +612,6 @@ interface DeleteAccountProps {
614612 didWrite : string ;
615613 userId : string ;
616614 baseImageServiceUrl : string ;
617- axiosPolis ?: AxiosInstance ;
618- awsAiLabelSummaryEnable : boolean ;
619- awsAiLabelSummaryRegion : string ;
620- awsAiLabelSummaryModelId : string ;
621- awsAiLabelSummaryTemperature : string ;
622- awsAiLabelSummaryTopP : string ;
623- awsAiLabelSummaryMaxTokens : string ;
624- awsAiLabelSummaryPrompt : string ;
625615 voteNotifMilestones : number [ ] ;
626616}
627617
@@ -632,14 +622,6 @@ export async function deleteUserAccount({
632622 proof,
633623 didWrite,
634624 baseImageServiceUrl,
635- axiosPolis,
636- awsAiLabelSummaryEnable,
637- awsAiLabelSummaryRegion,
638- awsAiLabelSummaryModelId,
639- awsAiLabelSummaryTemperature,
640- awsAiLabelSummaryTopP,
641- awsAiLabelSummaryMaxTokens,
642- awsAiLabelSummaryPrompt,
643625 voteNotifMilestones,
644626} : DeleteAccountProps ) {
645627 // TODO: 1. confirmation should be requested upon account deletion request (phone number or ZKP)
@@ -759,30 +741,14 @@ export async function deleteUserAccount({
759741 db,
760742 conversationSlugId : affectedConversation . conversationSlugId ,
761743 } ) ;
762- if ( axiosPolis !== undefined ) {
763- const votes = await polisService . getPolisVotes ( {
764- db,
765- conversationId : affectedConversation . conversationId ,
766- conversationSlugId : affectedConversation . conversationSlugId ,
767- } ) ;
768- polisService
769- . getAndUpdatePolisMath ( {
770- db : db ,
771- conversationSlugId : affectedConversation . conversationSlugId ,
772- conversationId : affectedConversation . conversationId ,
773- axiosPolis,
774- votes,
775- awsAiLabelSummaryEnable,
776- awsAiLabelSummaryRegion,
777- awsAiLabelSummaryModelId,
778- awsAiLabelSummaryTemperature,
779- awsAiLabelSummaryTopP,
780- awsAiLabelSummaryMaxTokens,
781- awsAiLabelSummaryPrompt,
782- } )
783- . catch ( ( e : unknown ) => {
784- log . error ( e ) ;
785- } ) ;
786- }
744+ await db
745+ . update ( conversationTable )
746+ . set ( {
747+ needsMathUpdate : true ,
748+ mathUpdateRequestedAt : nowZeroMs ( ) ,
749+ } )
750+ . where (
751+ eq ( conversationTable . id , affectedConversation . conversationId ) ,
752+ ) ;
787753 }
788754}
0 commit comments