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

Dec28 changes completed #17

Open
wants to merge 90 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
1b5c68f
finished the phone numberbug and heart function
amaravindhan Oct 16, 2020
71f83c4
updated with updated frontend
amaravindhan Oct 19, 2020
8202d4a
services done
amaravindhan Oct 19, 2020
5469c04
minor bugs fixed
amaravindhan Oct 19, 2020
9822c1f
roommates test cases done and fixed minor bugs
amaravindhan Oct 21, 2020
73b9912
roommates test cases done and fixed minor bugs
amaravindhan Oct 21, 2020
57dc2c7
fixed minor bugs and testcases for favouirtes
amaravindhan Oct 22, 2020
9f0636c
roommates filters and minor design errors fixed
amaravindhan Oct 23, 2020
856341e
notification model and request for rent
amaravindhan Oct 23, 2020
9b0bc90
services request to rent, notifications and extra fields in user student
amaravindhan Oct 26, 2020
c20514f
finished reply answer part and fixed bug in detail property view page
amaravindhan Oct 28, 2020
4f364c5
changes done as per jira
amaravindhan Oct 29, 2020
dd379db
request tour backend and invite code completed fully
amaravindhan Oct 29, 2020
dce9e99
request tour backend and invite code completed fully
amaravindhan Oct 29, 2020
e95d9ae
updated roommates as per the latest
amaravindhan Oct 30, 2020
0d74914
db migration error fixed
amaravindhan Oct 31, 2020
8bc715f
request tour finished and updated the interest on signup
amaravindhan Nov 2, 2020
3754406
minor bug in user app fixed
amaravindhan Nov 2, 2020
f671206
user profile modified
amaravindhan Nov 3, 2020
d5fc2f8
converted to geodjango and started with the location
amaravindhan Nov 4, 2020
601c74e
changes done for amenities mentioned in jira
amaravindhan Nov 5, 2020
fe48582
now the app can get the lat and log and store in the db
amaravindhan Nov 5, 2020
5c9bc94
finished nearby fetching and adding in db
amaravindhan Nov 6, 2020
50f6b40
roommates frontend update
amaravindhan Nov 7, 2020
2ada543
complete nearby location and filters done
amaravindhan Nov 9, 2020
606298a
complete nearby location and filters done
amaravindhan Nov 9, 2020
166dc03
services testcase finished
amaravindhan Nov 11, 2020
ad5c406
services testcase finished
amaravindhan Nov 11, 2020
8c6f837
services testcase finished
amaravindhan Nov 11, 2020
bb9c3f0
finished integrating the new landing page
amaravindhan Nov 13, 2020
56203de
landing page integrated fully and friday meeting changes done
amaravindhan Nov 15, 2020
239f50f
leased and vaccant funtionality added
amaravindhan Nov 16, 2020
55fef4a
solved testcases
amaravindhan Nov 17, 2020
44cd1b9
chat has been integrated with updated geo location code
amaravindhan Nov 17, 2020
0277be7
chat has been integrated with updated geo location code
amaravindhan Nov 17, 2020
d74f1b3
roommates post update done
amaravindhan Nov 17, 2020
b6ab4ac
student and landlord can chat and notfication for chat message added …
amaravindhan Nov 18, 2020
b9b1744
slack changes finished except myrequest page
amaravindhan Nov 19, 2020
e4fccd9
request page finished
amaravindhan Nov 19, 2020
00bea29
bug fixed
amaravindhan Nov 19, 2020
a668262
minor changes and chat file upload completed
amaravindhan Nov 20, 2020
485fc87
google map icon and chat profile picture
amaravindhan Nov 20, 2020
537320b
s3 upload finished
amaravindhan Nov 20, 2020
b8ed0a1
chat icon fixed
amaravindhan Nov 20, 2020
cc7c6e0
frontend fixing
amaravindhan Nov 20, 2020
e471916
file upload frontend fixed
amaravindhan Nov 21, 2020
de9f05f
roommates bug fixed
amaravindhan Nov 21, 2020
6fcec40
distance filter bug solved
amaravindhan Nov 23, 2020
f40fba0
django defender added and started with otp
amaravindhan Nov 28, 2020
eddefef
signup flow and forgot pass flow verfication completed
amaravindhan Nov 29, 2020
67fec7a
finished the phone verification and added the recaptcha
amaravindhan Nov 30, 2020
3381100
minor changes on contact page and chrome bug solved
amaravindhan Dec 1, 2020
24fa7e7
minor changes on contact page and chrome bug solved
amaravindhan Dec 1, 2020
5a82a4f
requirements updated
amaravindhan Dec 1, 2020
3fd9c5a
discussion page completed
amaravindhan Dec 2, 2020
03a6586
discussion_completed
Dec 6, 2020
ad08e54
property nearby changes done
amaravindhan Dec 7, 2020
90e5890
group bug fixed and attachement sending redesigned
amaravindhan Dec 8, 2020
c11f2ed
pagination resolved
amaravindhan Dec 8, 2020
c230f1b
resources app added
amaravindhan Dec 8, 2020
43f1b28
resources agreements added
amaravindhan Dec 8, 2020
518adbc
rename favorites
amaravindhan Dec 9, 2020
6053777
recaptcha issue and utilities fixed
amaravindhan Dec 10, 2020
f10444d
frontend changes - svg replaced
Dec 11, 2020
6afd7ee
vimal frontend changes dec13
Dec 14, 2020
9e1cad3
updated frontend
Dec 15, 2020
5b1a735
small changes
amaravindhan Dec 15, 2020
0a831b9
merge changes
amaravindhan Dec 15, 2020
7571252
sigup resolved and profile picture is not mandatory
amaravindhan Dec 15, 2020
3389988
dec16 fe changes commiting
Dec 16, 2020
4551be8
completed all changes in backend
amaravindhan Dec 16, 2020
ac076d4
completed all changes in backend
amaravindhan Dec 16, 2020
e2d89a9
property images and video changes done
amaravindhan Dec 17, 2020
9e3e96d
student signup errors handled frontend
amaravindhan Dec 18, 2020
dc7a5e1
student signup errors handled frontend
amaravindhan Dec 18, 2020
2f0f422
distance changes done
amaravindhan Dec 18, 2020
79d4ad1
mobile app view changed
Dec 20, 2020
dfe3b48
test
amaravindhan Dec 22, 2020
d450bf5
removed landlord profile pic, amenities not important, property pic m…
amaravindhan Dec 22, 2020
857835a
removed landlord profile pic, amenities not important, property pic m…
amaravindhan Dec 22, 2020
37b0c35
header changes
Dec 23, 2020
e5ed0d1
removed picture descriptions in landlord, added requests tab for land…
Dec 24, 2020
044e7ad
dec27 test commit
Dec 27, 2020
8ebd469
completed all changes dec28
Dec 28, 2020
8fc98dd
completed all changes dec28
Dec 28, 2020
2ba740c
test server commit
Dec 28, 2020
fa793e8
testserver
Dec 28, 2020
e843ade
testserver remove
Dec 28, 2020
999e527
final commit from test server
Dec 28, 2020
593493a
completed all changes before voice
Dec 28, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file added .DS_Store
Binary file not shown.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
media/
**/__pycache__
**/migrations
**/migrations
completeApp.log
config.py
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/realestatemvp.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added chat/.DS_Store
Binary file not shown.
File renamed without changes.
8 changes: 8 additions & 0 deletions chat/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.contrib import admin

from .models import Message, MessageRequest, Room, Friend

admin.site.register(Message)
admin.site.register(MessageRequest)
admin.site.register(Room)
admin.site.register(Friend)
5 changes: 5 additions & 0 deletions chat/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class ChatappConfig(AppConfig):
name = 'chat'
139 changes: 139 additions & 0 deletions chat/consumers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# chat/consumers.py
import json
from asgiref.sync import async_to_sync
from channels.generic.websocket import WebsocketConsumer
from .models import Message, Room
from notifications.models import Notification
from django.contrib.auth.models import User
from django.shortcuts import get_object_or_404
from .views import get_user_contact

class ChatConsumer(WebsocketConsumer):

def message_to_json(self, message):
if message.pdf:
return {
'author': message.author.username,
'content': message.content,
'url': message.pdf.url,
'timestamp': str(message.timestamp),
}
else:
return {
'author': message.author.username,
'content': message.content,
'timestamp': str(message.timestamp),
}


def messages_to_json(self, messages):
"""Function that serialize messages object to json"""
result = []
for message in messages:
result.append(self.message_to_json(message))
return result


def fetch_messages(self, data):
messages = Message.objects.filter(room__id = data['roomname']).order_by('timestamp')
content = {
'message': self.messages_to_json(messages),
'command': 'fetch_messages'
}

self.send_message(content)


def new_message(self, data):
author = data['from']
room_id = data['roomname']
room_id_valid = get_object_or_404(Room, id=room_id)

if len(data['message']) != 0:
message = Message.objects.create(
author = get_object_or_404(User, username=author),
content = data['message'],
room = room_id_valid
)
authorMember = get_object_or_404(User, username=author)
for member in room_id_valid.members.exclude(username=authorMember.username):
if Notification.objects.filter(fromUser=authorMember, toUser=member, notificationType='newMessage', viewed=False, identifier=room_id_valid.pk).exists():
notfi = Notification.objects.filter(fromUser=authorMember, toUser=member, notificationType='newMessage', viewed=False, identifier=room_id_valid.pk).first()
count = int(notfi.content)
notfi.content = count+1
notfi.save()
else:
notfi = Notification.objects.create(
fromUser=authorMember,
toUser=member,
notificationType='newMessage',
content=1,
identifier=room_id_valid.pk,
)
content = {
'command': 'new_message',
'message': self.message_to_json(message)
}
else:
message = get_object_or_404(Message, pk=data['message_id'])
content = {
'command': 'new_message',
'message': self.message_to_json(message)
}
return self.send_chat_messages(content)

command = {
'fetch_messages': fetch_messages,
'new_message': new_message
}

def connect(self):
self.room_name = self.scope['url_route']['kwargs']['room_name']
self.room_group_name = 'chat_%s' % self.room_name

# Join room group
async_to_sync(self.channel_layer.group_add)(
self.room_group_name,
self.channel_name
)

self.accept()

def disconnect(self, close_code):
# Leave room group
async_to_sync(self.channel_layer.group_discard)(
self.room_group_name,
self.channel_name
)

# Receive message from WebSocket
def receive(self, text_data):
data = json.loads(text_data)
# print(data, "!!!!!!!!!!!!!!!!!!!!!!!!!")
self.command[data["command"]](self, data)

def send_chat_messages(self, message):
# Send message to room group
try:
async_to_sync(self.channel_layer.group_send)(
self.room_group_name,
{
'type': 'chat_message',
'message': message
}
)
except Exception as e:
print(e)

def send_message(self, message):
self.send(text_data=json.dumps(message))


# Receive message from room group
def chat_message(self, event):
message = event['message']

# Send message to WebSocket
self.send(text_data=json.dumps({
'message': message
}))
61 changes: 61 additions & 0 deletions chat/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
from django.db import models
from django.contrib.auth import get_user_model
from users.models import UserStudent
from django.dispatch import receiver

import uuid, os

User = get_user_model()


def unique_file_path_generator_chat(instance, filename):
"""Generate file path for chat attachments"""
ext = filename.split('.')[-1]
filename = f'{uuid.uuid4()}.{ext}'
filepath = ("uploads/chat/{roomid}/").format(
roomid=instance.room.pk,
)
return os.path.join(filepath, filename)


class Room(models.Model):

name = models.CharField(max_length = 50, blank=True, null=True)
members = models.ManyToManyField(User, related_name='members')
room_type = models.BooleanField(default=False, blank=True, null=True)

def __str__(self):
return '{}'.format(self.pk)


class Message(models.Model):

author = models.ForeignKey(User, related_name="author_message", on_delete=models.CASCADE)
content = models.TextField()
timestamp = models.DateTimeField(auto_now_add=True)
room = models.ForeignKey(Room, related_name="room", on_delete=models.CASCADE, null=True)
pdf = models.FileField(upload_to=unique_file_path_generator_chat, null=True, blank=True)
# pdf = models.TextField(blank=True, null=True)

def __str__(self):
return self.author.username


class MessageRequest(models.Model):

logged_in_user = models.ForeignKey(UserStudent, related_name = 'message_user', on_delete=models.CASCADE)
request_sender = models.ForeignKey(UserStudent, related_name = 'message_request_sender', on_delete=models.CASCADE)
status = models.BooleanField(default=False)

def __str__(self):
return self.request_sender.user.user.username


class Friend(models.Model):
student = models.OneToOneField(UserStudent, on_delete=models.CASCADE)
friends = models.ManyToManyField(UserStudent, related_name='friendsList')
# from_friend = models.ForeignKey(UserStudent, related_name='from_friends', on_delete=models.CASCADE, blank=True, null=True)
# to_friend = models.ForeignKey(UserStudent, related_name='to_friends', on_delete=models.CASCADE, blank=True, null=True)

def __str__(self):
return '{}'.format(self.pk)
9 changes: 9 additions & 0 deletions chat/routing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# chat/routing.py
from django.urls import re_path

from . import consumers

websocket_urlpatterns = [
re_path(r'ws/chat/(?P<room_name>\w+)/$', consumers.ChatConsumer),
re_path(r'ws/chat/(?P<room_name>\w+)/$', consumers.ChatConsumer),
]
Loading