volontaria / api-volontaria Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://volontaria.github.io/API-Volontaria/
License: GNU Affero General Public License v3.0
Home Page: https://volontaria.github.io/API-Volontaria/
License: GNU Affero General Public License v3.0
Travis should be checking the coding style too, ie: ending comma in a list or dict
Travis is currently checking syntax according to the PEP8 styleguide.
We should make a personalized style check in Travis' file
When POSTing a new user, I expect the API to store the password correctly.
When testing with the live API view at /documentation
, if you POST a new user, the API fails to store the password correctly in the database.
Add a step in the User
serializer in the create()
override to validate the password.
ex:
user.set_password(**validated_data['password'])
./manage.py runserver
/user
endpoint and then the electrical plugYou should see this in the password field:
I want to have an endpoint to change my forgotten password.
If i forgot my password i need to contact an administrator of the instance.
First step
I call the endpoint (without authentication) and give my username in the body.
Second step
1 - If a link is specified in the settings : A token is generated by the API and i receive an email with a link (who contain the token) to change my password.
2 - If email are not configured in settings : The endpoint return an error and ask me to contact an administrator.
Third step
I call a second endpoint (without authentication) with the token and a password in the body.
All email attributs are in caps, without special characters, without space
ex: ACTIVATIONURL
Format are not valid for SendInBlue
ex: activation_url
Just change the format
We want to have the first finalized diagram of data to defined the scope of the project.
It's a new part of the project, so we don't have a current behavior
PlantText
to generate the documentation from textdocumentation
on the root of the repositoryWhen i make a makemigrations from the develop branch, i've no one change.
When i make a makemigrations from the develop branch, i've this:
Migrations for 'apiVolontaria':
source/apiVolontaria/apiVolontaria/migrations/0004_auto_20171224_1736.py
- Alter field created on activationtoken
Migrations for 'location':
source/apiVolontaria/location/migrations/0002_auto_20171224_1736.py
- Alter unique_together for country (0 constraint(s))
- Alter unique_together for stateprovince (0 constraint(s))
makemigrations
doesn't return new migrations file on TravisCImakemigrations
command : python source/apiGiggle/manage.py makemigrations
c2cd8d19ad4e0d196ac22b33fcb2b6b9576adba2
)Python 3.6.3
Arch Linux
We need a way to auto-generate our code's documentation
No documentation is auto-generated (except the API endpoints with swagger)
We could use Sphinx and be able to upload our docs to readthedocs and/or github.
We have a first prototype of user interface in HTML
and CSS
We don't have a prototype for the moment
The views should check for the correct permissions.
Currently, in the case of an update request to an object, the view checks if the user has the permission update_model
. However, the default Django permission created for models is change_model
.
We need to fix this by changing update_*****
permissions by change_*****
We want to have a script we can launch to test all the repository like Travis before create our PR.
Actually i need to test all by myself or create a new PR to let Travis do the work (so i need to wait to see a little typo in PEP8...)
Create a test
script so user can easily and rapidly check their code before submit a new PR.
We we run makemigrations
command, we want to have only new modification and not a list of default field who change in function of time and spam the migrations system
Actually, when we run the makemigrations
command we have ALWAYS a new migrations from theTemporaryToken
model.
Change the way we put the default
value to not change each time we create a new migration.
A potential solution (maybe not the best, i don't know) is to overwrite the save()
method of the model class to change the default value. This way we migrations system will be not impacted.
class TemporaryToken(Token):
"""Subclass of Token to add an expiration time."""
expires = models.DateTimeField(
default=timezone.now() + timezone.timedelta(
minutes=settings.REST_FRAMEWORK_TEMPORARY_TOKENS['MINUTES']
)
)
python source/apiVolontaria/manage.py makemigrations
apiVolontaria
application.We want to have a way to edit just some variable of the local_settings without have conflitcs
We can just edit the real settings file of the project
Create a local_settings
file who overwrite only some options and let other options at default value of the repository.
When linting, Travis should detect missing trailing commas.
Linting detects syntax errors, but not style errors.
Use the flake8-commas module to lint.
Need to have a default STATIC_ROOT
path directory
There is no base STATIC_ROOT
path directory
Adding a base STATIC_ROOT
path
I want to have github and documentation button centered in the header when i visit the page with my smartphone.
I want to have a blue space all around the Volontaria white box on the top of the page.
Buttons are aligned on the right, which is good when i'm on my laptop, but not when i'm on my smartphone.
Big white box is correctly display on laptop but is truncated when i visit the page with my smartphone without turn my screen horizontaly.
Adapt the css for each big kind of resolution with usage of @media
There should be a way of getting events in a specific cycle.
We can only get ALL events through /events GET
Add a filter in the /events GET view. We should be able to add "?cycle=cycle_id" in the url to get specific events.
We want to be able to :
Actually we have no calls on the API
We do not have models too
BasicUserSerializer
1 - Create new user :
POST users/
username
, email
, password
User.is_active = False
at this step of the creation
Un email de bienvenue est envoye au user afin de valider son inscription (https://www.sendinblue.com)
2 - Detail of a user :
GET users/$id
admin
only3 - Activate a user :
POST users/
activation-token
4 - List all user :
GET users/
admin
onlyWe want to be able to use a system of pagination when we use the API
Actually all objects are returned in a unique JSON
Use the system of pagination of Django Rest Framework
We want to be able to just launch a script to init all the project in local.
Actually we need to follow the INSTALL.md
file.
Add a script in script
folder at the root of the repository.
Admin site could provide advanced features such as auto-complete and manual location on map using long/lat. The API should regularize addresses it receives.
The current address system is very basic. It should be more robust.
- There are some feature missing like auto-complete using OpenStreetMap of GoogleMap on the admin site.
- A map widget would also be useful on the admin site.
- Addresses that are manually added are not verified, so there can be duplicates.
There are a couple of tools/resources available, although not all maintained.
- libpostal : A C library for parsing/normalizing street addresses around the world. Powered by statistical NLP and open geo data.
- django-address : A Django address model and field. Addresses may be specified by address components or by performing an automatic Google Maps lookup.
- GeoDjango Model API : This document explores the details of the GeoDjango Model API.
I don't want the user to be able to delete his participations if the event linked is already begin.
Use can delete all his participations
Check to add this logic in the serializer or/and in the models to be sure it's impossible to do that.
I want to be able to change my personnals informations
Actually i need to contact an administrator to change my informations and my password
PATCH /users/:id
actual_password
new_password
confirm_password
When i call the API with a HTTP PATCH
verb i want to make a partial update of the ressource.
Actually we call the update()
function of the view and not the partial_update()
who make only a partial update.
def patch(self, request, *args, **kwargs):
if self.request.user.has_perm('volunteer.update_cell'):
return self.update(request, *args, **kwargs)
Change :
return self.update(request, *args, **kwargs)
to :
return self.partial_update(request, *args, **kwargs)
on each view already implemented (EventsId
is already done)
No need to reproduce, just look the code.
c2cd8d19ad4e0d196ac22b33fcb2b6b9576adba2
)We want to be able to use a CRUD on TaskType
objects.
Actually we have no calls on the API
We do not have models too
AdminTaskTypeSerializer
1 - Create new TaskType :
POST tasktypes/
admin
onlyname
2 - Delete a tasktype :
DELETE tasktypes/$id
admin
only3 - Update a tasktype :
PATCH tasktypes/$id
admin
onlyname
4 - List tasktypes :
GET tasktypes/
admin
only5 - Detail of a tasktype :
GET tasktypes/$id
admin
onlyModels should have a str() method to get a meaningful representation on the objects.
>>> TaskType.objects.all()
<QuerySet [<TaskType: tasktype_name>]>
No str() method are defined in the models. That means, for example, that when we query a set of objects of a model in the shell, we get something like
>>> TaskType.objects.all()
<QuerySet [<TaskType: TaskType object>]>
The method whould be added (TaskType and Cycle). See the Django Tutorial for more details.
Allow system to give some notification to some users
We don't have a system of notification
Notification
Profile
to have some new preferencies (default=False
)Notification
is createdGET notifications/
GET notifications/:id
@startuml
title Notification System - Class Diagram
class Notification {
+TextField content
+CharField title
}
class User {
}
class Profile {
+ ...
+BooleanField send_email
+BooleanField send_sms
+ ...
}
Notification -> User : notify >
User -> Profile
@enduml
We want to be able to develop a new prototype of user interface with SCSS with a all-in-one project easy to use to new contributor
It's a new part of the project, so we don't have a current behavior
Gulp
to generate CSS filebuild
**AND ** watch
job with Gulp
build
: Build the new css file from all scss fileswatch
: Launch build
on EACH change to have a realtime refresh when we codeI want to find a page of documentation on how to contribute to this project.
I've no one information for the moment.
How to contribute
in the documentation ReadTheDocs
enhancement-create_new_cell
, fix-pep8_standard_on_cell_model
)Pull Request
to make a link on the contribution page in place of the Contributing.md
who doesn't existIntegration de swagger sur l'url DOMAIN_NAME/documentation
We want to be able to use a CRUD on Cycle
objects.
Actually we have no calls on the API
We do not have models too
AdminCycleSerializer
1 - Create new cycle :
POST cycles/
admin
onlystart
, end
2 - Delete a cycle :
DELETE cycles/$id
admin
only3 - Update a cycle :
PATCH cycles/$id
admin
onlystart
, end
4 - List cycles :
GET cycles/
admin
only5 - Detail of a cycle :
GET cycles/$id
admin
onlyWe want to have a documentation of contributing about docsting to know how to write them.
We write docstring the way we want without coordination.
Add some information in the contributing
file
I want to be able to find my personals information with an endpoint on the API.
I can get my token with the authenticate
endpoint but i can't find my personnal ID or all my personnal informations.
Create a new endpoint `users/me' to get my personnal informations.
To call this endpoint you need to be authenticated with your token API.
I want to know the number of volunteers and standby already attached on an event when i list all event with GET /events
Actually i have nb_volunteers_needed
, nb_volunteers_on_hold_needed
and volunteers
but i can't know who is volunteer and who is on_hold.
Add two method property on the model and add them on the serializer
We want to be able to manage participations
with some endpoints
Actually we can manage participation from the event endpoint but it's not safe and not easy to use.
Create some new endpoint :
/participations
(GET and POST)/participations/$id
(GET, PATCH and DELETE)Forbid the modifications on event serializers (put the fields as read-only
)
I want to be able to create a fake instance of a model easily without manually create all the requirements of this models (relatel field and specific values)
I need to create ALL the requirements to just test a property of a model.
Create some factories in factories.py
file in each applications of the project.
I expect to have all needed packages for dev by installing requirement file's content
pip requirement file does not contain pep8 (deprecated) nor pycodestyle
Add pycodestyle
to pip requirements.
Otherwise we'll need an easy solution for developers.
Also, Travis is using pep8. Shouldn't it be using pycodestyle?
ref:
PyCQA/pycodestyle#572
PyCQA/pycodestyle#466
A conduct file exists
No code of conduct as been written
Create the file CODE_OF_CONDUCT.md with content. Example here (Angular's code of conduct).
Initialize Django Rest Framework on the project
As a user, i want to receive an email of confirmation when i ask to participate to an event.
Actually i just have a notification on the website and i can see my schedule on the website.
I can't see my schedule without go on the website.
imailing
with this list of attributs :
start_date
: An human readable date (because it's just copy/paste in the template)start_time
: An human readable time (because it's just copy/paste in the template)address
The PR template should remind the contributor to update the mock-api
file when adding API endpoints.
No mention of the mock API is made.
Update de template.
PR template should list some of the most important checks from the CONTRIB doc
The PR template only includes some of the important check (like branch name)
Add important elements in
.github/PULL_REQUEST_TEMPLATE.md
We want to add Unit test and Coverage in our structure of Continuous Integration.
On each commit we want the system to test if :
Actually we already have a structure of Continuous Integration based on Travis
This structure only test the PEP8 standard.
UserFactory
to create a new user :
superuser
authentication
POST calltravis.yml
)Coveralls
on the project
travis.yml
Add a search bar to find participation of a specific user
Add filters on the table
Splits line of the table into multiple columns
Actually we have just a list of one columns str()
and no way to search and filter
Overwrite the AdminModel
in the admin.py
We want to activate the user by default
OR
We want to send him an email with the activation token to activate his account
User is put inactive when created and that's all because he never get his ActivationToken
Use the package created by myself and @willkoua to send email by transactional service (Sendgrid, SendinBlue, ..) or put the user active by default.
When the user is not activated, if we try to get a token (login), the /authentication
POST endpoint should return an error message informing the user of the situation.
This response is sent when a user is not activated and tries to login:
{
non_field_errors: [
"Bad password"
]
}
Verify if the user is activated before sending back the "bad password" error.
User
using the /user
POST endpoint/authentication
POST endpoint.commit d355c5a6d6ff537b5eeaaae25a2357e3f59a9dba (HEAD -> develop, upstream/develop, origin/develop, origin/HEAD)
Author: RignonNoel <[email protected]>
Date: Sat Dec 30 14:18:49 2017 -0500
add filter on event to manage M2M relation
We want to be able to use a CRUD on Events
objects.
Events
in the APIEvents
modelEvents
modelAdminEventSerializer
Model representation:
Event:
- name (charfield)
- nb_volunteers_needed (number)
- nb_volunteers_standby_needed (number)
- cycle (Cycle ForeignKey)
- task_type (Tasktype ForeignKey)
- volunteers (User ManyToManyField)
- volunteers_standby (User ManyToManyField)
Some methods that could be useful:
def nb_volunteers(self)
def nb_volunteers_standby(self)
1 - Create new event :
POST events/
admin
onlyname
,task_type
,nb_volunteers_needed
,nb_volunteers_standby_needed
,volunteers
,volunteers_standby
2 - Delete an event :
DELETE events/$id
admin
only3 - Update a event :
PATCH events/$id
admin
onlyname
,task_type
,nb_volunteers_needed
,nb_volunteers_standby_needed
,volunteers
,volunteers_standby
4 - List events :
GET events/
admin
only5 - Detail of an event :
GET events/$id
admin
onlyI want to receive all messages from the API in my preferred language.
Actually all error message from the API is in English,
I want to be able to get only my future participation to prepare my schedule.
I can only get ALL my participations and filter after that
Add four filters :
start_date_lte
start_date_gte
end_date_lte
end_date_gte
We want to be able to use a CRUD on Cells
objects.
Actually we have no calls on the API
We do not have models too
AdminCellSerializer
1 - Create new cell :
POST cells/
admin
onlyname
2 - Delete a cell :
DELETE cells/$id
admin
only3 - Update a cell :
PATCH cells/$id
admin
onlyname
4 - List cells :
GET cells/
admin
only5 - Detail of a cell :
GET cells/$id
admin
onlyA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.