-
Notifications
You must be signed in to change notification settings - Fork 1
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 #86 from DostEducation/develop
Release v0.2.0
- Loading branch information
Showing
14 changed files
with
398 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#[ISSUE_ID] | ||
<!--- If there is an open issue, please link to the issue here by replacing [ISSUE_ID]--> | ||
<!-- Make sure the PR is against the `develop` branch --> | ||
|
||
### Please complete the following steps and check these boxes before filing your PR: | ||
|
||
|
||
### Types of changes | ||
<!--- What types of changes does your code introduce? --> | ||
- [ ] Bug fix (a change which fixes an issue) | ||
- [ ] New feature (a change which adds functionality) | ||
|
||
|
||
### Short description of what this resolves: | ||
<!--- Describe your changes in detail --> | ||
<!--- Why these change required? What problem does it solve? --> | ||
|
||
|
||
### Checklist: | ||
<!--- Mark the checkboxes accordingly. --> | ||
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> | ||
- [ ] I have performed a self-review of my own code. | ||
- [ ] The code follows the style guidelines of this project. | ||
- [ ] The code changes are passing the CI checks | ||
- [ ] I have documented my code wherever required. | ||
- [ ] The changes requires a change to the documentation. | ||
- [ ] I have updated the documentation based on the my changes. | ||
<!--- TODO: need to uncomment these two checklist once we start with test cases. | ||
- [ ] I have added tests to cover my changes (if not applicable, please state why) | ||
- [ ] All new and existing tests are passing. | ||
--> |
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
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,21 @@ | ||
from api.mixins import TimestampMixin | ||
from api import db, helpers | ||
from flask_sqlalchemy import BaseQuery | ||
from sqlalchemy import desc, and_ | ||
|
||
|
||
class UserCustomFieldsQuery(BaseQuery): | ||
def get_by_user_phone(self, phone): | ||
return self.filter(UserCustomFields.user_phone == phone).all() | ||
|
||
|
||
class UserCustomFields(TimestampMixin, db.Model): | ||
query_class = UserCustomFieldsQuery | ||
__tablename__ = "user_custom_fields" | ||
id = db.Column(db.Integer, primary_key=True) | ||
user_id = db.Column(db.Integer, db.ForeignKey("user.id")) | ||
registration_id = db.Column(db.Integer, db.ForeignKey("registration.id")) | ||
user_phone = db.Column(db.String(50), nullable=False) | ||
flow_run_uuid = db.Column(db.String(255)) | ||
field_name = db.Column(db.String(255), nullable=False) | ||
field_value = db.Column(db.String(500), nullable=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,33 @@ | ||
from api.mixins import TimestampMixin | ||
from api import db, helpers | ||
from flask_sqlalchemy import BaseQuery | ||
from sqlalchemy import desc, and_ | ||
|
||
|
||
class UserGroupQuery(BaseQuery): | ||
def get_by_uuid(self, uuid): | ||
return self.filter(UserGroup.group_uuid == uuid).first() | ||
|
||
def get_unique(self, uuid, phone): | ||
return ( | ||
self.filter( | ||
and_( | ||
UserGroup.group_uuid == uuid, | ||
UserGroup.user_phone == phone, | ||
) | ||
) | ||
.order_by(desc(UserGroup.created_on)) | ||
.first() | ||
) | ||
|
||
|
||
class UserGroup(TimestampMixin, db.Model): | ||
query_class = UserGroupQuery | ||
__tablename__ = "user_group" | ||
id = db.Column(db.Integer, primary_key=True) | ||
user_phone = db.Column(db.String(50), nullable=False) | ||
user_id = db.Column(db.Integer, db.ForeignKey("user.id")) | ||
registration_id = db.Column(db.Integer, db.ForeignKey("registration.id")) | ||
group_name = db.Column(db.String(255), nullable=False) | ||
group_uuid = db.Column(db.String(255)) | ||
status = db.Column(db.String(100)) |
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
Oops, something went wrong.