Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
WenhaoCao0729 committed Dec 1, 2022
1 parent 602c4f6 commit 7df8394
Show file tree
Hide file tree
Showing 67 changed files with 125 additions and 73 deletions.
1 change: 0 additions & 1 deletion New.txt

This file was deleted.

2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web: gunicorn mysite.wsgi
web: gunicorn SocialDistribution.wsgi
43 changes: 2 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,17 @@ Our project is about Django web development, and our group members are
| Mengju Liao | mengju |
| Xuantong Ma | xuantong |

Project and Information are represented in WiKi
Project and Information are represent in WiKi


# API Reference

[CLICK ME!](https://fallsocialuahank.herokuapp.com/swagger/)

#### Library needed

```
pip install -r requirements.txt [or pip3, depends on your environment]
pip -install -r requirements.txt [or pip3, depends on your environment]
```

<hr>

## Authors

**GET** URL: //service/authors
Expand All @@ -43,8 +39,6 @@ Project and Information are represented in WiKi
Eg. GET ://service/authors?page=10&size=5, Gets the 5 authors, authors 45 to 49.
```

<hr>

## Single Author

**GET** URL: //service/authors/{author_uuid}
Expand Down Expand Up @@ -74,15 +68,8 @@ Project and Information are represented in WiKi
```

<hr>

## Posts

**GET** URL: //service/posts/
```posts
To get all public posts
```

**GET** URL: //service/authors/{author_uuid}/posts/
```posts
To get all posts of the author {author_uuid}.
Expand Down Expand Up @@ -130,7 +117,6 @@ Project and Information are represented in WiKi
create a post where its id is {post_uuid}
```

<hr>

## Image Posts

Expand All @@ -139,9 +125,6 @@ Project and Information are represented in WiKi
To get image of a post {post_uuid}. If no image file associate with, return 404. If so, display the image
```


<hr>

## Comments

**GET** URL: //service/authors/{author_uuid}/posts/{post_uuid}/comments
Expand All @@ -161,26 +144,4 @@ Project and Information are represented in WiKi
}
```

<hr>

## Followers

**GET** URL: //service/authors/{author_uuid}/followers
```followers
get a list of authors who are {author_uuid}’s followers
```

**DELETE** URL: //service/authors/{author_uuid}/followers/{FOREIGN_author_uuid}
```followers
Unfollow the author{author_uuid} on behalf of {FOREIGN_author_uuid}
```

**PUT** URL: //service/authors/{author_uuid}/followers/{FOREIGN_author_uuid}
```followers
simple click on PUT button(no input required), then Follow the author{author_uuid} on behalf of {FOREIGN_author_uuid}
```

**GET** URL: //service/authors/{author_uuid}/followers/{FOREIGN_author_uuid}
```followers
check if a user{FOREIGN_author_uuid} followed author{author_uuid}.
```
Binary file modified SocialDistribution/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file modified SocialDistribution/__pycache__/settings.cpython-38.pyc
Binary file not shown.
Binary file modified SocialDistribution/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file modified SocialDistribution/__pycache__/wsgi.cpython-38.pyc
Binary file not shown.
Binary file modified authors/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file modified authors/__pycache__/admin.cpython-38.pyc
Binary file not shown.
Binary file modified authors/__pycache__/apps.cpython-38.pyc
Binary file not shown.
Binary file modified authors/__pycache__/models.cpython-38.pyc
Binary file not shown.
Binary file modified authors/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file modified authors/__pycache__/views.cpython-38.pyc
Binary file not shown.
Binary file modified authors/migrations/__pycache__/0001_initial.cpython-38.pyc
Binary file not shown.
Binary file modified authors/migrations/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file modified db.sqlite3
Binary file not shown.
Binary file modified inbox/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file modified inbox/__pycache__/admin.cpython-38.pyc
Binary file not shown.
Binary file modified inbox/__pycache__/apps.cpython-38.pyc
Binary file not shown.
Binary file modified inbox/__pycache__/models.cpython-38.pyc
Binary file not shown.
Binary file modified inbox/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file modified inbox/__pycache__/views.cpython-38.pyc
Binary file not shown.
Binary file modified inbox/migrations/__pycache__/0001_initial.cpython-38.pyc
Binary file not shown.
Binary file modified inbox/migrations/__pycache__/0002_inbox.cpython-38.pyc
Binary file not shown.
Binary file modified inbox/migrations/__pycache__/0003_delete_inbox.cpython-38.pyc
Binary file not shown.
Binary file modified inbox/migrations/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file modified login/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file modified login/__pycache__/admin.cpython-38.pyc
Binary file not shown.
Binary file modified login/__pycache__/apps.cpython-38.pyc
Binary file not shown.
Binary file modified login/__pycache__/forms.cpython-38.pyc
Binary file not shown.
Binary file modified login/__pycache__/models.cpython-38.pyc
Binary file not shown.
Binary file modified login/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file modified login/__pycache__/views.cpython-38.pyc
Binary file not shown.
Binary file modified login/migrations/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions login/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ def sign_up(request):
new_author = form.save(commit=False)
# generate something
authorHost = request.META.get('HTTP_HOST')
authorId = f"{request.build_absolute_uri('/')}authors/{new_author.uuid}"
authorUrl = f"{request.build_absolute_uri('/')}authors/{new_author.uuid}"
authorId = f"{request.build_absolute_uri('/')}service/authors/{new_author.uuid}"
authorUrl = f"{request.build_absolute_uri('/')}service/authors/{new_author.uuid}"
new_user = userForm.save(commit=False)
#### Needs Admin Permission to activate this new account ####
new_user.is_active = False
Expand Down
Binary file modified me/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file modified me/__pycache__/admin.cpython-38.pyc
Binary file not shown.
Binary file modified me/__pycache__/apps.cpython-38.pyc
Binary file not shown.
Binary file modified me/__pycache__/forms.cpython-38.pyc
Binary file not shown.
Binary file modified me/__pycache__/models.cpython-38.pyc
Binary file not shown.
Binary file modified me/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file modified me/__pycache__/views.cpython-38.pyc
Binary file not shown.
Binary file modified me/migrations/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file modified post/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file modified post/__pycache__/admin.cpython-38.pyc
Binary file not shown.
Binary file modified post/__pycache__/apps.cpython-38.pyc
Binary file not shown.
Binary file modified post/__pycache__/models.cpython-38.pyc
Binary file not shown.
Binary file modified post/__pycache__/post_forms.cpython-38.pyc
Binary file not shown.
Binary file modified post/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file modified post/__pycache__/views.cpython-38.pyc
Binary file not shown.
Binary file modified post/migrations/__pycache__/0001_initial.cpython-38.pyc
Binary file not shown.
Binary file modified post/migrations/__pycache__/0002_like.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file modified post/migrations/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
6 changes: 3 additions & 3 deletions post/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def create_post(request,userId):
form = post_form(request.POST,request.FILES)
if form.is_valid():
newPost = form.save(commit=False)
newPost.id = f"{request.build_absolute_uri('/')}authors/{str(userId)}/posts/{str(newPost.uuid)}"
newPost.id = f"{request.build_absolute_uri('/')}service/authors/{str(userId)}/posts/{str(newPost.uuid)}"
newPost.source = newPost.id
newPost.origin = newPost.id
currentAuthor = single_author.objects.get(uuid = userId)
Expand Down Expand Up @@ -98,7 +98,7 @@ def create_comment(request,userId,postId):
form = Comment_form(request.POST)
if form.is_valid():
newComment = form.save(commit=False)
newComment.id = f"{request.build_absolute_uri('/')}authors/{str(userId)}/posts/{str(newComment.uuid)}"
newComment.id = f"{request.build_absolute_uri('/')}service/authors/{str(userId)}/posts/{str(postId)}/comments/{str(newComment.uuid)}"
currentAuthor = single_author.objects.get(uuid = userId)
newComment.author = currentAuthor

Expand Down Expand Up @@ -152,7 +152,7 @@ def share_post(request,userId,postId):
if old_post.author.uuid != currentAuthor.uuid:
new_title = old_post.title
new_postId = uuid.uuid4()
new_id = f"{request.build_absolute_uri('/')}authors/{str(userId)}/posts/{str(new_postId)}"
new_id = f"{request.build_absolute_uri('/')}service/authors/{str(userId)}/posts/{str(new_postId)}"
new_source = id
new_origin = id
new_description = old_post.description
Expand Down
17 changes: 17 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
asgiref==3.5.2
backports.zoneinfo==0.2.1
certifi==2022.9.24
charset-normalizer==2.1.1
coreapi==2.3.3
coreschema==0.0.4
dj-database-url==1.0.0
Django==4.1.3
django-filter==22.1
django-on-heroku==1.1.2
djangorestframework==3.14.0
drf-yasg==1.21.4
gunicorn==20.1.0
idna==3.4
importlib-metadata==5.0.0
inflection==0.5.1
itypes==1.2.0
Jinja2==3.1.2
Markdown==3.4.1
MarkupSafe==2.1.1
packaging==21.3
Pillow==9.3.0
psycopg2-binary==2.9.5
pyparsing==3.0.9
pytz==2022.6
requests==2.28.1
ruamel.yaml==0.17.21
ruamel.yaml.clib==0.2.7
sqlparse==0.4.3
uritemplate==4.1.1
urllib3==1.26.13
whitenoise==6.2.0
zipp==3.10.0
1 change: 1 addition & 0 deletions runtime.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python-3.9.15
Binary file modified service/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file modified service/__pycache__/admin.cpython-38.pyc
Binary file not shown.
Binary file modified service/__pycache__/apps.cpython-38.pyc
Binary file not shown.
Binary file modified service/__pycache__/models.cpython-38.pyc
Binary file not shown.
Binary file modified service/__pycache__/serializers.cpython-38.pyc
Binary file not shown.
Binary file modified service/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file modified service/__pycache__/views.cpython-38.pyc
Binary file not shown.
Binary file modified service/migrations/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
10 changes: 5 additions & 5 deletions service/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
class AuthorSerializer(serializers.ModelSerializer):

type = serializers.CharField(default='author', max_length=10)

class Meta:
model = single_author
fields = ('type','id','url','host','display_name','github','profileImage','username')
fields = ('type','id','url','host','github','profileImage','username')

class PostsSerializer(serializers.ModelSerializer):

type = serializers.CharField(max_length=10,default='posts')

class Meta:
model = Post
fields = ('uuid','type','title','id','source','description','contentType','content','author','Categories','count','published','visibility','unlisted')
fields = ('uuid','type','title','id','source','description','contentType','content','author','Categories','count','origin','published','visibility','unlisted')

class ImagePostsSerializer(serializers.ModelSerializer):
class Meta:
Expand All @@ -33,4 +33,4 @@ class Meta:
# class followSerializer(serializers.ModelSerializer):
# class Meta:
# model = Followers
# fields = '__all__'
# fields = 'all'
Loading

0 comments on commit 7df8394

Please sign in to comment.