feat(Devices): Categories, models and makers for known devices#49
Merged
Conversation
risixdzn
commented
May 31, 2026
Member
- Scraped devices from GSMArena, LaptopMedia and DisplayResolutions at devices.etl
- Around 8k devices: about 4500 phones, tablets, smartwatches, 2k laptops and the rest being tvs and monitors.
- Created tables to hold scraped data+ CRUD routes for that.
…used columns - Flatten modelMinimalListSelect to fix 500 error with nested selects + $dynamic() - Remove imageLocalPath and imageUrl references (columns dropped from DB) - Source primary image from model_images table; return presigned URL as imageUrl - Remove originalUrl from model_images response, schema, and insert - Add batch queryPrimaryImages + generateImagePresignedUrl helpers - Add "Available" status fallback for null status in all model endpoints - Add 416 code to httpStatusCodes to fix page_out_of_bounds serialization - Create migration 0010 for FULLTEXT index on models (name, models_text, ...)
Comment on lines
+348
to
+350
| const model = await ModelsRepository.queryModelBySlug( | ||
| modelId, | ||
| userJwt.company.id |
Comment on lines
+422
to
+425
| const model = await ModelsRepository.queryModelBySlug( | ||
| modelId, | ||
| userJwt.company.id | ||
| ); |
Comment on lines
+472
to
+475
| const model = await ModelsRepository.queryModelBySlug( | ||
| modelId, | ||
| userJwt.company.id | ||
| ); |
Comment on lines
+533
to
+536
| const model = await ModelsRepository.queryModelBySlug( | ||
| modelId, | ||
| userJwt.company.id | ||
| ); |
| "db:generate": "bunx --bun drizzle-kit generate", | ||
| "db:studio": "bunx --bun drizzle-kit studio", | ||
| "db:migrate": "tsx src/migrate.ts", | ||
| "db:seed": "bun src/seed.ts", |
| @@ -0,0 +1 @@ | |||
| ALTER TABLE `models` ADD FULLTEXT INDEX `models_fulltext_idx` (`name`, `models_text`, `chipset`, `cpu`, `internal_memory`, `os`); | |||
Comment on lines
+296
to
+303
| static async attachPresignedUrlsToImages( | ||
| images: ModelImageSelect[] | ||
| ): Promise<(ModelImageSelect & { presignedUrl: string })[]> { | ||
| return await Promise.all( | ||
| images.map(async (img) => { | ||
| const r2Key = img.r2Key as string; | ||
| const presignedUrl = await generatePresignedGetUrl(r2Key); | ||
| return { ...img, presignedUrl }; |
| description: ` | ||
| **Creates a model image record, linking an uploaded file to a device model.** | ||
|
|
||
| Provide the \`r2Key\` (and optional \`originalUrl\`) returned from the presign upload endpoint. Returns the created model image with a presigned URL. |
Comment on lines
+83
to
+86
| slugCompanyUnique: unique("slug_company_unique").on( | ||
| table.slug, | ||
| table.companyId | ||
| ), |
Sofia-Freitas54
left a comment
Collaborator
There was a problem hiding this comment.
showw, bem completinho. Só dá uma olhada no que o copilot sugeriu em alguns commits, ver se eh valido ou nao. No mais tá otimo
Member
Author
|
Related #50 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.