mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
add Package SQLAlchemy ORM model
Additionally, add an optional **kwargs passing via make_relationship. This allows us to use things like `uselist=False`, which was needed for test/test_package.py. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
621e459dfb
commit
15b1332656
3 changed files with 106 additions and 2 deletions
24
aurweb/models/package.py
Normal file
24
aurweb/models/package.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
from sqlalchemy.orm import mapper
|
||||
|
||||
from aurweb.db import make_relationship
|
||||
from aurweb.models.package_base import PackageBase
|
||||
from aurweb.schema import Packages
|
||||
|
||||
|
||||
class Package:
|
||||
def __init__(self,
|
||||
PackageBase: PackageBase = None,
|
||||
Name: str = None, Version: str = None,
|
||||
Description: str = None, URL: str = None):
|
||||
self.PackageBase = PackageBase
|
||||
self.Name = Name
|
||||
self.Version = Version
|
||||
self.Description = Description
|
||||
self.URL = URL
|
||||
|
||||
|
||||
mapper(Package, Packages, properties={
|
||||
"PackageBase": make_relationship(PackageBase,
|
||||
Packages.c.PackageBaseID,
|
||||
"package", uselist=False)
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue