From 6e9b2c61fc8034f872c9fe23f60260fe273ae406 Mon Sep 17 00:00:00 2001 From: gogacoder Date: Sun, 9 Mar 2025 13:22:15 +0700 Subject: [PATCH] feat: new nto-cli version changes # Conflicts: # frontend/src/author/AuthorScheme.vue # frontend/src/post/PostScheme.vue # internal/models/models.go --- frontend/src/author/AuthorScheme.vue | 35 +++++----- frontend/src/author/author.service.ts | 51 ++++++++------- frontend/src/post/PostScheme.vue | 94 +++++++++++++-------------- frontend/src/post/post.service.ts | 51 ++++++++------- internal/models/models.go | 18 +++-- 5 files changed, 126 insertions(+), 123 deletions(-) diff --git a/frontend/src/author/AuthorScheme.vue b/frontend/src/author/AuthorScheme.vue index d02a00a..908f8ae 100644 --- a/frontend/src/author/AuthorScheme.vue +++ b/frontend/src/author/AuthorScheme.vue @@ -1,24 +1,21 @@ \ No newline at end of file + diff --git a/frontend/src/author/author.service.ts b/frontend/src/author/author.service.ts index 5d88779..88d43b3 100644 --- a/frontend/src/author/author.service.ts +++ b/frontend/src/author/author.service.ts @@ -1,29 +1,36 @@ -import { GetAll, Create, Delete, GetById, Update, Count } from "../../bindings/app/internal/services/authorservice.ts" -import type { Author } from "../../bindings/app/internal/services" -import type { IService } from "../types/service.type.ts" +import { + GetAll, + Create, + Delete, + GetById, + Update, + Count, +} from "../../bindings/app/internal/services/authorservice.ts"; +import type { Author } from "../../bindings/app/internal/services"; +import type { IService } from "../types/service.type.ts"; export default class AuthorService implements IService { - async read(id: number) { - return await GetById(id) as Author - } + async read(id: number) { + return (await GetById(id)) as Author; + } - async readAll() { - return await GetAll() as Author[] - } + async readAll() { + return (await GetAll()) as Author[]; + } - async create(item: Author) { - await Create(item) - } + async create(item: Author) { + await Create(item); + } - async delete(id: number) { - return await Delete(id) - } + async delete(id: number) { + return await Delete(id); + } - async update(item: Author) { - await Update(item) - } + async update(item: Author) { + await Update(item); + } - async count() { - return await Count() - } -} \ No newline at end of file + async count() { + return await Count(); + } +} diff --git a/frontend/src/post/PostScheme.vue b/frontend/src/post/PostScheme.vue index eb234a0..a6128ac 100644 --- a/frontend/src/post/PostScheme.vue +++ b/frontend/src/post/PostScheme.vue @@ -1,77 +1,73 @@ \ No newline at end of file +
+
+
+ diff --git a/frontend/src/post/post.service.ts b/frontend/src/post/post.service.ts index ce362dc..01436ca 100644 --- a/frontend/src/post/post.service.ts +++ b/frontend/src/post/post.service.ts @@ -1,29 +1,36 @@ -import { GetAll, Create, Delete, GetById, Update, Count } from "../../bindings/app/internal/services/postservice.ts" -import type { Post } from "../../bindings/app/internal/services" -import type { IService } from "../types/service.type.ts" +import { + GetAll, + Create, + Delete, + GetById, + Update, + Count, +} from "../../bindings/app/internal/services/postservice.ts"; +import type { Post } from "../../bindings/app/internal/services"; +import type { IService } from "../types/service.type.ts"; export default class PostService implements IService { - async read(id: number) { - return await GetById(id) as Post - } + async read(id: number) { + return (await GetById(id)) as Post; + } - async readAll() { - return await GetAll() as Post[] - } + async readAll() { + return (await GetAll()) as Post[]; + } - async create(item: Post) { - await Create(item) - } + async create(item: Post) { + await Create(item); + } - async delete(id: number) { - return await Delete(id) - } + async delete(id: number) { + return await Delete(id); + } - async update(item: Post) { - await Update(item) - } + async update(item: Post) { + await Update(item); + } - async count() { - return await Count() - } -} \ No newline at end of file + async count() { + return await Count(); + } +} diff --git a/internal/models/models.go b/internal/models/models.go index 33293c5..70a0fe0 100644 --- a/internal/models/models.go +++ b/internal/models/models.go @@ -6,17 +6,15 @@ var Entities = []any{ type Post struct { Id uint `gorm:"primaryKey" ui:"hidden"` - Text string `displayName:"Текст" ui:"label=Текст"` - Deadline int64 `ui:"label=Дедлайн"` - CreatedAt int64 `gorm:"autoCreateTime" ui:"hidden"` - AuthorId uint - Author Author `ui:"label=Автор, data=Author, field=[Name]" gorm:"constraint:OnUpdate:CASCADE;OnDelete:CASCADE"` + Text string `displayName:"Текст" ui:"label:Текст"` + Deadline int64 `ui:"label:Дедлайн;datatype:datetime;"` + CreatedAt int64 `gorm:"autoCreateTime" ui:"readonly;datatype:datetime;"` + AuthorId uint `ui:"hidden"` + Author Author `ui:"label:Автор; field:Name;"` } type Author struct { Id uint `gorm:"primaryKey" ui:"hidden"` - Name string `ui:"label=Имя"` - Posts []Post `ui:"label=Посты, data=Post, field=[Text]" gorm:"constraint:OnUpdate:CASCADE;OnDelete:CASCADE"` -} - -// TODO: correct processing the semicolon (get attention to quotes) + Name string `ui:"label:Имя;"` + Posts []Post `ui:"label:Посты; field:Text;"` +} \ No newline at end of file