@@ -965,7 +965,10 @@ export const repository = {
965965
966966 return { node : newNode , summary : classification . summary } ;
967967 } ,
968- async updateNode ( nodeId : string , updates : Partial < Pick < Node , 'title' | 'parent_id' > & { language_hint ?: string | null ; default_view_mode ?: ViewMode | null } > ) {
968+ async updateNode (
969+ nodeId : string ,
970+ updates : Partial < Pick < Node , 'title' | 'parent_id' > & { language_hint ?: string | null ; default_view_mode ?: ViewMode | null ; doc_type ?: DocType | null } > ,
971+ ) {
969972 if ( ! isElectron ) {
970973 const state = ensureBrowserState ( ) ;
971974 const result = findNodeWithParent ( nodeId , state . nodes ) ;
@@ -1001,6 +1004,11 @@ export const repository = {
10011004 if ( updates . default_view_mode !== undefined ) {
10021005 node . document . default_view_mode = updates . default_view_mode ;
10031006 }
1007+ if ( updates . doc_type !== undefined ) {
1008+ node . document . doc_type = updates . doc_type ?? node . document . doc_type ;
1009+ node . document . doc_type_source = 'user' ;
1010+ node . document . classification_updated_at = now ;
1011+ }
10041012 }
10051013
10061014 node . updated_at = now ;
@@ -1038,6 +1046,14 @@ export const repository = {
10381046 ) ;
10391047 await window . electronAPI ! . dbRun ( `UPDATE nodes SET updated_at = ? WHERE node_id = ?` , [ now , nodeId ] ) ;
10401048 }
1049+
1050+ if ( updates . doc_type !== undefined ) {
1051+ await window . electronAPI ! . dbRun (
1052+ `UPDATE documents SET doc_type = ?, doc_type_source = 'user', classification_updated_at = ? WHERE node_id = ?` ,
1053+ [ updates . doc_type , now , nodeId ]
1054+ ) ;
1055+ await window . electronAPI ! . dbRun ( `UPDATE nodes SET updated_at = ? WHERE node_id = ?` , [ now , nodeId ] ) ;
1056+ }
10411057 } ,
10421058
10431059 async updateDocumentContent ( nodeId : string , newContent : string , documentId ?: number ) {
0 commit comments