diff --git a/client/src/components/User/List.tsx b/client/src/components/User/List.tsx index 2f23bf9..2933d11 100644 --- a/client/src/components/User/List.tsx +++ b/client/src/components/User/List.tsx @@ -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() { + + + diff --git a/server/.env b/server/.env index 108bc0e..1155261 100644 --- a/server/.env +++ b/server/.env @@ -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 \ No newline at end of file +DB_HOST=192.168.56.101 +DB_PORT=5432 \ No newline at end of file diff --git a/server/controllers/message/message.controller.ts b/server/controllers/message/message.controller.ts index 9705491..1a66cb2 100644 --- a/server/controllers/message/message.controller.ts +++ b/server/controllers/message/message.controller.ts @@ -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)); } diff --git a/server/index.ts b/server/index.ts index 6ddc218..28bc6ae 100644 --- a/server/index.ts +++ b/server/index.ts @@ -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(); \ No newline at end of file +start(); diff --git a/server/models/message.model.ts b/server/models/message.model.ts index 3713155..736e0c4 100644 --- a/server/models/message.model.ts +++ b/server/models/message.model.ts @@ -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,