-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* [feat] Add csv into deps * [fix] Fix db env getting * [feat] Add express formidable into deps * [feat] Add migrations for change FilledProperty fields: name, data * [feat] Change max len for data field * [feat] Add custom component for csv import action * [fix] Delete name field from destruction * [feat] Add csv import endpoint * Добавляет скоупы, фиксит баги в авторизации (#10) * [ref] Add scopes, fix auth errors * [fix] Make date property nullable * SOROKA-82: добавляет утилиту для пагинации и пагинацию для эндпоинта с карточками (#16) * [feat] Add pagination on cards Co-authored-by: David Dobryakov <[email protected]>
- Loading branch information
Showing
19 changed files
with
472 additions
and
32 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 |
---|---|---|
@@ -1 +1,3 @@ | ||
AdminJS.UserComponents = {} | ||
import Component1 from '../src/admin/components/import-action-component' | ||
AdminJS.UserComponents.Component1 = Component1 |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,44 @@ | ||
import React from 'react' | ||
|
||
const ImportAction = () => { | ||
async function submitForm(form) { | ||
const formData = new FormData(form) | ||
|
||
const response = await fetch( | ||
'/v1/admin/import-csv', | ||
{ | ||
method: 'POST', | ||
body: formData | ||
} | ||
) | ||
|
||
if (response.status === 200) { | ||
form.reset() | ||
|
||
alert('Импорт завершён') | ||
} | ||
} | ||
|
||
return ( | ||
<form | ||
style={{display: "flex", flexDirection: "column"}} | ||
onSubmit={(event) => { | ||
event.preventDefault() | ||
submitForm(event.target) | ||
}} | ||
> | ||
<label style={{fontSize: "1.5rem"}} htmlFor="csvFile"> | ||
Choose CSV: | ||
</label> | ||
<input style={{marginTop: "1.5rem"}} name="csvFile" type="file" id="csvFile" /> | ||
<button | ||
style={{marginTop: "1.5rem", maxWidth: "25%"}} | ||
type="submit" | ||
> | ||
Отправить | ||
</button> | ||
</form> | ||
) | ||
} | ||
|
||
export default ImportAction |
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
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
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
14 changes: 14 additions & 0 deletions
14
src/migrations/20220620145536-filled-property-delete-field-name.js
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,14 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
async up (queryInterface, Sequelize) { | ||
await queryInterface.removeColumn('FilledProperties', 'name') | ||
}, | ||
|
||
async down (queryInterface, Sequelize) { | ||
await queryInterface.addColumn('FilledProperties', 'name', { | ||
type: Sequelize.STRING, | ||
allowNull: false | ||
}) | ||
} | ||
}; |
Oops, something went wrong.