feat(ghost): Implement Tag, Author and Page models; add advanced filtering, search, bulk operations, image upload, related-posts, update tests and bump dependencies

This commit is contained in:
2025-10-07 13:53:58 +00:00
parent a0ffc7c4d7
commit a687b639d2
14 changed files with 7054 additions and 2367 deletions

50
ts/classes.author.ts Normal file
View File

@@ -0,0 +1,50 @@
import type { Ghost } from './classes.ghost.js';
import type { IAuthor } from './classes.post.js';
export class Author {
public ghostInstanceRef: Ghost;
public authorData: IAuthor;
constructor(ghostInstanceRefArg: Ghost, authorData: IAuthor) {
this.ghostInstanceRef = ghostInstanceRefArg;
this.authorData = authorData;
}
public getId(): string {
return this.authorData.id;
}
public getName(): string {
return this.authorData.name;
}
public getSlug(): string {
return this.authorData.slug;
}
public getProfileImage(): string | undefined {
return this.authorData.profile_image;
}
public getBio(): string | undefined {
return this.authorData.bio;
}
public toJson(): IAuthor {
return this.authorData;
}
public async update(authorData: Partial<IAuthor>): Promise<Author> {
try {
const updatedAuthorData = await this.ghostInstanceRef.adminApi.users.edit({
...authorData,
id: this.getId()
});
this.authorData = updatedAuthorData;
return this;
} catch (error) {
console.error('Error updating author:', error);
throw error;
}
}
}