feat: sample data

This commit is contained in:
2025-03-08 20:06:06 +07:00
parent b4ea46140d
commit 9ea91f3b40
13 changed files with 396 additions and 73 deletions

View File

@@ -8,6 +8,7 @@ import {Create as $Create} from "@wailsio/runtime";
export class Author {
"Id": number;
"Name": string;
"Posts": Post[];
/** Creates a new Author instance. */
constructor($$source: Partial<Author> = {}) {
@@ -17,6 +18,9 @@ export class Author {
if (!("Name" in $$source)) {
this["Name"] = "";
}
if (!("Posts" in $$source)) {
this["Posts"] = [];
}
Object.assign(this, $$source);
}
@@ -25,7 +29,11 @@ export class Author {
* Creates a new Author instance from a string or object.
*/
static createFrom($$source: any = {}): Author {
const $$createField2_0 = $$createType1;
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
if ("Posts" in $$parsedSource) {
$$parsedSource["Posts"] = $$createField2_0($$parsedSource["Posts"]);
}
return new Author($$parsedSource as Partial<Author>);
}
}
@@ -33,7 +41,10 @@ export class Author {
export class Post {
"Id": number;
"Text": string;
"Deadline": number;
"CreatedAt": number;
"AuthorId": number;
"Author": Author;
/** Creates a new Post instance. */
constructor($$source: Partial<Post> = {}) {
@@ -43,9 +54,18 @@ export class Post {
if (!("Text" in $$source)) {
this["Text"] = "";
}
if (!("Deadline" in $$source)) {
this["Deadline"] = 0;
}
if (!("CreatedAt" in $$source)) {
this["CreatedAt"] = 0;
}
if (!("AuthorId" in $$source)) {
this["AuthorId"] = 0;
}
if (!("Author" in $$source)) {
this["Author"] = (new Author());
}
Object.assign(this, $$source);
}
@@ -54,7 +74,16 @@ export class Post {
* Creates a new Post instance from a string or object.
*/
static createFrom($$source: any = {}): Post {
const $$createField5_0 = $$createType2;
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
if ("Author" in $$parsedSource) {
$$parsedSource["Author"] = $$createField5_0($$parsedSource["Author"]);
}
return new Post($$parsedSource as Partial<Post>);
}
}
// Private type creation functions
const $$createType0 = Post.createFrom;
const $$createType1 = $Create.Array($$createType0);
const $$createType2 = Author.createFrom;