Skip to content

Commit

Permalink
Merge pull request #99 from Karol-2/login-register
Browse files Browse the repository at this point in the history
Remove nick from user model
  • Loading branch information
Piterson25 authored Nov 24, 2023
2 parents 8ac2193 + 8cab9cf commit 10f8ed9
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 23 deletions.
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/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
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

0 comments on commit 10f8ed9

Please sign in to comment.