Skip to content
Merged

Dev #240

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
f39292f
Dynamic port after checking default port
amJohnnyma Sep 9, 2025
86807b8
Write port to env with execution command
amJohnnyma Sep 9, 2025
fe9c320
Remove unused os import
amJohnnyma Sep 9, 2025
85f3599
Restore original makefile from dev
amJohnnyma Sep 9, 2025
f8523d9
Merge pull request #197 from COS301-SE-2025/python-hotfix-dynamic-ports
phillDup Sep 9, 2025
06ac18c
Can now pass weights as an argument to alter the clustering behaviour
amJohnnyma Sep 11, 2025
15539d5
Added gracefull server stopping and server looks for secret before st…
phillDup Sep 12, 2025
0f903d1
Request handler checks for valid server secret
phillDup Sep 12, 2025
1ce486b
Added testing for incorrect secret
phillDup Sep 12, 2025
956a4ae
Fixed storage after moving files
NicohaasHerhaasus Sep 15, 2025
09b8d69
Added nil checks to save composite
NicohaasHerhaasus Sep 15, 2025
6e86b7a
Updated cleanprefix to not get rid of leading slash
NicohaasHerhaasus Sep 15, 2025
ad8d838
Updated testing for move directory
NicohaasHerhaasus Sep 15, 2025
1ba4d7c
Added go_coverage command to makefile
NicohaasHerhaasus Sep 15, 2025
5e409e7
Merge pull request #200 from COS301-SE-2025/python-feature-security
phillDup Sep 15, 2025
7de26ee
Modified create_folder_name to take case into account
phillDup Sep 15, 2025
dcaa3c6
Updated request to take naming into account as param. Cleanup and tes…
phillDup Sep 15, 2025
5d91242
Clean up
phillDup Sep 16, 2025
2b6c075
Merge pull request #203 from COS301-SE-2025/python-feature-folder-nam…
amJohnnyma Sep 16, 2025
8c2e947
Added filename weighting
amJohnnyma Sep 17, 2025
fd3b805
Update bias + master uses weight input
amJohnnyma Sep 17, 2025
3b22989
Folder name creation uses file names weights aswell
amJohnnyma Sep 17, 2025
b3cd564
Extra testing files
amJohnnyma Sep 17, 2025
f49524f
Merge pull request #202 from COS301-SE-2025/go-hotfix-storage-after-m…
Jack-jack1 Sep 17, 2025
4a7317c
Added separate test for research papers
phillDup Sep 22, 2025
b3f581f
Basic demo4 documentation setup & updated grpc.md
phillDup Sep 22, 2025
2a0b63a
includes preferred case on sort
Jack-jack1 Sep 22, 2025
3b30776
fixed spelling of preferred case
Jack-jack1 Sep 22, 2025
e40763c
fixed spelling of preferredCase
Jack-jack1 Sep 22, 2025
d4fbceb
Merge branch 'go-feature-folder-name-covention' into dev
Jack-jack1 Sep 22, 2025
7077448
Merge pull request #208 from COS301-SE-2025/dev
Jack-jack1 Sep 22, 2025
65032e2
go mod tidy run
Jack-jack1 Sep 22, 2025
c3cd5cf
include preferred case on grpc calls
Jack-jack1 Sep 22, 2025
06acc1c
fixed preferred spelling
Jack-jack1 Sep 22, 2025
6af4013
removed testing search code
Jack-jack1 Sep 22, 2025
40945ff
saves from api successfully
Jack-jack1 Sep 22, 2025
8c322f9
api route for saving preferred case
Jack-jack1 Sep 22, 2025
d108e2f
added isPthCOntained function to check if one path is contained in an…
NicohaasHerhaasus Sep 22, 2025
79a5dcd
Added check directory Conflicts to check every composite for a conta…
NicohaasHerhaasus Sep 22, 2025
f675a76
Updated addCompostie handler to reflect changes to directory checking
NicohaasHerhaasus Sep 22, 2025
d59aad4
updated server _test to have a higher testing coverage and test new n…
NicohaasHerhaasus Sep 22, 2025
15de20f
Merge branch 'dev' into python-feature-weighted-vector
phillDup Sep 23, 2025
0fafb68
Merge pull request #198 from COS301-SE-2025/python-feature-weighted-v…
phillDup Sep 23, 2025
e13d6c3
Added missing imports
phillDup Sep 23, 2025
4c02aff
Fixed what broke during merge
phillDup Sep 23, 2025
9178a10
Folder name applies case convention to keywords before combining them
phillDup Sep 23, 2025
fecd065
Merge pull request #210 from COS301-SE-2025/python-hotfix-naming
phillDup Sep 23, 2025
23749b4
reads case from sort req
Jack-jack1 Sep 23, 2025
e5d1207
Added non functional scalability test for clustering
phillDup Sep 23, 2025
f656567
tessting endpoint code
Jack-jack1 Sep 23, 2025
d6b689b
reads and sends secret
Jack-jack1 Sep 23, 2025
722c28d
uses user enviroment secren on grpc reqs
Jack-jack1 Sep 23, 2025
49a85ed
new crypto and shared prefrences dependencies
TiaanBosman101 Sep 23, 2025
a0cfd9e
new auth wrapper for login/registration
TiaanBosman101 Sep 23, 2025
a8b6685
new security secrets
TiaanBosman101 Sep 23, 2025
41edbaf
settings service (cases and colours)
TiaanBosman101 Sep 23, 2025
933a47a
support for colour changes in graph view
TiaanBosman101 Sep 23, 2025
b474bea
new wrapper for security
TiaanBosman101 Sep 23, 2025
103128a
new password dialogs
TiaanBosman101 Sep 23, 2025
8633bb4
remove login button
TiaanBosman101 Sep 23, 2025
f1e1edb
password service
TiaanBosman101 Sep 23, 2025
a60fb00
setting page with new settings
TiaanBosman101 Sep 23, 2025
50fa6c3
include new case param
Jack-jack1 Sep 23, 2025
a88f92d
logic for new case api parameter
Jack-jack1 Sep 23, 2025
76902cb
includes case parameter on grpc req
Jack-jack1 Sep 23, 2025
9bef647
now returns api error and stops execution of sort
Jack-jack1 Sep 23, 2025
ba0dd82
simple tests for case param
Jack-jack1 Sep 23, 2025
8794bc2
removed old global caseParam variable
Jack-jack1 Sep 23, 2025
1d19351
Merge branch 'dev' into go-feature-folder-name-covention
Jack-jack1 Sep 23, 2025
d6ab880
Merge pull request #215 from COS301-SE-2025/go-feature-grpc-secret
NicohaasHerhaasus Sep 23, 2025
18c0adf
Merge branch 'dev' into go-feature-folder-name-covention
NicohaasHerhaasus Sep 23, 2025
1ffb0cc
logic for middleware
Jack-jack1 Sep 23, 2025
da9c34b
Merge pull request #216 from COS301-SE-2025/go-feature-folder-name-co…
Jack-jack1 Sep 23, 2025
9d2dca4
removed secret print
Jack-jack1 Sep 23, 2025
b21e0bf
Merge branch 'dev' into app-feature-settings2
TiaanBosman101 Sep 24, 2025
17a1be4
Merge pull request #221 from COS301-SE-2025/app-feature-settings2
TiaanBosman101 Sep 24, 2025
362efe6
integrated sorting parameter
TiaanBosman101 Sep 24, 2025
fdd705d
Merge pull request #222 from COS301-SE-2025/app-integration-new-features
TiaanBosman101 Sep 24, 2025
d3d0bcb
Removed useless tests
NicohaasHerhaasus Sep 25, 2025
a8a3d20
Removed OK occurence
NicohaasHerhaasus Sep 25, 2025
eb1e7ef
Merge pull request #217 from COS301-SE-2025/go-feature-file-system-mo…
Jack-jack1 Sep 25, 2025
5f08bcd
~ inclusion
NicohaasHerhaasus Sep 25, 2025
530c5d7
prints out directory sent to python
Jack-jack1 Sep 25, 2025
f9d472b
Fixed misplaced break
NicohaasHerhaasus Sep 25, 2025
43cf61f
Merge pull request #224 from COS301-SE-2025/go-hotfix-locking
TiaanBosman101 Sep 25, 2025
af20d13
Added savePortToEnv updates or creates the GO_PORT entry in server.env
NicohaasHerhaasus Sep 25, 2025
143313e
Added findAvailablePort finds an available port starting from a base …
NicohaasHerhaasus Sep 25, 2025
4e210a0
Updated handler to serve new port
NicohaasHerhaasus Sep 25, 2025
ef0afad
Added support for SPACE case
phillDup Sep 25, 2025
9eb7a6b
updated python connection to use dynamic port
NicohaasHerhaasus Sep 25, 2025
485143f
Merge pull request #225 from COS301-SE-2025/python-folder-naming-spac…
phillDup Sep 25, 2025
36bda94
Added dynamic port searching on gRPC side
NicohaasHerhaasus Sep 25, 2025
78b0253
Added performance testing for keywords.
phillDup Sep 25, 2025
b36b97f
Merge pull request #226 from COS301-SE-2025/go-dynamic-ports
NicohaasHerhaasus Sep 25, 2025
b3868d4
Merge pull request #228 from COS301-SE-2025/go-feature-apiSecret
TiaanBosman101 Sep 25, 2025
4221b2d
added support for space case
Jack-jack1 Sep 25, 2025
18b9e5f
updated security details
Jack-jack1 Sep 25, 2025
31b0be5
added server secret implementation
TiaanBosman101 Sep 25, 2025
4249034
made the colours change for folder view as well
TiaanBosman101 Sep 25, 2025
b328e25
added stuff for manager inside manager
TiaanBosman101 Sep 25, 2025
a2be868
Merge pull request #231 from COS301-SE-2025/app-integration-server-se…
TiaanBosman101 Sep 25, 2025
cd893a0
Merge pull request #230 from COS301-SE-2025/go-spaceCase-support
TiaanBosman101 Sep 25, 2025
8cb6125
dynamic ports added and new case
TiaanBosman101 Sep 26, 2025
572b73c
updated some landing page features
TiaanBosman101 Sep 26, 2025
1080880
Updated overlapping return
NicohaasHerhaasus Sep 26, 2025
6d9587d
Started report on tests
phillDup Sep 26, 2025
702b6c6
Added results
phillDup Sep 26, 2025
cdd680e
incorperated max distance checks
Jack-jack1 Sep 26, 2025
7b63c47
Updated versions
phillDup Sep 26, 2025
bad71cc
improved search matching
Jack-jack1 Sep 26, 2025
23f0311
sort is now deterministic
Jack-jack1 Sep 26, 2025
830a25a
Started Testing policy
phillDup Sep 26, 2025
eec4874
Merge branch 'dev' into python-testing-non-functional-tests
phillDup Sep 26, 2025
e6a26c1
Merge pull request #227 from COS301-SE-2025/python-testing-non-functi…
phillDup Sep 26, 2025
9ad7286
manager detection works for windows
TiaanBosman101 Sep 26, 2025
721541a
updated landing page
TiaanBosman101 Sep 26, 2025
c49d160
Merge pull request #232 from COS301-SE-2025/app-feature-new-case
NicohaasHerhaasus Sep 26, 2025
79c0a27
Merge pull request #233 from COS301-SE-2025/dev
Jack-jack1 Sep 26, 2025
0f4c8ad
dynamic term matching
Jack-jack1 Sep 26, 2025
7cb99cc
cleaned up prints
Jack-jack1 Sep 26, 2025
364ec84
Merge pull request #234 from COS301-SE-2025/go-order-search-results
NicohaasHerhaasus Sep 27, 2025
55265b3
Testing policy stuff
phillDup Sep 27, 2025
8e41df4
Updated architecture diagram to separate the UI based on demo3 feedback
phillDup Sep 27, 2025
a37ac0f
fixed tests
Jack-jack1 Sep 27, 2025
5937c6d
includes all test folders for testing and coverage
Jack-jack1 Sep 27, 2025
e1c7a17
outputs coverage total to cmd
Jack-jack1 Sep 27, 2025
92e1e78
working new tests
Jack-jack1 Sep 27, 2025
c23acb1
removed unused code
Jack-jack1 Sep 27, 2025
78ef9bd
cmmented unused code
Jack-jack1 Sep 27, 2025
baef010
formatted
Jack-jack1 Sep 27, 2025
ec4360c
test coverage improvement
Jack-jack1 Sep 27, 2025
3d813e4
cleaned up prints
Jack-jack1 Sep 27, 2025
154a406
removed unused print function
Jack-jack1 Sep 27, 2025
6c54f7b
Started reliability test
phillDup Sep 27, 2025
b0e2ec6
Added reliability test
phillDup Sep 27, 2025
3cf5c5c
Added reliability test
phillDup Sep 27, 2025
d675f74
new filepath conversion logic
Jack-jack1 Sep 27, 2025
ab7bf80
fixed path converting and move directory
Jack-jack1 Sep 27, 2025
a645cf8
Merge pull request #235 from COS301-SE-2025/go-hotfix-filepath-conver…
TiaanBosman101 Sep 27, 2025
85ecd35
improved testing coverage
Jack-jack1 Sep 27, 2025
22758d5
added command to see coverage per function
Jack-jack1 Sep 27, 2025
039564b
Merge pull request #236 from COS301-SE-2025/go-hotfix-tests
NicohaasHerhaasus Sep 28, 2025
eabff45
Finished testing_policy
phillDup Sep 28, 2025
f6a43e9
Updated architecture once again...
phillDup Sep 28, 2025
a390b63
Merge branch 'dev' into docs-demo-4
phillDup Sep 28, 2025
7a8a246
Merge pull request #237 from COS301-SE-2025/docs-demo-4
phillDup Sep 28, 2025
cac092e
Merge pull request #238 from COS301-SE-2025/python-non-functional-rel…
phillDup Sep 28, 2025
5e134c5
Updated actions to be able to access env
phillDup Sep 28, 2025
f6c3538
Commented out tests that won't work on pipeline
phillDup Sep 28, 2025
1381ba3
Merge pull request #239 from COS301-SE-2025/cicd-demo-4
phillDup Sep 28, 2025
a8c125f
fixed links for github pages
TiaanBosman101 Sep 28, 2025
77ad816
Merge pull request #241 from COS301-SE-2025/feature-github-pages
phillDup Sep 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ on:
jobs:
test-and-build:
runs-on: ubuntu-latest
env:
SFM_API_SECRET: ${{ secrets.SFM_API_SECRET }}
SFM_SERVER_SECRET: ${{ secrets.SFM_SERVER_SECRET }}

steps:
- name: Checkout repository
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,7 @@ profiling/
# swap files
*.swp

/golang/storage/*
/golang/storage/*

# environment
*.env
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ Smart File Manager (SFM) is a digital housekeeper that uses metadata, natural la

- [Demo 3 Video](https://drive.google.com/file/d/1k8QrDCzxmoQ0MvWkq4EAaTX5V6fvfJ1O/view?usp=sharing)

- [Demo 4 Video]()

## 📑 Documentation

<details>
Expand Down Expand Up @@ -78,6 +80,22 @@ Smart File Manager (SFM) is a digital housekeeper that uses metadata, natural la

</details>

<details>
<summary><strong>📋 Demo 4 Documentation</strong></summary>

🔗 [Functional Requirements Document (SRS)](docs/documentation/demo_4/srs.md) <br>
🔗 [Architectural Specifications](docs/documentation/demo_4/Architecture.md) <br>
🔗 [Wireframe Documentation](docs/documentation/demo_4/wireframe.md) <br>
🔗 [Research Document](docs/documentation/demo_4/researchDoc.md) <br>
🔗 [User Manual](docs/documentation/demo_4/user_manual.md) <br>
🔗 [Coding Standards](docs/documentation/demo_4/coding_standards.md) <br>
🔗 [Technical Installation Manual](docs/documentation/demo_4/technical_installation.md) <br>
🔗 [User Manual](docs/documentation/demo_4/user_manual.md) <br>
🔗 [Testing Policy](docs/documentation/demo_4/testing_policy.md) <br>
🔗 [Non Functional Testing Report](docs/documentation/demo_4/non_functional_tests.md) <br>

</details>

## 📊 Project Board

The GitHub Project boards are used to track current tasks allocated to each team member, facilitating effective communication, progress monitoring, and ensuring we meet project deadlines while maintaining accountability and transparency throughout the development process.
Expand Down
138 changes: 103 additions & 35 deletions app/lib/api.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,61 @@
import 'package:app/models/file_model.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
import 'dart:io';
import 'models/file_tree_node.dart';
import 'models/startup_response.dart';
import 'models/duplicate_model.dart';
import 'models/stats_model.dart';

const uri = "http://localhost:51000";

class Api {
static String get _goApiSecret =>
Platform.environment['SFM_API_SECRET'] ?? '';

static String get _baseUri {
try {
final executableDir = File(Platform.resolvedExecutable).parent;
final envFile = File('${executableDir.path}/server.env');

if (envFile.existsSync()) {
final contents = envFile.readAsStringSync();
final lines = contents.split('\n');
for (final line in lines) {
if (line.trim().startsWith('GO_PORT=')) {
final port = line.split('=')[1].trim();
return "http://localhost:$port";
}
}
}

final currentDir = Directory.current;
final parentEnvFile = File('${currentDir.parent.path}/server.env');

if (parentEnvFile.existsSync()) {
final contents = parentEnvFile.readAsStringSync();
final lines = contents.split('\n');
for (final line in lines) {
if (line.trim().startsWith('GO_PORT=')) {
final port = line.split('=')[1].trim();
return "http://localhost:$port";
}
}
}
} catch (e) {
print('Error reading server.env: $e');
}
return "http://localhost:51000";
}

static Map<String, String> get _headers => {
'Content-Type': 'application/json',
'apiSecret': _goApiSecret,
};
//Call to load tree data
static Future<FileTreeNode> loadTreeData(String name) async {
try {
final response = await http.get(
Uri.parse("$uri/loadTreeData?name=$name"),
Uri.parse("$_baseUri/loadTreeData?name=$name"),
headers: _headers,
);

if (response.statusCode == 200) {
Expand All @@ -33,7 +75,10 @@ class Api {
//Call to initialize app and get existing smart managers
static Future<StartupResponse> startUp() async {
try {
final response = await http.get(Uri.parse("$uri/startUp"));
final response = await http.get(
Uri.parse("$_baseUri/startUp"),
headers: _headers,
);

if (response.statusCode == 200) {
return StartupResponse.fromJson(
Expand All @@ -50,9 +95,17 @@ class Api {
}

//Call To Sort Tree structure
static Future<FileTreeNode> sortManager(String name) async {
static Future<FileTreeNode> sortManager(
String name, {
String? caseType,
}) async {
try {
final response = await http.get(Uri.parse("$uri/sortTree?name=$name"));
String url = "$_baseUri/sortTree?name=$name";
if (caseType != null && caseType.isNotEmpty) {
url += "&case=$caseType";
}

final response = await http.get(Uri.parse(url), headers: _headers);

if (response.statusCode == 200) {
return FileTreeNode.fromJson(
Expand All @@ -72,10 +125,14 @@ class Api {
static Future<bool> addSmartManager(String name, String path) async {
try {
final response = await http.post(
Uri.parse("$uri/addDirectory?name=$name&path=$path"),
Uri.parse("$_baseUri/addDirectory?name=$name&path=$path"),
headers: _headers,
);
if (response.statusCode == 200 || response.statusCode == 201) {
return true;
print(response.body);
final body = response.body.trim();
print(body);
return body == "true";
} else {
throw Exception(
'Failed to add SmartManager: HTTP ${response.statusCode}',
Expand All @@ -92,11 +149,11 @@ class Api {
static Future<bool> deleteSmartManager(String name) async {
try {
final response = await http.post(
Uri.parse("$uri/deleteManager?name=$name"),
Uri.parse("$_baseUri/deleteManager?name=$name"),
headers: _headers,
);

if (response.statusCode == 200 || response.statusCode == 201) {
print(response.body);
return true;
} else {
throw Exception(
Expand All @@ -114,7 +171,8 @@ class Api {
static Future<bool> addTagToFile(String name, String path, String tag) async {
try {
final response = await http.post(
Uri.parse("$uri/addTag?name=$name&path=$path&tag=$tag"),
Uri.parse("$_baseUri/addTag?name=$name&path=$path&tag=$tag"),
headers: _headers,
);

if (response.statusCode == 200 || response.statusCode == 201) {
Expand All @@ -137,7 +195,8 @@ class Api {
) async {
try {
final response = await http.post(
Uri.parse("$uri/removeTag?name=$name&path=$path&tag=$tag"),
Uri.parse("$_baseUri/removeTag?name=$name&path=$path&tag=$tag"),
headers: _headers,
);

if (response.statusCode == 200 || response.statusCode == 201) {
Expand All @@ -156,7 +215,8 @@ class Api {
static Future<bool> locking(String managerName, String path) async {
try {
final response = await http.post(
Uri.parse("$uri/lock?name=$managerName&path=$path"),
Uri.parse("$_baseUri/lock?name=$managerName&path=$path"),
headers: _headers,
);
if (response.statusCode == 200 || response.statusCode == 201) {
return true;
Expand All @@ -175,7 +235,8 @@ class Api {
static Future<bool> unlocking(String managerName, String path) async {
try {
final response = await http.post(
Uri.parse("$uri/unlock?name=$managerName&path=$path"),
Uri.parse("$_baseUri/unlock?name=$managerName&path=$path"),
headers: _headers,
);
if (response.statusCode == 200 || response.statusCode == 201) {
return true;
Expand All @@ -195,7 +256,8 @@ class Api {
static Future<List<DuplicateModel>> loadDuplicates(String name) async {
try {
final response = await http.get(
Uri.parse("$uri/findDuplicateFiles?name=$name"),
Uri.parse("$_baseUri/findDuplicateFiles?name=$name"),
headers: _headers,
);

if (response.statusCode == 200) {
Expand All @@ -221,12 +283,13 @@ class Api {
static Future<FileTreeNode> searchGo(String name, String searchString) async {
try {
final response = await http.get(
Uri.parse("$uri/search?compositeName=$name&searchText=$searchString"),
Uri.parse(
"$_baseUri/search?compositeName=$name&searchText=$searchString",
),
headers: _headers,
);

if (response.statusCode == 200) {
print("Normal Search Used");

return FileTreeNode.fromJson(
jsonDecode(response.body) as Map<String, dynamic>,
);
Expand All @@ -248,12 +311,12 @@ class Api {
try {
final response = await http.get(
Uri.parse(
"$uri/keywordSearch?compositeName=$name&searchText=$searchString",
"$_baseUri/keywordSearch?compositeName=$name&searchText=$searchString",
),
headers: _headers,
);

if (response.statusCode == 200) {
print("Advanced Search Used");
return FileTreeNode.fromJson(
jsonDecode(response.body) as Map<String, dynamic>,
);
Expand All @@ -271,7 +334,8 @@ class Api {
static Future<bool> searchAdvancedReady(String name) async {
try {
final response = await http.get(
Uri.parse("$uri/isKeywordSearchReady?compositeName=$name"),
Uri.parse("$_baseUri/isKeywordSearchReady?compositeName=$name"),
headers: _headers,
);
if (response.statusCode == 200) {
final body = response.body.trim().toLowerCase();
Expand All @@ -292,7 +356,8 @@ class Api {
) async {
try {
final response = await http.post(
Uri.parse("$uri/deleteFile?name=$managerName&path=$path"),
Uri.parse("$_baseUri/deleteFile?name=$managerName&path=$path"),
headers: _headers,
);
if (response.statusCode == 200 || response.statusCode == 201) {
return FileTreeNode.fromJson(
Expand All @@ -314,8 +379,8 @@ class Api {
) async {
try {
final response = await http.post(
Uri.parse("$uri/bulkDeleteFiles?name=$managerName"),
headers: {'Content-Type': 'application/json'},
Uri.parse("$_baseUri/bulkDeleteFiles?name=$managerName"),
headers: _headers,
body: jsonPaths,
);
if (response.statusCode == 200 || response.statusCode == 201) {
Expand All @@ -339,8 +404,8 @@ class Api {
) async {
try {
final response = await http.post(
Uri.parse("$uri/bulkAddTag?name=$managerName"),
headers: {'Content-Type': 'application/json'},
Uri.parse("$_baseUri/bulkAddTag?name=$managerName"),
headers: _headers,
body: jsonPaths,
);
if (response.statusCode == 200 || response.statusCode == 201) {
Expand All @@ -364,8 +429,8 @@ class Api {
) async {
try {
final response = await http.post(
Uri.parse("$uri/bulkRemoveTag?name=$managerName"),
headers: {'Content-Type': 'application/json'},
Uri.parse("$_baseUri/bulkRemoveTag?name=$managerName"),
headers: _headers,
body: jsonPaths,
);
if (response.statusCode == 200 || response.statusCode == 201) {
Expand All @@ -389,7 +454,10 @@ class Api {
) async {
try {
final response = await http.get(
Uri.parse("$uri/returnType?name=$name&type=$type&umbrella=$umbrella"),
Uri.parse(
"$_baseUri/returnType?name=$name&type=$type&umbrella=$umbrella",
),
headers: _headers,
);

if (response.statusCode == 200) {
Expand All @@ -413,7 +481,6 @@ class Api {
.map((item) => FileModel.fromJson(item as Map<String, dynamic>))
.toList();
} catch (e) {
print('Error parsing JSON: $e');
return <FileModel>[];
}
} else {
Expand All @@ -431,11 +498,12 @@ class Api {
//loadStats
static Future<ManagersStatsResponse> loadStatsData() async {
try {
final response = await http.get(Uri.parse("$uri/returnStats"));
final response = await http.get(
Uri.parse("$_baseUri/returnStats"),
headers: _headers,
);

if (response.statusCode == 200) {
print(jsonDecode(response.body) as List<dynamic>);

return ManagersStatsResponse.fromJson(
jsonDecode(response.body) as List<dynamic>,
);
Expand All @@ -453,10 +521,10 @@ class Api {
static Future<bool> moveDirectory(String managerName) async {
try {
final response = await http.post(
Uri.parse("$uri/moveDirectory?name=$managerName"),
Uri.parse("$_baseUri/moveDirectory?name=$managerName"),
headers: _headers,
);
if (response.statusCode == 200 || response.statusCode == 201) {
print(response.body);
if (response.body == "true") {
return true;
} else {
Expand Down
Loading
Loading