Genfic / Ogma

Publish your stories, talk about them, categorize them to your heart's content
https://genfic.net
GNU General Public License v3.0
2 stars 1 forks source link

Some paths in the API don't return DTOs #91

Closed Atulin closed 6 months ago

Atulin commented 6 months ago

Generating TS clients results in this curious code:

export interface FolderStory {
    folder: Folder | null;
    folderId: number;
    story: Story | null;
    storyId: number;
    added: string;
    addedBy: OgmaUser | null;
    addedById: number;
}

export interface ClubMember {
    member: OgmaUser;
    memberId: number;
    club: Club;
    clubId: number;
    role: EClubMemberRoles;
    memberSince: string;
}

// snip

export interface BlacklistedRating {
    user: OgmaUser | null;
    userId: number;
    rating: Rating | null;
    ratingId: number;
}

export interface BlacklistedTag {
    user: OgmaUser | null;
    userId: number;
    tag: Tag | null;
    tagId: number;
}

with Folder, Story, OgmaUser, Rating, and Tag requiring references to nonexistent types. Nonexistent, because Ogma/Tool is unable to generate types that have an inheritance hierarchy to them.

This needs fixing.

Atulin commented 6 months ago
Research so far * **Folder** * Types that reference it: * `FolderStory` * `Story` * `Club` * `Folder` * **Story** * Types that reference it: * `FolderStory` * `Folder` * `OgmaUser` * `Report` * `Chapter` * `Tag` * `Shelf` * `Blogpost` * **OgmaUser** * Types that reference it: * `FolderStory` * `Club` * `ClubMember` * `OgmaUser` * `CommentsThread` * `Comment` <--- stopped here * `Report` * `Story` * `ContentBlock` * `Vote` * `Shelf` * `Blogpost` * `ClubThread` * `UserRole` * `OgmaRole` * `BlacklistedRating` * `BlacklistedTag` * `Infraction` * `Notification` * **Club** * Types that reference it: * `Folder` * `ClubMember` * `OgmaUser` * `Report` * `ClubThread` * **Rating** * Types that reference it: * `Story` * `BlacklistedRating` * **Tag** * Types that reference it: * `Story` * `BlacklistedTag` * **FolderStory** * Routes that reference it: * `/api/folders/add-story` <--- sus * **Report** * Types that reference it: * `Club` * `OgmaUser` * `Comment` * `Story` * `Chapter` * `Blogpost` * **Chapter** * Types that reference it: * `CommentsThread` * `Report` * `Story` * `Blogpost` * **Shelf** * Types that reference it: * `Story * **Blogpost** * Types that reference it: * `OgmaUser` * `CommentsThread` * `Report` * **ClubMember** * Types that reference it: * `Club` * **CommentsThread** * Types that reference it: * `OgmaUser` * `Comment` * `Chapter` * `Blogpost` * `ClubThread` * **Comment** * Types that reference it: * `CommentsThread` * `CommentRevision` * `Report` ...
Atulin commented 6 months ago

Right now, it seems /api/folders/add-story is sus. Let's investigate.

Atulin commented 6 months ago

Yes. It was this one, single motherfucker who was leaking the entire database structure...