mirror of
https://github.com/ivabus/www
synced 2024-11-22 15:25:06 +03:00
include dl_count to packages.json
This commit is contained in:
parent
2ea0c95814
commit
65d2c350da
2 changed files with 3 additions and 28 deletions
|
@ -24,40 +24,13 @@ export const getAllAirtablePackages = async (): Promise<AirtablePackage[]> => {
|
|||
'version',
|
||||
'last_modified',
|
||||
'full_name',
|
||||
'dl_count',
|
||||
]),
|
||||
maintainer: record.fields?.maintainer || '',
|
||||
desc: record.fields?.desc || '',
|
||||
thumb_image_url: _.get(record.fields, 'thumb_image[0].url', '/Images/package-thumb-nolabel3.jpg')
|
||||
} as AirtablePackage;
|
||||
});
|
||||
/**
|
||||
* // SAMPLE RECORD SHAPE w/ thumb_image is uploaded
|
||||
{
|
||||
slug: 'unicode_org',
|
||||
name: 'unicode.org',
|
||||
full_name: 'unicode.org',
|
||||
homepage: 'https://unicode.org',
|
||||
version: '71.1.1',
|
||||
last_modified: '2022-09-26T19:46:25.000Z',
|
||||
thumb_image: [
|
||||
{
|
||||
id: 'attQVgaRUXOYinsWy',
|
||||
width: 640,
|
||||
height: 534,
|
||||
url: 'https://dl.airtable.com/.attachments/f2465c36a0060919368e2f53305694f9/cfab76a8/gen-art-1.png',
|
||||
filename: 'gen-art-1.png',
|
||||
size: 184878,
|
||||
type: 'image/png',
|
||||
thumbnails: [Object]
|
||||
}
|
||||
]
|
||||
}
|
||||
TODO IMAGE UPLOAD to S3/CDN:
|
||||
if thumb_image_url is empty
|
||||
get thumb_image data
|
||||
upload to s3
|
||||
update thumb_image_url in airtable
|
||||
*/
|
||||
return packages;
|
||||
}
|
||||
|
||||
|
@ -73,6 +46,7 @@ export const insertPackagesToAirtable = async (newPackages: Partial<AirtablePack
|
|||
fields: {
|
||||
...fields,
|
||||
last_modified: fields.last_modified.toString(),
|
||||
dl_count: 0,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -13,6 +13,7 @@ export type AirtablePackage = S3Package & {
|
|||
airtable_record_id: string,
|
||||
thumb_image_url: string,
|
||||
desc: string,
|
||||
dl_count: number,
|
||||
}
|
||||
|
||||
export type Package = Omit<AirtablePackage, 'airtable_record_id'> & {
|
||||
|
|
Loading…
Reference in a new issue