mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-18 02:21:47 -05:00
Extracted members csv input serialization logic into separate module
refs 772ec13ac49a1d80877bb7b0f90ad57899f868dd - This is prep work for extraction into members repository.
This commit is contained in:
parent
c5c20d5efb
commit
08600f05c7
1 changed files with 36 additions and 0 deletions
36
ghost/members-csv/parse
Normal file
36
ghost/members-csv/parse
Normal file
|
@ -0,0 +1,36 @@
|
|||
const fsLib = require('../../../../../../lib/fs');
|
||||
|
||||
const parse = async (filePath) => {
|
||||
const columnsToExtract = [{
|
||||
name: 'email',
|
||||
lookup: /^email/i
|
||||
}, {
|
||||
name: 'name',
|
||||
lookup: /name/i
|
||||
}, {
|
||||
name: 'note',
|
||||
lookup: /note/i
|
||||
}, {
|
||||
name: 'subscribed_to_emails',
|
||||
lookup: /subscribed_to_emails/i
|
||||
}, {
|
||||
name: 'stripe_customer_id',
|
||||
lookup: /stripe_customer_id/i
|
||||
}, {
|
||||
name: 'complimentary_plan',
|
||||
lookup: /complimentary_plan/i
|
||||
}, {
|
||||
name: 'labels',
|
||||
lookup: /labels/i
|
||||
}, {
|
||||
name: 'created_at',
|
||||
lookup: /created_at/i
|
||||
}];
|
||||
|
||||
return await fsLib.readCSV({
|
||||
path: filePath,
|
||||
columnsToExtract: columnsToExtract
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.parse = parse;
|
Loading…
Add table
Reference in a new issue