fix: use string for entity uuid

This commit is contained in:
Oliver Booth 2023-08-11 16:31:18 +01:00
parent 1fe65aed3b
commit e060ab4dea
Signed by: oliverbooth
GPG Key ID: 725DB725A0D9EE61
2 changed files with 6 additions and 6 deletions

View File

@ -17,7 +17,7 @@ class API {
return JSON.parse(text).map(obj => new BlogPost(obj)); return JSON.parse(text).map(obj => new BlogPost(obj));
} }
static async getAuthor(id: number): Promise<Author> { static async getAuthor(id: string): Promise<Author> {
const response = await fetch(`${API.BASE_URL + API.BLOG_URL}/author/${id}`); const response = await fetch(`${API.BASE_URL + API.BLOG_URL}/author/${id}`);
const text = await response.text(); const text = await response.text();
return new Author(JSON.parse(text)); return new Author(JSON.parse(text));

View File

@ -1,9 +1,9 @@
class BlogPost { class BlogPost {
private readonly _id: number; private readonly _id: string;
private readonly _commentsEnabled: boolean; private readonly _commentsEnabled: boolean;
private readonly _title: string; private readonly _title: string;
private readonly _excerpt: string; private readonly _excerpt: string;
private readonly _authorId: number; private readonly _authorId: string;
private readonly _published: Date; private readonly _published: Date;
private readonly _updated?: Date; private readonly _updated?: Date;
private readonly _url: string; private readonly _url: string;
@ -17,7 +17,7 @@ class BlogPost {
this._commentsEnabled = json.commentsEnabled; this._commentsEnabled = json.commentsEnabled;
this._title = json.title; this._title = json.title;
this._excerpt = json.excerpt; this._excerpt = json.excerpt;
this._authorId = parseInt(json.author); this._authorId = json.author;
this._published = new Date(json.published * 1000); this._published = new Date(json.published * 1000);
this._updated = (json.updated && new Date(json.updated * 1000)) || null; this._updated = (json.updated && new Date(json.updated * 1000)) || null;
this._url = json.url; this._url = json.url;
@ -27,7 +27,7 @@ class BlogPost {
this._formattedDate = json.formattedDate; this._formattedDate = json.formattedDate;
} }
get id(): number { get id(): string {
return this._id; return this._id;
} }
@ -43,7 +43,7 @@ class BlogPost {
return this._excerpt; return this._excerpt;
} }
get authorId(): number { get authorId(): string {
return this._authorId; return this._authorId;
} }