fix types and default placeholder values

This commit is contained in:
neil 2022-10-20 08:53:27 +08:00
parent 201fc97544
commit c547eafe19
3 changed files with 66 additions and 65 deletions

View file

@ -6,7 +6,7 @@ import type { AirtablePackage } from './types';
const airtablePackagesBase = base(process.env.AIRTABLE_PACKAGES_BASE);
export const getAllAirtablePackages = async () : Promise<AirtablePackage[]> => {
export const getAllAirtablePackages = async (): Promise<AirtablePackage[]> => {
const allRecords = await airtablePackagesBase('packages')
.select({
maxRecords: 100,
@ -25,6 +25,7 @@ export const getAllAirtablePackages = async () : Promise<AirtablePackage[]> => {
'last_modified',
'full_name',
]),
maintainer: record.fields?.maintainer || '',
desc: record.fields?.description || '',
thumb_image_url: _.get(record.fields, 'thumb_image[0].url', '/Images/package-thumb-nolabel3.jpg')
} as AirtablePackage;

View file

@ -1,6 +1,6 @@
import S3 from 'aws-sdk/clients/s3';
import { compareVersions, validate } from 'compare-versions';
import _ from 'lodash';
import type { S3Package } from './types';
const Bucket = process.env.AWS_DIST_BUCKET;