Ignore:
Timestamp:
08/24/26 20:57:09 (13 days ago)
Author:
kikisrbinoska <srbinoskakristina07@…>
Branches:
main
Parents:
a6e33d1
Message:

Added corrected entitef from the ER diagram and changes for the logic to be coresponding to the ddl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapterx-frontend/src/store/storyStore.ts

    ra6e33d1 re882b92  
    144144        cover_image: s.image ?? undefined,
    145145        mature_content: s.matureContent,
    146         status: 'published' as StoryStatus,
     146        status: (s.status ?? 'draft') as StoryStatus,
    147147        author_username: s.writer?.user?.username ?? '',
    148148        created_at: s.createdAt,
     
    193193        name: c.name ?? c.username ?? '',
    194194        story_title: '',
    195         role: 'editor' as any,
    196         permission_level: 3 as any,
     195        role: c.role as any,
     196        permission_level: (c.permissionLevel ?? 3) as any,
    197197        joined_at: c.createdAt,
    198198      }))
     
    246246        image: imageUrl,
    247247        content: partial.content ?? story.content,
     248        status: partial.status ?? story.status,
    248249      }, { headers: getAuthHeaders() })
    249250    } catch {
     
    266267  },
    267268
    268   updateStoryStatus: (id, status) =>
     269  updateStoryStatus: (id, status) => {
    269270    set(state => ({
    270271      stories: state.stories.map(s =>
    271272        s.story_id === id ? { ...s, status, updated_at: new Date().toISOString() } : s
    272273      ),
    273     })),
     274    }))
     275    get().updateStory(id, { status })
     276  },
    274277
    275278  addChapter: async (chapter) => {
     
    407410        storyId: collab.story_id,
    408411        role: collab.role,
     412        permissionLevel: collab.permission_level,
    409413      }, { headers: getAuthHeaders() })
    410414    } catch {
     
    445449        original_text: s.originalText,
    446450        suggested_text: s.suggestedText,
    447         suggestion_type: (s.suggestionTypes?.[0] ?? 'style') as SuggestionType,
     451        suggestion_type: (s.suggestionType ?? 'style') as SuggestionType,
     452        explanation: s.explanation ?? '',
    448453        accepted: s.accepted === true ? true : s.accepted === false ? false : null,
     454        created_at: s.createdAt ?? new Date().toISOString(),
    449455        applied_at: s.appliedAt ?? undefined,
    450456      }))
     
    506512        originalText: suggestion.original_text,
    507513        suggestedText: suggestion.suggested_text,
     514        suggestionType: suggestion.suggestion_type,
    508515        storyId: suggestion.chapter_id,
    509516      }, { headers: getAuthHeaders() })
Note: See TracChangeset for help on using the changeset viewer.