-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #549 from commons-stack/enh/custom_export_formats
Custom export format
- Loading branch information
Showing
39 changed files
with
1,364 additions
and
353 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["ms-vsliveshare.vsliveshare"] | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...s/api/src/database/migrations/19_settings_add_custom_export_context_support_percentage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { SettingGroup } from '@/settings/types'; | ||
import { SettingsModel } from '../../settings/entities'; | ||
|
||
const settings = [ | ||
{ | ||
key: 'CUSTOM_EXPORT_MAP', | ||
value: | ||
'https://raw.githubusercontent.com/commons-stack/praise-exports/main/aragon-fixed-budget.json', | ||
type: 'String', | ||
label: 'Transformation map', | ||
description: | ||
'The transformation map describes the transform to be performed. See documentation for details on how to create a transformation map.', | ||
group: SettingGroup.CUSTOM_EXPORT, | ||
}, | ||
{ | ||
key: 'CUSTOM_EXPORT_CONTEXT', | ||
value: '{ "budget": 100, "token": "TOKEN_NAME" } ', | ||
type: 'JSON', | ||
label: 'Export context', | ||
description: | ||
'Default values for the export context used by the transformation map.', | ||
group: SettingGroup.CUSTOM_EXPORT, | ||
}, | ||
{ | ||
key: 'CUSTOM_EXPORT_FORMAT', | ||
value: 'csv', | ||
type: 'Radio', | ||
label: 'Export format', | ||
description: '', | ||
options: '["csv", "json"]', | ||
group: SettingGroup.CUSTOM_EXPORT, | ||
}, | ||
{ | ||
key: 'CS_SUPPORT_PERCENTAGE', | ||
value: 2, | ||
type: 'Integer', | ||
label: 'Praise development support percentage', | ||
description: | ||
'Support the development of Praise, consider donating a percentage of the distribution to the development team.', | ||
group: SettingGroup.CUSTOM_EXPORT, | ||
}, | ||
]; | ||
|
||
const up = async (): Promise<void> => { | ||
const settingUpdates = settings.map((s) => ({ | ||
updateOne: { | ||
filter: { key: s.key }, | ||
|
||
// Insert setting if not found, otherwise continue | ||
update: { $setOnInsert: { ...s } }, | ||
upsert: true, | ||
}, | ||
})); | ||
|
||
await SettingsModel.bulkWrite(settingUpdates); | ||
}; | ||
|
||
const down = async (): Promise<void> => { | ||
const allKeys = settings.map((s) => s.key); | ||
await SettingsModel.deleteMany({ key: { $in: allKeys } }); | ||
}; | ||
|
||
export { up, down }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.