-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from HE-Arc/dev
Dev
- Loading branch information
Showing
55 changed files
with
1,649 additions
and
490 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -167,3 +167,4 @@ frontend/package-lock.lock | |
.vscode/ | ||
|
||
backend/pictures | ||
backend/schema.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,39 @@ | ||
![App logo](https://github.com/HE-Arc/kodecupid/blob/main/identity/logo1024.png) | ||
```> [SUCCESS] New connection established !``` | ||
|
||
KodeCupid is a dating app for developers and computer scientists. It helps users to find their significant other based on computer-related filters, such as prefered programming languages. | ||
*KodeCupid Dating App* | ||
===================== | ||
|
||
Welcome to KodeCupid, a dating app for developers and computer scientists. Our goal is to help you find your significant other based on computer-related filters, such as preferred programming languages. | ||
|
||
**Requirements to Begin Development** | ||
------------------------------------ | ||
|
||
* Docker | ||
* Docker Compose | ||
|
||
**Installation and Run** | ||
------------------------- | ||
|
||
Clone the repository: | ||
```bash | ||
git clone [email protected]:HE-Arc/kodecupid.git | ||
cd kodecupid | ||
``` | ||
|
||
Disable auto-crlf on Windows (some scripts will be executed on Linux): | ||
```bash | ||
git config --local core.autocrlf false | ||
``` | ||
|
||
Copy the .env.example file and update it with your environment variables. | ||
Launch the Docker container: | ||
```bash | ||
docker compose up | ||
``` | ||
|
||
# Accessing the App | ||
|
||
The KodeCupid app can be accessed on: | ||
* localhost:80 (web interface) | ||
* localhost:8000 (API) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[[source]] | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
[packages] | ||
|
||
[dev-packages] | ||
|
||
[requires] | ||
python_version = "3.11" |
22 changes: 22 additions & 0 deletions
22
backend/kodecupidapp/migrations/0004_remove_tag_users_user_tags.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 5.0.4 on 2024-04-03 22:20 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('kodecupidapp', '0003_like_unique_like'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='tag', | ||
name='users', | ||
), | ||
migrations.AddField( | ||
model_name='user', | ||
name='tags', | ||
field=models.ManyToManyField(related_name='tags', to='kodecupidapp.tag'), | ||
), | ||
] |
24 changes: 24 additions & 0 deletions
24
backend/kodecupidapp/migrations/0005_user_sex_alter_user_looking_for.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Generated by Django 5.0.4 on 2024-04-28 19:04 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('kodecupidapp', '0004_remove_tag_users_user_tags'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='user', | ||
name='sex', | ||
field=models.BooleanField(default=True), | ||
preserve_default=False, | ||
), | ||
migrations.AlterField( | ||
model_name='user', | ||
name='looking_for', | ||
field=models.BooleanField(), | ||
), | ||
] |
17 changes: 17 additions & 0 deletions
17
backend/kodecupidapp/migrations/0006_remove_user_looking_for.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 5.0.4 on 2024-04-28 20:14 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('kodecupidapp', '0005_user_sex_alter_user_looking_for'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='user', | ||
name='looking_for', | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 5.0.4 on 2024-04-28 20:14 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('kodecupidapp', '0006_remove_user_looking_for'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='user', | ||
name='looking_for', | ||
field=models.BooleanField(default=False), | ||
preserve_default=False, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Generated by Django 5.0.4 on 2024-04-26 09:16 | ||
|
||
import django.db.models.deletion | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('kodecupidapp', '0007_user_looking_for'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Message', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('sent', models.DateTimeField(auto_now_add=True)), | ||
('content', models.TextField()), | ||
('source_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='message_source_user', to=settings.AUTH_USER_MODEL)), | ||
('target_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='message_target_user', to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 5.0.4 on 2024-05-01 10:15 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('kodecupidapp', '0008_message'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='user', | ||
name='pfp', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='pfp', to='kodecupidapp.picture'), | ||
), | ||
] |
23 changes: 23 additions & 0 deletions
23
backend/kodecupidapp/migrations/0010_alter_message_content_alter_user_bio.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 5.0.4 on 2024-05-01 15:31 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('kodecupidapp', '0009_alter_user_pfp'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='message', | ||
name='content', | ||
field=models.TextField(max_length=255), | ||
), | ||
migrations.AlterField( | ||
model_name='user', | ||
name='bio', | ||
field=models.CharField(max_length=255), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from .tag import Tag | ||
from .user import User | ||
from .picture import Picture | ||
from .like import Like | ||
from .like import Like | ||
from .message import Message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from django.db import models | ||
from .user import User | ||
|
||
class Message(models.Model): | ||
source_user = models.ForeignKey(User, related_name='message_source_user', on_delete=models.CASCADE) | ||
target_user = models.ForeignKey(User, related_name='message_target_user', on_delete=models.CASCADE) | ||
sent = models.DateTimeField(auto_now_add=True) | ||
content = models.TextField(max_length=255) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from .user import UserSerializer, UserRegistrationSerializer, UserConfigurationSerializer | ||
from .tag import TagSerializer | ||
from .picture import PictureSerializer | ||
from .like import LikeSerializer | ||
from .like import LikeSerializer | ||
from .message import MessageSerializer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from rest_framework import serializers | ||
from rest_framework.exceptions import ValidationError | ||
from ..models import Message, User, Like | ||
|
||
class MessageSerializer(serializers.ModelSerializer): | ||
target_user = serializers.PrimaryKeyRelatedField(queryset=User.objects.all(), write_only=True )# ,source='target_user') | ||
|
||
class Meta: | ||
model = Message | ||
fields = ['id', 'source_user', 'target_user', 'sent', 'content'] | ||
read_only_fields = ['id', 'source_user', 'sent'] | ||
|
||
def validate(self, attrs): | ||
source_user = self.context['request'].user | ||
target_user = attrs['target_user'] | ||
|
||
userLikedMe = Like.objects.filter(source_user=target_user, target_user=source_user).exists() | ||
iLikedUser = Like.objects.filter(source_user=source_user, target_user=target_user).exists() | ||
|
||
if not userLikedMe or not iLikedUser: | ||
raise ValidationError('Messages can only be sent to users when a match occured.') | ||
|
||
return attrs | ||
|
||
def create(self, validated_data): | ||
user = self.context['request'].user | ||
validated_data['source_user'] = user | ||
return Message.objects.create(**validated_data) |
Oops, something went wrong.