mirror of
https://github.com/System-End/scraps.git
synced 2026-04-19 22:05:09 +00:00
Update airtable-sync.ts
This commit is contained in:
parent
b5d4798dcb
commit
d7c6483e3a
1 changed files with 11 additions and 13 deletions
|
|
@ -269,6 +269,7 @@ async function syncProjectsToAirtable(): Promise<void> {
|
|||
|
||||
const firstName = userIdentity?.given_name || (project.username || '').split(' ')[0] || ''
|
||||
const lastName = userIdentity?.family_name || (project.username || '').split(' ').slice(1).join(' ') || ''
|
||||
const fullName = `${firstName} ${lastName}`.trim()
|
||||
|
||||
const descriptionParts = [project.description || '']
|
||||
if (project.updateDescription) {
|
||||
|
|
@ -282,8 +283,7 @@ async function syncProjectsToAirtable(): Promise<void> {
|
|||
'Code URL': project.githubUrl,
|
||||
'Description': descriptionParts.join('\n'),
|
||||
'Email': project.email || '',
|
||||
'First Name': firstName,
|
||||
'Last Name': lastName,
|
||||
'Loops - Special - setFullName': fullName,
|
||||
'GitHub Username': project.username || '',
|
||||
'How can we improve?': project.feedbackImprove || '',
|
||||
'How did you hear about this?': project.feedbackSource || '',
|
||||
|
|
@ -299,22 +299,20 @@ async function syncProjectsToAirtable(): Promise<void> {
|
|||
'Screenshot': [{ url: project.image }] as any,
|
||||
}
|
||||
|
||||
// Add address fields from userinfo
|
||||
// Add full address from userinfo
|
||||
if (userIdentity?.address) {
|
||||
if (userIdentity.address.street_address) {
|
||||
const lines = userIdentity.address.street_address.split('\n')
|
||||
if (lines[0]) fields['Address (Line 1)'] = lines[0]
|
||||
if (lines[1]) fields['Address (Line 2)'] = lines[1]
|
||||
}
|
||||
if (userIdentity.address.locality) fields['City'] = userIdentity.address.locality
|
||||
if (userIdentity.address.region) fields['State / Province'] = userIdentity.address.region
|
||||
if (userIdentity.address.postal_code) fields['ZIP / Postal Code'] = userIdentity.address.postal_code
|
||||
if (userIdentity.address.country) fields['Country'] = userIdentity.address.country
|
||||
const parts: string[] = []
|
||||
if (userIdentity.address.street_address) parts.push(userIdentity.address.street_address)
|
||||
if (userIdentity.address.locality) parts.push(userIdentity.address.locality)
|
||||
if (userIdentity.address.region) parts.push(userIdentity.address.region)
|
||||
if (userIdentity.address.postal_code) parts.push(userIdentity.address.postal_code)
|
||||
if (userIdentity.address.country) parts.push(userIdentity.address.country)
|
||||
if (parts.length > 0) fields['Loops - Special - setFullAddress'] = parts.join(', ')
|
||||
}
|
||||
|
||||
// Add birthday from identity
|
||||
if (userIdentity?.birthdate) {
|
||||
fields['Birthday'] = userIdentity.birthdate
|
||||
fields['Loops - birthday'] = userIdentity.birthdate
|
||||
}
|
||||
|
||||
const existingId = existingRecords.get(project.githubUrl)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue