diff options
-rw-r--r-- | gentoobrowse-api/api/portage.ice | 1 | ||||
-rw-r--r-- | gentoobrowse-api/service/portageimpl.cpp | 7 | ||||
-rw-r--r-- | gentoobrowse-api/service/portageimpl.h | 1 | ||||
-rw-r--r-- | gentoobrowse-api/service/sql/portage/getUserTrackedRecentVersions.sql | 6 | ||||
-rw-r--r-- | gentoobrowse-api/unittests/testPortage.cpp | 8 |
5 files changed, 23 insertions, 0 deletions
diff --git a/gentoobrowse-api/api/portage.ice b/gentoobrowse-api/api/portage.ice index d73c108..1671c91 100644 --- a/gentoobrowse-api/api/portage.ice +++ b/gentoobrowse-api/api/portage.ice @@ -30,6 +30,7 @@ module Gentoo { idempotent PackageMasks getPackageMasks(int id); idempotent Uses getPackageUses(int id); idempotent Packages getUserTrackedPackages(int userid); + idempotent Ebuilds getUserTrackedRecentVersions(int userid, int limit); idempotent Use getUse(string flag) throws Slicer::NoRowsReturned; idempotent Uses getGlobalUses(); diff --git a/gentoobrowse-api/service/portageimpl.cpp b/gentoobrowse-api/service/portageimpl.cpp index d3ab69e..ac83557 100644 --- a/gentoobrowse-api/service/portageimpl.cpp +++ b/gentoobrowse-api/service/portageimpl.cpp @@ -17,6 +17,7 @@ #include <sql/portage/getPackagesWithRecentAdditions.sql.h> #include <sql/portage/getTopTrackedPackages.sql.h> #include <sql/portage/getUserTrackedPackages.sql.h> +#include <sql/portage/getUserTrackedRecentVersions.sql.h> #include <sql/portage/getRecentAdditions.sql.h> #include <sql/portage/getPackageDependencies.sql.h> #include <sql/portage/getPackageRuntimeDependencies.sql.h> @@ -167,6 +168,12 @@ Portage::getUserTrackedPackages(Ice::Int userid, const Ice::Current &) return fetchCache<Gentoo::Packages>(sql::portage::getUserTrackedPackages, 30, userid); } +Gentoo::Ebuilds +Portage::getUserTrackedRecentVersions(Ice::Int userid, Ice::Int limit, const Ice::Current &) +{ + return fetchCache<Gentoo::Ebuilds>(sql::portage::getUserTrackedRecentVersions, 30, userid, limit); +} + Gentoo::Categories Portage::getCategoriesWithRecentAdditions(Ice::Int syncs, const Ice::Current &) { diff --git a/gentoobrowse-api/service/portageimpl.h b/gentoobrowse-api/service/portageimpl.h index 9b49e76..b27f2a0 100644 --- a/gentoobrowse-api/service/portageimpl.h +++ b/gentoobrowse-api/service/portageimpl.h @@ -37,6 +37,7 @@ class DLL_PUBLIC Portage : public Gentoo::Portage, IceTray::AbstractCachingDatab Gentoo::PackageMasks getPackageMasks(Ice::Int id, const Ice::Current &) override; Gentoo::Uses getPackageUses(Ice::Int id, const Ice::Current &) override; Gentoo::Packages getUserTrackedPackages(Ice::Int userid, const Ice::Current &) override; + Gentoo::Ebuilds getUserTrackedRecentVersions(Ice::Int userid, Ice::Int limit, const Ice::Current &) override; Gentoo::UsePtr getUse(const std::string &, const Ice::Current &) override; Gentoo::Uses getGlobalUses(const Ice::Current &) override; diff --git a/gentoobrowse-api/service/sql/portage/getUserTrackedRecentVersions.sql b/gentoobrowse-api/service/sql/portage/getUserTrackedRecentVersions.sql new file mode 100644 index 0000000..1f59500 --- /dev/null +++ b/gentoobrowse-api/service/sql/portage/getUserTrackedRecentVersions.sql @@ -0,0 +1,6 @@ +SELECT e.ebuildid, e.packageid, e.repoid, e.version, e.slot, e.firstseen, e.moddate, e.license +FROM gentoobrowse.user_packages up, gentoobrowse.ebuilds e +WHERE up.userid = ? +AND up.packageid = e.packageid +ORDER BY e.firstseen +LIMIT ? diff --git a/gentoobrowse-api/unittests/testPortage.cpp b/gentoobrowse-api/unittests/testPortage.cpp index ae6224d..fdfd1f9 100644 --- a/gentoobrowse-api/unittests/testPortage.cpp +++ b/gentoobrowse-api/unittests/testPortage.cpp @@ -273,6 +273,14 @@ BOOST_AUTO_TEST_CASE( getUserTrackedPackages ) BOOST_REQUIRE_EQUAL(55943, ps.back()->packageid); } +BOOST_AUTO_TEST_CASE( getUserTrackedRecentVersions ) +{ + auto ps = p->getUserTrackedRecentVersions(1, 4); + BOOST_REQUIRE_EQUAL(4, ps.size()); + BOOST_REQUIRE_EQUAL(55943, ps.front()->packageid); + BOOST_REQUIRE_EQUAL(54144, ps.back()->packageid); +} + BOOST_AUTO_TEST_CASE( getPackageRuntimeDependencies ) { auto d = p->getPackageRuntimeDependencies(54144); |