поменял конфиг, мелкие правки

This commit is contained in:
dyakonovr 2024-04-03 19:59:30 +04:00
parent 89f64aae98
commit 4884016a3e
5 changed files with 13 additions and 18 deletions

View File

@ -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>

View File

@ -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

View File

@ -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));
}

View File

@ -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();

View File

@ -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,