Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
F
fastapi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Roman Desyatskii
fastapi
Commits
3fa5116b
Commit
3fa5116b
authored
Jan 04, 2024
by
Roman Desyatskii
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Models
parent
efa15ccc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
0 deletions
+54
-0
base.py
src/app/db/base.py
+23
-0
genre.py
src/app/db/genre.py
+10
-0
models.py
src/app/db/models.py
+9
-0
person.py
src/app/db/person.py
+12
-0
No files found.
src/app/db/base.py
0 → 100644
View file @
3fa5116b
# from uuid import uuid4
# from tortoise import fields, models
#
#
# class IdMixin(models.Model):
# id = fields.UUIDField(pk=True, default=uuid4)
#
# class Meta:
# abstract = True
#
#
# class TimestampMixin(models.Model):
# created_at = fields.DatetimeField(auto_now_add=True)
# deleted_at = fields.DatetimeField(auto_now=True)
#
# class Meta:
# abstract = True
#
#
# class BaseModel(IdMixin, TimestampMixin):
#
# class Meta:
# ordering = ('-created_at', )
\ No newline at end of file
src/app/db/genre.py
0 → 100644
View file @
3fa5116b
from
tortoise
import
fields
,
models
class
Genre
(
models
.
Model
):
id
=
fields
.
IntField
(
pk
=
True
)
name
=
fields
.
CharField
(
max_length
=
255
,
unique
=
True
)
description
=
fields
.
TextField
(
null
=
True
)
def
__str__
(
self
)
->
str
:
return
self
.
name
\ No newline at end of file
src/app/db/models.py
0 → 100644
View file @
3fa5116b
from
tortoise
import
models
,
fields
class
Article
(
models
.
Model
):
id
=
fields
.
IntField
(
pk
=
True
)
name
=
fields
.
TextField
()
def
__str__
(
self
)
->
str
:
return
self
.
name
src/app/db/person.py
0 → 100644
View file @
3fa5116b
from
tortoise
import
fields
,
models
class
Person
(
models
.
Model
):
id
=
fields
.
IntField
(
pk
=
True
)
name
=
fields
.
CharField
(
max_length
=
255
,
null
=
True
)
birth_date
=
fields
.
DateField
(
null
=
True
)
def
__str__
(
self
):
return
self
.
name
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment