mirror of
https://github.com/yusufipk/RepoHub.git
synced 2026-09-12 02:56:07 +00:00
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:
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user