Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first commit #1

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
46 changes: 42 additions & 4 deletions app.js
@@ -1,11 +1,49 @@
var Airtable = require('airtable');
var base = new Airtable({apiKey: 'keyFnJVLRulHJdaGT'}).base('app6X50jM1Bwgl2Bb');
// these can be see on the https://airtable.com/account and the
var base = new Airtable({apiKey: 'keyFnJVLRulHJdaGT'}).base('app7DTllmZGd7QoA1');

const table = base('Tasks');
const table = base('Tasks')

const getRecords = async () => {
const records = await table.select({maxRecords:3,view:'All tasks'}).firstPage();
const records = await table.select({
view: 'Grid tasks view'
}).firstPage();
console.log(records);
}

getRecords()
getRecords()


const createRecord = async (fields) => {
const createRecord = await table.create(fields)
console.log(minifyRecord(createRecord))
}

const minifyRecord = async (record) => {
return {
id: record.id,
Task: record.fields.Task,
Notes: record.fields.Notes,
Status: record.fields.Status,
Created: record.fields.Created,
Ended: record.fields.Ended,
EndDate: record.fields.EndDate // do not use field name like this: "End Date"
}
}

createRecord (
{
"Task": "another test",
"Notes": "this is a javascript test create!",
"Status": "Done",
"Created": "2022-05-15",
"Ended": "No",
"EndDate": "2022-05-16" // do not use field name like this: "End Date"
})

const getRecordsById = async (id) => {
const record = await table.find(id)
console.log("Get one record : ", record)
}

getRecordsById('reclv2DImx3CFFBWr');