refactor: make type and repository filters Debian/Ubuntu specific

- Removed type and repository filters from non-Debian/Ubuntu platforms (Arch, Fedora, macOS, Windows)
- Conditionally render type filter UI only for Debian/Ubuntu platforms
- Set type and repository to null in package fetchers for platforms that don't support these classifications
This commit is contained in:
Yusuf İpek
2025-11-12 00:22:33 +03:00
parent 4fb96f3dbc
commit 1cb13f5314
5 changed files with 29 additions and 48 deletions
+2 -6
View File
@@ -172,16 +172,12 @@ export class ArchPackageFetcher {
[pkg.name, 'arch']
)
const repository = (pkg.repository === 'core' || pkg.repository === 'extra')
? 'official'
: 'third-party'
if (existingResult.rows.length === 0) {
// Insert new package (id will be auto-generated by SERIAL)
await query(
`INSERT INTO packages (id, name, description, version, platform_id, type, repository, popularity_score, is_active)
VALUES (gen_random_uuid(), $1, $2, $3, $4, $5, $6, $7, $8)`,
[pkg.name, pkg.description, pkg.version, 'arch', 'cli', repository, 0, true]
[pkg.name, pkg.description, pkg.version, 'arch', null, null, 0, true]
)
stored++
} else if (existingResult.rows[0].version !== pkg.version) {
@@ -190,7 +186,7 @@ export class ArchPackageFetcher {
`UPDATE packages
SET version = $1, description = $2, repository = $3, updated_at = NOW()
WHERE id = $4`,
[pkg.version, pkg.description, repository, existingResult.rows[0].id]
[pkg.version, pkg.description, null, existingResult.rows[0].id]
)
updated++
} else {
+2 -2
View File
@@ -146,7 +146,7 @@ export class FedoraPackageFetcher {
await query(
`INSERT INTO packages (id, name, description, version, platform_id, type, repository, popularity_score, is_active)
VALUES (gen_random_uuid(), $1, $2, $3, $4, $5, $6, $7, $8)`,
[pkg.name, pkg.description, pkg.version, 'fedora', 'cli', pkg.repository, 0, true]
[pkg.name, pkg.description, pkg.version, 'fedora', null, null, 0, true]
)
stored++
} else if (existingResult.rows[0].version !== pkg.version) {
@@ -155,7 +155,7 @@ export class FedoraPackageFetcher {
`UPDATE packages
SET version = $1, description = $2, repository = $3, updated_at = NOW()
WHERE id = $4`,
[pkg.version, pkg.description, pkg.repository, existingResult.rows[0].id]
[pkg.version, pkg.description, null, existingResult.rows[0].id]
)
updated++
} else {
+1 -1
View File
@@ -145,7 +145,7 @@ export class HomebrewPackageFetcher {
await query(
`INSERT INTO packages (id, name, description, version, platform_id, type, repository, popularity_score, is_active)
VALUES (gen_random_uuid(), $1, $2, $3, $4, $5, $6, $7, $8)`,
[pkg.name, pkg.description, pkg.version, 'macos', 'cli', 'official', 0, true]
[pkg.name, pkg.description, pkg.version, 'macos', null, null, 0, true]
)
stored++
} else if (existingResult.rows[0].version !== pkg.version) {
+1 -1
View File
@@ -232,7 +232,7 @@ export class WingetPackageFetcher {
await query(
`INSERT INTO packages (id, name, description, version, platform_id, type, repository, popularity_score, is_active)
VALUES (gen_random_uuid(), $1, $2, $3, $4, $5, $6, $7, $8)`,
[pkg.name, pkg.description, pkg.version, 'windows', 'gui', 'official', 0, true]
[pkg.name, pkg.description, pkg.version, 'windows', null, null, 0, true]
)
stored++
} else if (existingResult.rows[0].version !== pkg.version) {