Commit 6ee34ab3 authored by Mario Oenning's avatar Mario Oenning Committed by Leonidas Spyropoulos
Browse files

feat: add field "CoMaintainers" to metadata-archives

parent 333051ab
Pipeline #36326 passed with stages
in 3 minutes and 8 seconds
......@@ -142,6 +142,21 @@ def get_extended_fields():
)
.distinct()
.order_by("Name"),
# Co-Maintainer
db.query(models.PackageComaintainer)
.join(models.User, models.User.ID == models.PackageComaintainer.UsersID)
.join(
models.Package,
models.Package.PackageBaseID == models.PackageComaintainer.PackageBaseID,
)
.with_entities(
models.Package.ID,
literal("CoMaintainers").label("Type"),
models.User.Username.label("Name"),
literal(str()).label("Cond"),
)
.distinct()
.order_by("Name"),
]
query = subqueries[0].union_all(*subqueries[1:])
return get_extended_dict(query)
......
......@@ -11,6 +11,7 @@ from aurweb.models import (
License,
Package,
PackageBase,
PackageComaintainer,
PackageDependency,
PackageLicense,
User,
......@@ -79,6 +80,7 @@ def packages(user: User) -> list[Package]:
DepName=f"dep_{i}",
DepCondition=">=1.0",
)
db.create(PackageComaintainer, User=user, PackageBase=pkgbase, Priority=1)
# Add the package to our output list.
output.append(pkg)
......@@ -229,6 +231,7 @@ def test_mkpkglists_extended(config_mock: None, user: User, packages: list[Packa
assert key in pkg, f"{pkg=} record does not have {key=}"
assert isinstance(pkg["Depends"], list)
assert isinstance(pkg["License"], list)
assert isinstance(pkg["CoMaintainers"], list)
for file in (PACKAGES, PKGBASE, USERS, META, META_EXT):
with open(f"{file}.sha256") as f:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment