A user should be able to:
- Do CRUD actions for folders, subfolders and files
- Search files by their exact name within a parent folder or across all folders List the top 10 files that start with a search string. This will be used in the search box to show possible matches when the user is typing. Only “start with” logic is required.
$ npm install
# run local db (make sure that your local Docker is up and running)
$ cd docker && docker-compose up && cd -
# prepare the env values (preffered way is to create a file in root .env with the content taken from .env.example file)
$ cp .env.example .env
# deploy database migrations
$ npm run migrations:run
# development
$ npm run start
# development with a watcher
$ npm run start:dev
# production mode
$ npm run start:prod
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
Folder API
http://localhost:3000/api/folder
File API
http://localhost:3000/api/file
Assumption is that the API is running on
http://localhost/3000
curl --location --request GET 'http://localhost:3000/healthz'
curl --location --request POST 'http://localhost:3000/folder' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Folder Name"
}'
CRUD operations are available for the
/folder
endpoint (POST, GET, PUT, DELETE)
curl --location --request GET 'http://localhost:3000/folder/find?parentFolderId=2fc85585-a1f7-4138-b867-fd70c0234433&name=Folder Name'
curl --location --request POST 'http://localhost:3000/file' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "File",
"parentFolderId": "d0b16064-db18-4969-8a12-433d25a6ce14",
"content": "this is the content of a file"
}'
CRUD operations are available for the
/file
endpoint (POST, GET, PUT, DELETE)
curl --location --request GET 'http://localhost:3000/file/find?name=File&parentFolderId=f4b958c2-d0ab-4db2-a0dd-fb920a14b3c5&limit=2'
curl --location --request GET 'http://localhost:3000/file/find/starts-with/?parentFolderId=8e691f14-1f80-4262-8071-db4847ae082d&name=Fi'