management of library
All checks were successful
build / windows (push) Successful in 2m38s
build / linux (push) Successful in 2m0s

This commit is contained in:
2025-03-07 11:51:21 +01:00
parent e90cdf4e6a
commit 5bedea5312
26 changed files with 1078 additions and 228 deletions

View File

@ -1,35 +1,30 @@
export namespace model {
export class SubThing {
export class Client {
ID: number;
ThingID: number;
// Go type: time
CreatedAt: any;
// Go type: time
UpdatedAt: any;
// Go type: gorm
DeletedAt: any;
Name: string;
Email: string;
Lendings: Lending[];
static createFrom(source: any = {}) {
return new SubThing(source);
return new Client(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.ID = source["ID"];
this.ThingID = source["ThingID"];
this.CreatedAt = this.convertValues(source["CreatedAt"], null);
this.UpdatedAt = this.convertValues(source["UpdatedAt"], null);
this.DeletedAt = this.convertValues(source["DeletedAt"], null);
this.Name = source["Name"];
}
}
export class Thing {
ID: number;
Name: string;
Subthings: SubThing[];
static createFrom(source: any = {}) {
return new Thing(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.ID = source["ID"];
this.Name = source["Name"];
this.Subthings = this.convertValues(source["Subthings"], SubThing);
this.Email = source["Email"];
this.Lendings = this.convertValues(source["Lendings"], Lending);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
@ -50,6 +45,152 @@ export namespace model {
return a;
}
}
export class Lending {
ID: number;
// Go type: time
CreatedAt: any;
// Go type: time
UpdatedAt: any;
// Go type: gorm
DeletedAt: any;
// Go type: time
DueDate: any;
Returned: boolean;
ClientID: number;
Client: Client;
BookID: number;
Book: Book;
static createFrom(source: any = {}) {
return new Lending(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.ID = source["ID"];
this.CreatedAt = this.convertValues(source["CreatedAt"], null);
this.UpdatedAt = this.convertValues(source["UpdatedAt"], null);
this.DeletedAt = this.convertValues(source["DeletedAt"], null);
this.DueDate = this.convertValues(source["DueDate"], null);
this.Returned = source["Returned"];
this.ClientID = source["ClientID"];
this.Client = this.convertValues(source["Client"], Client);
this.BookID = source["BookID"];
this.Book = this.convertValues(source["Book"], Book);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class Book {
ID: number;
// Go type: time
CreatedAt: any;
// Go type: time
UpdatedAt: any;
// Go type: gorm
DeletedAt: any;
Title: string;
ISBN: string;
AuthorID: number;
Author: Author;
Lendings: Lending[];
static createFrom(source: any = {}) {
return new Book(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.ID = source["ID"];
this.CreatedAt = this.convertValues(source["CreatedAt"], null);
this.UpdatedAt = this.convertValues(source["UpdatedAt"], null);
this.DeletedAt = this.convertValues(source["DeletedAt"], null);
this.Title = source["Title"];
this.ISBN = source["ISBN"];
this.AuthorID = source["AuthorID"];
this.Author = this.convertValues(source["Author"], Author);
this.Lendings = this.convertValues(source["Lendings"], Lending);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class Author {
ID: number;
// Go type: time
CreatedAt: any;
// Go type: time
UpdatedAt: any;
// Go type: gorm
DeletedAt: any;
Name: string;
Books: Book[];
static createFrom(source: any = {}) {
return new Author(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.ID = source["ID"];
this.CreatedAt = this.convertValues(source["CreatedAt"], null);
this.UpdatedAt = this.convertValues(source["UpdatedAt"], null);
this.DeletedAt = this.convertValues(source["DeletedAt"], null);
this.Name = source["Name"];
this.Books = this.convertValues(source["Books"], Book);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
}