Skip to content

Commit

Permalink
Apply formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
gf-rog authored and github-actions[bot] committed Mar 22, 2024
1 parent b76efae commit 4918c6d
Show file tree
Hide file tree
Showing 16 changed files with 2,310 additions and 1,937 deletions.
18 changes: 9 additions & 9 deletions backend/src/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ export async function importInitialData() {
const isEmpty = await isDatabaseEmpty();

const testUser = await registerUser({
first_name: "John",
last_name: "Smith",
country: "PL",
profile_picture: "",
mail: "[email protected]",
password: "password",
})
first_name: "John",
last_name: "Smith",
country: "PL",
profile_picture: "",
mail: "[email protected]",
password: "password",
});

if ("errors" in testUser) {
console.log("Couldn't register test user: ", testUser.errors)
console.log("Couldn't register test user: ", testUser.errors);
} else {
console.log("Test user created: ", testUser)
console.log("Test user created: ", testUser);
}

if (!isEmpty) {
Expand Down
4 changes: 2 additions & 2 deletions backend/src/kcAdminClient.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import KeycloakAdminClient from "@keycloak/keycloak-admin-client";

export const keycloakUri = process.env.KEYCLOAK_URI || "http://localhost:3000"
export const keycloakIssuer = process.env.KEYCLOAK_ISSUER || keycloakUri
export const keycloakUri = process.env.KEYCLOAK_URI || "http://localhost:3000";
export const keycloakIssuer = process.env.KEYCLOAK_ISSUER || keycloakUri;

const kcAdminClient = new KeycloakAdminClient({
baseUrl: keycloakUri,
Expand Down
2 changes: 1 addition & 1 deletion backend/src/misc/Either.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export type Either<T, U> = Exclude<T, U> | Exclude<U, T>
export type Either<T, U> = Exclude<T, U> | Exclude<U, T>;
2 changes: 1 addition & 1 deletion backend/src/misc/removeKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export default function removeKeys<
T extends Record<PropertyKey, any>,
U extends (keyof T)[],
>(obj: T, keys: U): Omit<T, (typeof keys)[number]> {
const objCopy = {...obj};
const objCopy = { ...obj };

for (const key of keys) {
if (obj.hasOwnProperty(key)) {
Expand Down
6 changes: 3 additions & 3 deletions backend/src/models/DbUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import NativeUser from "./NativeUser.js";
import User from "./User.js";

export interface DbUserBase extends User {
name_embedding: number[]
name_embedding: number[];
}

type DbUser = DbUserBase & Either<NativeUser, ExternalUser>
type DbUser = DbUserBase & Either<NativeUser, ExternalUser>;

export default DbUser
export default DbUser;
9 changes: 7 additions & 2 deletions backend/src/routes/usersRoute.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { Router, Request, Response } from "express";
import bcrypt from "bcrypt";
import driver from "../driver/driver.js";
import { JWTRequest, authenticateToken, getToken, checkToken } from "../misc/jwt.js";
import {
AuthOkErrorResponse,
JWTRequest,
authenticateToken,
getToken,
checkToken,
} from "../misc/jwt.js";
import {
AuthOkErrorResponse,
FriendsErrorResponse,
OkErrorResponse,
UserErrorResponse,
Expand Down
4 changes: 3 additions & 1 deletion backend/src/types/userResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import {
export type UsersErrorResponse = CustomResponse<UsersResponse | ErrorResponse>;
export type UserErrorResponse = CustomResponse<UserResponse | ErrorResponse>;
export type OkErrorResponse = CustomResponse<OkResponse | ErrorResponse>;
export type AuthOkErrorResponse = CustomResponse<AuthResponse | OkResponse | ErrorResponse>
export type AuthOkErrorResponse = CustomResponse<
AuthResponse | OkResponse | ErrorResponse
>;
export type FriendsErrorResponse = CustomResponse<
FriendsResponse | ErrorResponse
>;
Expand Down
2 changes: 1 addition & 1 deletion backend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/* Modules */
"module": "node16" /* Specify what module code is generated. */,
// "rootDir": "./", /* Specify the root folder within your source files. */
"moduleResolution": "node16", /* Specify how TypeScript looks up a file from a given module specifier. */
"moduleResolution": "node16" /* Specify how TypeScript looks up a file from a given module specifier. */,
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/EditPhoto.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function EditPhoto(props: EditDetails) {
};

const editPhoto = async (): Promise<void> => {
const changes = {profile_picture: profilePictureBase64}
const changes = { profile_picture: profilePictureBase64 };

updateUser(changes).then((updated) => {
if (updated) console.log("Updated");
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/helpers/KeycloakUserProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function KeycloakUserProvider({ children }: { children: React.ReactNode }) {
const [socket, setSocket] = useState<Socket | null>(null);

const keycloakRef = useRef<Keycloak | null>(null);
const [token, setToken] = useState<string | undefined>()
const [token, setToken] = useState<string | undefined>();

const updateUserData = async () => {
const keycloak = keycloakRef.current!;
Expand Down Expand Up @@ -51,8 +51,8 @@ function KeycloakUserProvider({ children }: { children: React.ReactNode }) {
});
keycloak.onAuthSuccess = () => {
updateUserData();
setToken(keycloak.token)
}
setToken(keycloak.token);
};

keycloakRef.current = keycloak;
});
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/helpers/MeetingProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function MeetingProvider({ children }: { children: React.ReactNode }) {
meeting,
createMeeting,
joinMeeting,
leaveMeeting
leaveMeeting,
}}
>
{children}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/helpers/Protected.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function Protected({ loadingElement, children }: ProtectedProps) {
if (userState.status == "anonymous") {
redirectToLogin();
}
}, [userState])
}, [userState]);

if (userState.status != "logged_in") {
return loadingElement;
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/models/UserState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import User from "./User";

export type AnonymousUserState = {
status: "anonymous";
}
};

export type LoadingUserState = {
status: "loading";
}
};

export type LoggedInUserState = {
status: "logged_in";
user: User;
}
};

type UserState = LoadingUserState | AnonymousUserState | LoggedInUserState;

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/FriendsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function FriendsPage() {
const navigate = useNavigate();
const dispatch = useDispatch();
const { user } = useProtected();
const { meeting, createMeeting, joinMeeting} = useMeeting();
const { meeting, createMeeting, joinMeeting } = useMeeting();

const [friends, setFriends] = useState([]);
const [friendsRequests, setFriendsRequests] = useState([]);
Expand Down
Loading

0 comments on commit 4918c6d

Please sign in to comment.