1
+ import * as dotenv from 'dotenv'
1
2
import Airtable , { Record , FieldSet } from 'airtable'
2
3
import { Organization } from 'types/org'
3
4
import { Job } from 'types/job'
@@ -13,6 +14,9 @@ import {
13
14
} from './jobs/index'
14
15
import { defaultSlugify , isEmail } from 'utils/helpers'
15
16
import { getJobTags } from 'utils/jobs'
17
+ import { SITE_URL } from 'utils/constants'
18
+
19
+ dotenv . config ( )
16
20
17
21
if ( ! process . env . AIRTABLE_API_KEY || ! process . env . AIRTABLE_API_KEY ) {
18
22
throw new Error ( 'Airtable API Base or Key not set.' )
@@ -168,14 +172,17 @@ export function toOrganization(source: Record<FieldSet>): Organization {
168
172
recordId : source . fields [ 'recordId' ] ,
169
173
} as Organization
170
174
171
- if ( source . fields [ 'logo' ] && Array . isArray ( source . fields [ 'logo' ] ) && ( source . fields [ 'logo' ] as any [ ] ) . length > 0 ) {
172
- org . logo = ( source . fields [ 'logo' ] as any [ ] ) [ 0 ] . url
173
- }
175
+ // Remove Logo from Airtable/attachments
176
+ // if (source.fields['logo'] && Array.isArray(source.fields['logo']) && (source.fields['logo'] as any[]).length > 0) {
177
+ // org.logo = (source.fields['logo'] as any[])[0].url
178
+ // }
174
179
if ( source . fields [ 'website' ] ) {
175
180
org . website = ( source . fields [ 'website' ] as string ) ?? ''
176
181
}
177
182
if ( source . fields [ 'twitter' ] ) {
178
- org . twitter = ( source . fields [ 'twitter' ] as string ) ?? ''
183
+ const handle = ( source . fields [ 'twitter' ] as string ) ?? ''
184
+ org . twitter = handle
185
+ org . logo = `${ SITE_URL } assets/orgs/${ handle . replace ( '@' , '' ) } .png`
179
186
}
180
187
if ( source . fields [ 'github' ] ) {
181
188
org . github = ( source . fields [ 'github' ] as string ) ?? ''
0 commit comments