feat: new nto-cli version changes
# Conflicts: # frontend/src/author/AuthorScheme.vue # frontend/src/post/PostScheme.vue # internal/models/models.go
This commit is contained in:
@@ -1,24 +1,21 @@
|
||||
<script setup lang="ts">
|
||||
import Table from '../table/Table.vue'
|
||||
import {onMounted, reactive} from 'vue'
|
||||
import {getDefaultValues} from '../utils/structs/defaults.util'
|
||||
import Service from './author.service.ts'
|
||||
import type {Scheme} from '../types/scheme.type'
|
||||
import {Author} from '../../bindings/app/internal/services'
|
||||
import Table from "../table/Table.vue";
|
||||
import { onMounted, reactive } from "vue";
|
||||
import { getDefaultValues } from "../utils/structs/defaults.util";
|
||||
import Service from "./author.service.ts";
|
||||
import type { Scheme } from "../types/scheme.type";
|
||||
import { Author } from "../../bindings/app/internal/services";
|
||||
|
||||
import PostService from '../post/post.service.ts'
|
||||
import PostService from "../post/post.service.ts";
|
||||
const postService = new PostService();
|
||||
|
||||
const postService = new PostService
|
||||
|
||||
|
||||
const service = new Service
|
||||
const service = new Service();
|
||||
|
||||
onMounted(async () => {
|
||||
(scheme as any).Posts.type!.nested!.values = await postService.readAll()
|
||||
})
|
||||
(scheme as any).Posts.type!.nested!.values = await postService.readAll();
|
||||
});
|
||||
|
||||
const scheme: Scheme<Author> = reactive({
|
||||
entityId: "AuthorId",
|
||||
Id: {
|
||||
hidden: true,
|
||||
type: {
|
||||
@@ -39,15 +36,13 @@ const scheme: Scheme<Author> = reactive({
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: ['Text']
|
||||
field: [""],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
const getDefaults = () => getDefaultValues(scheme)
|
||||
|
||||
const getDefaults = () => getDefaultValues(scheme);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -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<Author> {
|
||||
async read(id: number) {
|
||||
return await GetById(id) as Author
|
||||
return (await GetById(id)) as Author;
|
||||
}
|
||||
|
||||
async readAll() {
|
||||
return await GetAll() as Author[]
|
||||
return (await GetAll()) as Author[];
|
||||
}
|
||||
|
||||
async create(item: Author) {
|
||||
await Create(item)
|
||||
await Create(item);
|
||||
}
|
||||
|
||||
async delete(id: number) {
|
||||
return await Delete(id)
|
||||
return await Delete(id);
|
||||
}
|
||||
|
||||
async update(item: Author) {
|
||||
await Update(item)
|
||||
await Update(item);
|
||||
}
|
||||
|
||||
async count() {
|
||||
return await Count()
|
||||
return await Count();
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,21 @@
|
||||
<script setup lang="ts">
|
||||
import Table from '../table/Table.vue'
|
||||
import { onMounted, reactive } from 'vue'
|
||||
import { getDefaultValues } from '../utils/structs/defaults.util'
|
||||
import Service from './post.service.ts'
|
||||
import type { Scheme } from '../types/scheme.type'
|
||||
import { Post } from '../../bindings/app/internal/services'
|
||||
import Table from "../table/Table.vue";
|
||||
import { onMounted, reactive } from "vue";
|
||||
import { getDefaultValues } from "../utils/structs/defaults.util";
|
||||
import Service from "./post.service.ts";
|
||||
import type { Scheme } from "../types/scheme.type";
|
||||
import { Post } from "../../bindings/app/internal/services";
|
||||
|
||||
import AuthorService from '../author/author.service.ts'
|
||||
const authorService = new AuthorService
|
||||
import AuthorService from "../author/author.service.ts";
|
||||
const authorService = new AuthorService();
|
||||
|
||||
|
||||
const service = new Service
|
||||
const service = new Service();
|
||||
|
||||
onMounted(async () => {
|
||||
|
||||
(scheme as any).Author.type!.nested!.values = await authorService.readAll()
|
||||
|
||||
})
|
||||
(scheme as any).Author.type!.nested!.values = await authorService.readAll();
|
||||
});
|
||||
|
||||
const scheme: Scheme<Post> = reactive({
|
||||
entityId: 'PostId',
|
||||
Id: {
|
||||
hidden: true,
|
||||
type: {
|
||||
@@ -36,19 +32,21 @@ const scheme: Scheme<Post> = reactive({
|
||||
|
||||
Deadline: {
|
||||
russian: "Дедлайн",
|
||||
date: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
CreatedAt: {
|
||||
hidden: true,
|
||||
date: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
},
|
||||
|
||||
AuthorId: {
|
||||
hidden: true,
|
||||
type: {
|
||||
primitive: "number",
|
||||
},
|
||||
@@ -59,15 +57,13 @@ const scheme: Scheme<Post> = reactive({
|
||||
type: {
|
||||
nested: {
|
||||
values: [],
|
||||
field: ['Name']
|
||||
field: ["Name"],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
const getDefaults = () => getDefaultValues(scheme)
|
||||
|
||||
const getDefaults = () => getDefaultValues(scheme);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -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<Post> {
|
||||
async read(id: number) {
|
||||
return await GetById(id) as Post
|
||||
return (await GetById(id)) as Post;
|
||||
}
|
||||
|
||||
async readAll() {
|
||||
return await GetAll() as Post[]
|
||||
return (await GetAll()) as Post[];
|
||||
}
|
||||
|
||||
async create(item: Post) {
|
||||
await Create(item)
|
||||
await Create(item);
|
||||
}
|
||||
|
||||
async delete(id: number) {
|
||||
return await Delete(id)
|
||||
return await Delete(id);
|
||||
}
|
||||
|
||||
async update(item: Post) {
|
||||
await Update(item)
|
||||
await Update(item);
|
||||
}
|
||||
|
||||
async count() {
|
||||
return await Count()
|
||||
return await Count();
|
||||
}
|
||||
}
|
||||
@@ -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"`
|
||||
Name string `ui:"label:Имя;"`
|
||||
Posts []Post `ui:"label:Посты; field:Text;"`
|
||||
}
|
||||
|
||||
// TODO: correct processing the semicolon (get attention to quotes)
|
||||
|
||||
Reference in New Issue
Block a user