поменял конфиг, мелкие правки
This commit is contained in:
parent
89f64aae98
commit
4884016a3e
@ -1,4 +1,4 @@
|
||||
import { List, Datagrid, TextField, EditButton } from "react-admin";
|
||||
import { List, Datagrid, TextField, EditButton, ReferenceField } from "react-admin";
|
||||
|
||||
function UsersList() {
|
||||
return (
|
||||
@ -8,6 +8,9 @@ function UsersList() {
|
||||
<TextField source="nickname" />
|
||||
<TextField source="email" />
|
||||
<TextField source="avatar" />
|
||||
<ReferenceField label="Role" source="role_id" reference="roles">
|
||||
<TextField source="name" />
|
||||
</ReferenceField>
|
||||
<EditButton />
|
||||
</Datagrid>
|
||||
</List>
|
||||
|
@ -1,6 +1,6 @@
|
||||
PORT=5000
|
||||
DB_NAME=test_db
|
||||
DB_NAME=subd_db
|
||||
DB_USER=postgres
|
||||
DB_PASSWORD=postgres
|
||||
DB_HOST=localhost
|
||||
DB_PORT=5433
|
||||
DB_HOST=192.168.56.101
|
||||
DB_PORT=5432
|
@ -19,13 +19,13 @@ class MessageController {
|
||||
? JSON.parse(req.query.sort.toString())
|
||||
: ["id", "ASC"];
|
||||
|
||||
const Messages = await Message.findAndCountAll({
|
||||
const messages = await Message.findAndCountAll({
|
||||
offset: range[0],
|
||||
limit: range[1] - range[0] + 1,
|
||||
order: [sort] as Order
|
||||
});
|
||||
|
||||
return res.json({ data: Messages.rows, total: Messages.count });
|
||||
return res.json({ data: messages.rows, total: messages.count });
|
||||
} catch (error) {
|
||||
next(ApiErrorHandler.internal((error as Error).message));
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import express from "express";
|
||||
import { sequelize } from './db.js';
|
||||
import cors from "cors";
|
||||
import { sequelize } from "./db.js";
|
||||
import { router } from "./routes/routes.ts";
|
||||
import { ErrorHandlingMiddleware } from "./middleware/error-handling.middleware.ts";
|
||||
|
||||
@ -23,6 +23,6 @@ const start = async () => {
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
start();
|
@ -4,8 +4,6 @@ import {
|
||||
Model,
|
||||
DataType,
|
||||
Length,
|
||||
UpdatedAt,
|
||||
CreatedAt,
|
||||
ForeignKey,
|
||||
BelongsTo
|
||||
} from "sequelize-typescript";
|
||||
@ -13,7 +11,7 @@ import User from "./user.model";
|
||||
import Thread from "./thread.model";
|
||||
|
||||
@Table({
|
||||
timestamps: true,
|
||||
timestamps: false,
|
||||
tableName: "messages",
|
||||
modelName: "Message"
|
||||
})
|
||||
@ -33,12 +31,6 @@ export default class Message extends Model {
|
||||
})
|
||||
declare text: string;
|
||||
|
||||
@CreatedAt
|
||||
declare created_at: Date;
|
||||
|
||||
@UpdatedAt
|
||||
declare updated_at: Date;
|
||||
|
||||
@ForeignKey(() => User)
|
||||
@Column({
|
||||
allowNull: false,
|
||||
|
Loading…
Reference in New Issue
Block a user