@@ -41,7 +41,6 @@ import { loginRequired } from "../login.ts";
41
41
import {
42
42
type Account ,
43
43
type AccountOwner ,
44
- type List ,
45
44
type Post ,
46
45
type PostVisibility ,
47
46
accountOwners ,
@@ -1026,24 +1025,23 @@ accounts.post("/:id/migrate/import", async (c) => {
1026
1025
const listNames = new Set ( csv . map ( ( row ) => row [ 0 ] . trim ( ) ) ) ;
1027
1026
const listIds : Record < string , string > = { } ;
1028
1027
for ( const listName of listNames ) {
1029
- const result = await db
1030
- . insert ( lists )
1031
- . values ( {
1032
- id : crypto . randomUUID ( ) ,
1033
- title : listName ,
1034
- accountOwnerId : accountOwner . id ,
1035
- } )
1036
- . onConflictDoNothing ( )
1037
- . returning ( ) ;
1038
- let list : List | undefined ;
1039
- if ( result . length < 1 ) {
1040
- list = await db . query . lists . findFirst ( {
1041
- where : and (
1042
- eq ( lists . accountOwnerId , accountOwner . id ) ,
1043
- eq ( lists . title , listName ) ,
1044
- ) ,
1045
- } ) ;
1046
- } else {
1028
+ let list = await db . query . lists . findFirst ( {
1029
+ where : and (
1030
+ eq ( lists . accountOwnerId , accountOwner . id ) ,
1031
+ eq ( lists . title , listName ) ,
1032
+ ) ,
1033
+ } ) ;
1034
+ if ( list == null ) {
1035
+ const result = await db
1036
+ . insert ( lists )
1037
+ . values ( {
1038
+ id : crypto . randomUUID ( ) ,
1039
+ title : listName ,
1040
+ accountOwnerId : accountOwner . id ,
1041
+ } )
1042
+ . onConflictDoNothing ( )
1043
+ . returning ( ) ;
1044
+ if ( result . length < 1 ) continue ;
1047
1045
list = result [ 0 ] ;
1048
1046
}
1049
1047
if ( list == null ) continue ;
0 commit comments