Skip to content

Commit

Permalink
Merge pull request #11 from noahrav/rest-api
Browse files Browse the repository at this point in the history
Backend Rest API
  • Loading branch information
noahrav authored Dec 30, 2023
2 parents 20ce7f2 + 621c496 commit 6998ae3
Show file tree
Hide file tree
Showing 12 changed files with 1,044 additions and 56 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ _deps

.idea/
build/
cmake-build-debug/
cmake-build-debug/
cmake-build-debug-wsl/
12 changes: 9 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ add_subdirectory(deps)
set(CMAKE_CXX_STANDARD 20)

set(PROJECT_SOURCES
src/api/api.cpp src/api/api.h
src/cu_submitter.cpp
src/chgen/chgen.cpp src/chgen/chgen.h
src/data/changelog.cpp src/data/changelog.h
Expand All @@ -14,11 +15,16 @@ set(PROJECT_SOURCES
src/utils/print.cpp src/utils/print.h
src/transfer/transfer.cpp src/transfer/transfer.h
src/utils/utils.cpp src/utils/utils.h
src/submit/submit.cpp src/submit/submit.h)
src/submit/submit.cpp src/submit/submit.h
)

include_directories(${CMAKE_BINARY_DIR}/_deps/rapidjson-src/include)

add_executable(cu_submitter
${PROJECT_SOURCES})
${PROJECT_SOURCES}
)

target_link_libraries(cu_submitter
lcf
pistache)
pistache
)
13 changes: 13 additions & 0 deletions PROTOCOL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
API Protocol
========

| Endpoint URL | Request type | Request data type | Response data type | Description |
|---------------------|--------------|-------------------|---------------------|----------------------------------------------------------------------------|
| / | GET | | string | Check if server is up |
| /chgen | POST | JSON | JSON | Scan builds for changes, returns changelog and exports it into a text file |
| /transfer | POST | JSON | JSON | Scan builds for transfer changelog, returns changelog |
| /transfer/confirm | POST | JSON | string | Executes transfer based on last scanned transfer changelog |
| /transfer/changelog | GET | | JSON | Returns last scanned transfer changelog |
| /submit | POST | JSON | JSON | Scan builds for submit changelog, returns changelog |
| /submit/confirm | GET | JSON | string | Executes submit based on last scanned submission changelog |
| /submit/changelog | GET | | JSON | Returns last scanned submit changelog |
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# CU Submitter
CU Submitter
========

A small application designed to help Collective Unconscious developers submit their updates

# Install required librairies
# Requirements
Cmake > 3.14

# Build
# Build instructions
```
cd
git clone https://github.com/noahrav/cu_submitter.git
Expand All @@ -19,6 +21,7 @@ The executable is build/cu_submitter
## CLI

./cu_submitter --help | --usage : prints the usage\
./cu_submitter [-p <server_port>] : opens backend server on specific port; 3000 by default\
./cu_submitter --chgen <base_path> <modified_path> : generates a changelog text file\
./cu_submitter --transfer <unmodified_copy_path> <modified_copy_path> <destination_path> : transfers the modified files to the destination path\
./cu_submitter --submit <unmodified_copy_path> <modified_copy_path> [<archive_path>] : copy the modified files to a submission archive
./cu_submitter --submit <unmodified_copy_path> <modified_copy_path> [<archive_path>] : copy the modified files to a submission folder
10 changes: 8 additions & 2 deletions deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ include(FetchContent)

set(LIBLCF_VERSION 0.8)
set(PISTACHE_VERSION 0.0.5)
set(RAPIDJSON_VERSION 1.1.0)

find_package(liblcf)

Expand All @@ -15,8 +16,6 @@ if (NOT liblcf_FOUND)
FetchContent_MakeAvailable(liblcf)
endif()

#find_package(pistache)

if (NOT pistache_FOUND)
FetchContent_Declare(
pistache
Expand All @@ -25,3 +24,10 @@ if (NOT pistache_FOUND)

FetchContent_MakeAvailable(pistache)
endif()

FetchContent_Declare(
rapidjson
URL "https://github.com/Tencent/rapidjson/archive/v${RAPIDJSON_VERSION}.zip"
)

FetchContent_MakeAvailable(rapidjson)
Loading

0 comments on commit 6998ae3

Please sign in to comment.