Skip to content

Commit

Permalink
merged alls
Browse files Browse the repository at this point in the history
  • Loading branch information
Yigithan Karabulut committed Jul 21, 2024
1 parent 8cd0eaa commit 31dab14
Show file tree
Hide file tree
Showing 38 changed files with 70 additions and 714 deletions.
Binary file modified .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ RABBITMQ_DEFAULT_PASS=guest
RABBITMQ_DEFAULT_VHOST=/
RABBITMQ_QUEUE_NAME=mail-service

SERVER_NAME="127.0.0.1"
FRONTEND_URL="https://127.0.0.1:443"
NGINX_SSL_CN="127.0.0.1:443"

Expand Down
3 changes: 1 addition & 2 deletions authservice/src/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def generate_access_token(user_id, jti):
payload = {
'user_id': user_id,
'jti': jti, # unique identifier for the token pair.
'exp': datetime.now(tz=timezone.utc) + timedelta(seconds=5),
'exp': datetime.now(tz=timezone.utc) + timedelta(minutes=45),
'iat': datetime.now(tz=timezone.utc)
}
access_token = jwt.encode(payload, settings.SECRET_KEY, algorithm='HS256')
Expand Down Expand Up @@ -171,7 +171,6 @@ def create_user(self, oauth_token):
'email': user_info.get('email'),
'first_name': user_info.get('first_name'),
'last_name': user_info.get('last_name'),
'phone': user_info.get('phone'),
'provider': 'intra',
'provider_user_id': user_info.get('id'),
'access_token': oauth_token.get('access_token'),
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ services:
dockerfile: Dockerfile
args:
- NGINX_SSL_CN=${NGINX_SSL_CN}
environment:
- SERVER_NAME=${SERVER_NAME}
depends_on:
- apigateway
- bucketservice
Expand Down
12 changes: 6 additions & 6 deletions friendservice/srcs/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ def insert(self, sender_id, receiver_id):
except:
return False
return False

def delete(self, sender_id, receiver_id):
try:
fr = Friends.objects.filter(sender_id=sender_id, receiver_id=receiver_id, deleted_at=None).first()
if fr is None:
return False
fr.soft_delete()
fr.delete()
except:
return False
return True
Expand All @@ -76,7 +76,7 @@ def reject(self, sender_id, receiver_id):
fr = Friends.objects.filter(sender_id=sender_id, receiver_id=receiver_id, deleted_at=None).first()
if fr is None:
return False
fr.soft_delete()
fr.delete()
except:
return False
return True
Expand All @@ -85,11 +85,11 @@ def get(self, sender_id, receiver_id):
try:
fr = Friends.objects.filter(sender_id=sender_id, receiver_id=receiver_id).first()
if not fr:
return False
return False
except:
return False
return True

def get_all_friends(self, user_id):
try:
senders = Friends.objects.filter(sender_id=user_id, state=1, deleted_at=None).values('receiver_id')
Expand Down Expand Up @@ -136,4 +136,4 @@ def get_state_by_id(self, owner_id, friend_id):
return fr.state
if fr2:
return fr2.state
return 5
return 5
2 changes: 1 addition & 1 deletion frontend/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ http {
listen 443 ssl;
listen [::]:443 ssl;

server_name localhost 127.0.0.1;
server_name $SERVER_NAME;

ssl_certificate /etc/ssl/certs/nginx.crt;
ssl_certificate_key /etc/ssl/private/nginx.key;
Expand Down
5 changes: 0 additions & 5 deletions frontend/src/routes/edit/Edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,18 @@ export async function fetchEdit() {
document.querySelector("input[name='first-name']").value = user.first_name;
document.querySelector("input[name='user-name']").value = user.username;
document.querySelector("input[name='last-name']").value = user.last_name;
document.querySelector("input[name='phone']").value = user.phone;
document.querySelector("input[name='email']").value = user.email;

document.getElementById("save-button").addEventListener("click", async () => {
const userName = document.querySelector("input[name='user-name']").value;
const firstName = document.querySelector("input[name='first-name']").value;
const lastName = document.querySelector("input[name='last-name']").value;
const phone = document.querySelector("input[name='phone']").value;
const email = document.querySelector("input[name='email']").value;
const fields_warning = document.getElementById('fields-warning');

let body = {
first_name: firstName,
last_name: lastName,
phone: phone,
username: userName,
email: email,
};
Expand Down Expand Up @@ -93,8 +90,6 @@ export async function fetchEdit() {
insertIntoElement('fields-warning', "Error: " + err.error);
} else if (err.username) {
insertIntoElement('fields-warning', "Username error: " + err.username);
} else if (err.phone) {
insertIntoElement('fields-warning', "Phone error: " + err.phone);
} else if (err.first_name) {
insertIntoElement('fields-warning', "First name error: " + err.first_name);
} else if (err.last_name) {
Expand Down
8 changes: 0 additions & 8 deletions frontend/src/routes/edit/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,6 @@ <h6 class="mb-0">Last Name</h6>
<input type="text" name="last-name" class="form-control" value="lastname">
</div>
</div>
<div class="row mb-3">
<div class="col-sm-3">
<h6 class="mb-0">Phone</h6>
</div>
<div class="col-sm-9 text-secondary">
<input type="text" name="phone" class="form-control" value="(239) 816-9029">
</div>
</div>
<div class="row mb-3">
<div class="col-sm-3">
<h6 class="mb-0">Email</h6>
Expand Down
6 changes: 0 additions & 6 deletions frontend/src/routes/friends/Friends.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,6 @@ export async function fetchFriends() {
<p class="m-0"><a data-nav href="#" class="employer-name">${user_res.first_name} ${user_res.last_name}</a></p>
</div>
</td>
<td>
<div class="widget-26-job-info">
<p class="type m-0">Email: ${user_res.email}</p>
<p class="text-muted m-0">Phone: <span class="location">${user_res.phone}</span></p>
</div>
</td>
<td>
<div class="widget-26-job-salary">ID: ${user_res.id}</div>
</td>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/routes/otherprofile/Otherprofile.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export async function fetchOtherprofile() {
document.getElementById("user-name").textContent = user.username;
document.getElementById("profile-first-name").textContent = user.first_name;
document.getElementById("profile-last-name").textContent = user.last_name;
document.getElementById("phone").textContent = user.phone;
document.getElementById("profile-pp-email").textContent = user.email;
document.getElementById("profile-status").textContent = user_status ? "Online" : "Offline";

// Fetch match history
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/routes/otherprofile/otherprofile.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,13 @@ <h6 class="mb-0">Last Name</h6>
<hr>
<div class="row">
<div class="col-sm-3">
<h6 class="mb-0">Phone</h6>
<h6 class="mb-0">Email</h6>
</div>
<div class="col-sm-9 text-secondary" id="phone">
2398169029
<div class="col-sm-9 text-secondary" id="profile-pp-email">
[email protected]
</div>
</div>
<hr>
</div>
</div>
<div class="row gutters-sm">
Expand Down
1 change: 0 additions & 1 deletion frontend/src/routes/profile/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export async function fetchProfile() {
document.getElementById("user-name").textContent = user.username;
document.getElementById("profile-first-name").textContent = user.first_name;
document.getElementById("profile-last-name").textContent = user.last_name;
document.getElementById("phone").textContent = user.phone;
document.getElementById("email").textContent = user.email;
if (localStorage.getItem("status")) {
document.getElementById("profile-status").textContent = localStorage.getItem("status");
Expand Down
9 changes: 0 additions & 9 deletions frontend/src/routes/profile/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,6 @@ <h6 class="mb-0">Last Name</h6>
</div>
</div>
<hr>
<div class="row">
<div class="col-sm-3">
<h6 class="mb-0">Phone</h6>
</div>
<div class="col-sm-9 text-secondary" id="phone">
2398169029
</div>
</div>
<hr>
<div class="row">
<div class="col-sm-3">
<h6 class="mb-0">Email</h6>
Expand Down
6 changes: 1 addition & 5 deletions frontend/src/routes/register/Register.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ form.addEventListener("submit", (e) => {
const email = document.getElementById("email").value;
const firstname = document.getElementById("first_name").value;
const lastname = document.getElementById("last_name").value;
const phone = document.getElementById("phone").value;
const fields_warning = document.getElementById('fields-warning');
const fields_success = document.getElementById('fields-success');


if (!username || !email || !password || !firstname || !lastname || !phone)
if (!username || !email || !password || !firstname || !lastname)
{
insertIntoElement('fields-warning', "fields shouldn't be empty");
return;
Expand All @@ -39,7 +38,6 @@ form.addEventListener("submit", (e) => {
password: password,
first_name: firstname,
last_name: lastname,
phone: phone,
}),
})
.then(res => {
Expand All @@ -62,8 +60,6 @@ form.addEventListener("submit", (e) => {
insertIntoElement('fields-warning', "Username error: " + err.username[0]);
} else if (err.email) {
insertIntoElement('fields-warning', "Email error: " + err.email[0]);
} else if (err.phone) {
insertIntoElement('fields-warning', "Phone error: " + err.phone[0]);
} else if (err.password) {
insertIntoElement('fields-warning', "Password error: " + err.password[0]);
} else if (err.first_name) {
Expand Down
6 changes: 0 additions & 6 deletions frontend/src/routes/register/register.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ <h2 class="text-center mb-3">Register</h2>
<input type="text" class="form-control" id="username" name="username">
</div>

<div class="mb-3">
<label for="phone" class="form-label">Phone</label>
<input type="text" class="form-control" id="phone" name="phone">
<div id="phoneHelp" class="form-text">Enter a valid phone number</div>
</div>

<div class="mb-3 d-flex justify-content-center">
<button type="submit" class="btn btn-primary text-white">Register</button>
<p class="text-danger mt-2 visible" id="fields-warning"></p>
Expand Down
6 changes: 0 additions & 6 deletions frontend/src/routes/users/Users.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,6 @@ export async function fetchUsers() {
<p class="m-0"><a data-nav href="#" class="employer-name">${user.first_name} ${user.last_name}</a></p>
</div>
</td>
<td>
<div class="widget-26-job-info">
<p class="type m-0">Email: ${user.email}</p>
<p class="text-muted m-0">Phone: <span class="location">${user.phone}</span></p>
</div>
</td>
<td>
<div class="widget-26-job-category ${user_status ? 'bg-soft-success' : 'bg-soft-danger'}">
<i class="indicator ${user_status ? 'bg-success' : 'bg-danger'}"></i>
Expand Down
Loading

0 comments on commit 31dab14

Please sign in to comment.