Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove nick from user model #99

Merged
merged 4 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions backend/src/data/users.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const userData = [
{
"nick": "boejiden",
"password": "sleepyjoe",
"first_name": "Joe",
"last_name": "Biden",
Expand All @@ -12,7 +11,6 @@ const userData = [
"chats": [],
},
{
"nick": "adamos",
"password": "mysz888",
"first_name": "Adam",
"last_name": "Małysz",
Expand All @@ -24,7 +22,6 @@ const userData = [
"chats": [],
},
{
"nick": "budyn1989",
"password": "kaczorlove",
"first_name": "Andrew",
"last_name": "Duda",
Expand All @@ -36,7 +33,6 @@ const userData = [
"chats": [],
},
{
"nick": "mentosdestroyer4",
"password": "mmmcow",
"first_name": "Kuba",
"last_name": "Nowak",
Expand All @@ -48,7 +44,6 @@ const userData = [
"chats": [],
},
{
"nick": "elonmusk",
"password": "DogeToTheMOON",
"first_name": "Elon",
"last_name": "Musk",
Expand All @@ -60,7 +55,6 @@ const userData = [
"chats": [],
},
{
"nick": "nowayno3",
"password": "432525n",
"first_name": "Olivia",
"last_name": "Smith",
Expand All @@ -71,7 +65,6 @@ const userData = [
"chats": [],
},
{
"nick": "rEptiliAn69",
"password": "metaverse4ever",
"first_name": "Mark",
"last_name": "Zuckerberg",
Expand Down
1 change: 0 additions & 1 deletion backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const corsOptions = {
app.use(cors(corsOptions));

app.use((req, res, next) => {
res.header("Access-Control-Allow-Origin", "http://127.0.0.1:5173");
res.header("Access-Control-Allow-Methods", "GET, PUT, POST, DELETE");
res.header("Access-Control-Allow-Headers", "Content-Type");
next();
Expand Down
1 change: 0 additions & 1 deletion backend/src/models/User.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Chat from "./Chat";

export default interface User {
nick: string;
password: string;
first_name: string;
last_name: string;
Expand Down
6 changes: 2 additions & 4 deletions backend/test/userEndpoints.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ let userId: number;

test("Create user", async () => {
const userData = {
nick: "Tommy",
password: "12345",
first_name: "Tom",
last_name: "Hanks",
Expand Down Expand Up @@ -40,7 +39,6 @@ test("Fetch user by ID", async () => {

test("Update user by ID", async () => {
const userUpdateData = {
nick: "Tommy",
password: "54321",
first_name: "Tommy",
last_name: "Hanks",
Expand Down Expand Up @@ -82,7 +80,7 @@ test("Get user's friends", async () => {
expect(usersStatus).toBe("ok");

const zuck = usersResponseData.users.find(
(user: any) => user.nick == "rEptiliAn69",
(user: any) => user.mail == "[email protected]",
);
const zuckId = zuck.id;

Expand Down Expand Up @@ -119,7 +117,7 @@ test("Search users", async () => {
expect(usersStatus).toBe("ok");

const zuck = usersResponseData.users.find(
([user, _score]: any) => user.nick == "rEptiliAn69",
([user, _score]: any) => user.mail == "[email protected]",
);

expect(zuck).toBeDefined();
Expand Down
3 changes: 2 additions & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ RUN npm i && npm run build

FROM nginx:1.25.3-alpine
COPY --from=base /home/node/app/dist /usr/share/nginx/html
EXPOSE 80
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
10 changes: 10 additions & 0 deletions frontend/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
server {
listen 80;
listen [::]:80;
server_name localhost;

location / {
root /usr/share/nginx/html;
try_files $uri /index.html;
}
}
4 changes: 2 additions & 2 deletions frontend/src/components/LoginBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ function LoginBox() {
className=" medium:w-[25vw] flex flex-col gap-2 bg-my-dark p-10 px-20 rounded-xl"
id="login-box"
>
<div>Login:</div>
<div>E-mail:</div>
<input
type="text"
className="text-my-dark form-input"
placeholder="Login"
placeholder="E-mail"
onChange={(e) => setLogin(e.target.value)}
/>

Expand Down
8 changes: 0 additions & 8 deletions frontend/src/components/RegisterBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,6 @@ function RegisterBox() {
placeholder="E-mail"
/>

<div>Login:</div>
<input
type="text"
className="text-my-dark form-input"
onChange={updateFormUser("nick")}
placeholder="Login"
/>

<div>Password:</div>
<input
type="password"
Expand Down
1 change: 0 additions & 1 deletion frontend/src/models/user.model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
interface User {
id: number;
nick: string;
password: string;
first_name: string;
last_name: string;
Expand Down