Skip to content

Commit

Permalink
feat: added hashtag model (#77)
Browse files Browse the repository at this point in the history
#### Related Issue (Link to issue ticket)
---

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please link to the issue here: -->

This PR is related to [this issue](#78)

#### Description
---

<!--- Describe your changes in detail -->

- Added hashtag model


#### Types of changes
---

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
      ​

#### Checklist:
---

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [x] My code follows the code style of this project.
- [x] I have read the **CONTRIBUTING** document.
- [x] I have added tests to cover my changes.
- [x] All new and existing tests passed.
  • Loading branch information
codewitgabi authored Sep 19, 2024
2 parents e0fb167 + cb2b12a commit 075495a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/v1/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
from api.v1.models.profile_picture import ProfilePicture
from api.v1.models.social_link import SocialLink
from api.v1.models.notification import Notification
from api.v1.models.hashtag import Hashtag
14 changes: 14 additions & 0 deletions api/v1/models/hashtag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from sqlalchemy.orm import mapped_column, Mapped
from sqlalchemy import Integer, String

from api.v1.models.abstract_base import AbstractBaseModel


class Hashtag(AbstractBaseModel):
__tablename__ = "hashtag"

tag: Mapped[str] = mapped_column(String(55), nullable=False, unique=True)
usage: Mapped[int] = mapped_column(Integer, default=1)

def __str__(self):
return self.tag

0 comments on commit 075495a

Please sign in to comment.