Compare commits
No commits in common. "main" and "VT-2" have entirely different histories.
24
BUILD.ps1
24
BUILD.ps1
@ -2,22 +2,14 @@
|
|||||||
## PSVersionTable.PSVersion
|
## PSVersionTable.PSVersion
|
||||||
## winget install --id Microsoft.Powershell --source winget
|
## winget install --id Microsoft.Powershell --source winget
|
||||||
|
|
||||||
# mkdir dist
|
mkdir dist
|
||||||
# cd webapp
|
cd webapp
|
||||||
# npm run build
|
npm run build
|
||||||
# cp -r .next/static .next/standalone/gitea/CoffeeChat/webapp/.next
|
cp -r .next/static .next/standalone/gitea/CoffeeChat/webapp/.next
|
||||||
# mkdir dist
|
mkdir dist
|
||||||
# cp -r .next/standalone/gitea/CoffeeChat/webapp/* dist
|
cp -r .next/standalone/gitea/CoffeeChat/webapp/* dist
|
||||||
# Compress-Archive -Path .\dist\* -DestinationPath ..\dist\client-dist.zip -Force
|
Compress-Archive -Path .\dist\* -DestinationPath ..\dist\client-dist.zip -Force
|
||||||
# Remove-Item dist -Recurse -Force
|
Remove-Item dist -Recurse -Force
|
||||||
# cd ..
|
|
||||||
# cd .\coffeechat\
|
|
||||||
# $env:JAVA_HOME="C:\Program Files\Java\jdk-17";mvn clean package
|
|
||||||
# cd ..
|
|
||||||
# copy coffeechat\target\coffeechat-0.0.1-SNAPSHOT.jar dist
|
|
||||||
cd serverWS
|
|
||||||
node --experimental-sea-config sea-config.json
|
|
||||||
mv .\socket-server ..\dist\
|
|
||||||
cd ..
|
cd ..
|
||||||
# cd dist
|
# cd dist
|
||||||
# npm publish
|
# npm publish
|
||||||
|
|||||||
26
README.md
26
README.md
@ -1,26 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
java -jar myapp.jar --spring.config.location=file:/path/to/custom.properties
|
|
||||||
java -jar coffeechat-0.0.1-SNAPSHOT.jar --spring.config.import=file:/var/www/CC/application.properties
|
|
||||||
|
|
||||||
Sample properies
|
|
||||||
|
|
||||||
spring.application.name=Coffee Chat
|
|
||||||
server.port=8081
|
|
||||||
logging.level.root=DEBUG
|
|
||||||
# Database properties
|
|
||||||
spring.datasource.url=jdbc:mysql://localhost:3306/coffeeChat
|
|
||||||
spring.datasource.username=coffeeChat
|
|
||||||
spring.datasource.password=coffeeChat
|
|
||||||
|
|
||||||
# JPA/Hibernate settings (optional but useful)
|
|
||||||
# 'update' automatically updates the database schema based on your entities
|
|
||||||
spring.jpa.hibernate.ddl-auto=update
|
|
||||||
spring.jpa.show-sql=true
|
|
||||||
|
|
||||||
jwt.secret=your_secret_key_heretjldjfgljfdsigjj9psejgjsidgjscgtj
|
|
||||||
jwt.expiration=3600000
|
|
||||||
|
|
||||||
Client
|
|
||||||
|
|
||||||
export "PORT=4050"; node server.js
|
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
package za.co.rootbranch.coffeechat;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
|
import org.mockito.InjectMocks;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
|
|
||||||
|
import za.co.rootbranch.coffeechat.models.User;
|
||||||
|
import za.co.rootbranch.coffeechat.repositories.UserRepository;
|
||||||
|
import za.co.rootbranch.coffeechat.services.UserService;
|
||||||
|
|
||||||
|
@ExtendWith(MockitoExtension.class)
|
||||||
|
public class CreateUserTest {
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private UserRepository userRepository;
|
||||||
|
|
||||||
|
@InjectMocks
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@BeforeEach()
|
||||||
|
void init() {
|
||||||
|
// do setup
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void TestCreateANewUser() {
|
||||||
|
// Mock the behavior of the repository
|
||||||
|
String email = "test@example.com";
|
||||||
|
User mockUser = new User(null,"", "", email);
|
||||||
|
when(userRepository.findByEmail(email)).thenReturn(mockUser); // Stub the method call
|
||||||
|
|
||||||
|
// Call the service method
|
||||||
|
User foundUser = userService.findUserByEmail(email);
|
||||||
|
|
||||||
|
// Verify the result using JUnit assertions
|
||||||
|
assertEquals(email, foundUser.getEmail());
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
dist/client-dist.zip
vendored
BIN
dist/client-dist.zip
vendored
Binary file not shown.
BIN
dist/coffeechat-0.0.1-SNAPSHOT.jar
vendored
BIN
dist/coffeechat-0.0.1-SNAPSHOT.jar
vendored
Binary file not shown.
BIN
dist/socket-server
vendored
BIN
dist/socket-server
vendored
Binary file not shown.
41
serverWS/.gitignore
vendored
41
serverWS/.gitignore
vendored
@ -1,41 +0,0 @@
|
|||||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
/node_modules
|
|
||||||
/.pnp
|
|
||||||
.pnp.*
|
|
||||||
.yarn/*
|
|
||||||
!.yarn/patches
|
|
||||||
!.yarn/plugins
|
|
||||||
!.yarn/releases
|
|
||||||
!.yarn/versions
|
|
||||||
|
|
||||||
# testing
|
|
||||||
/coverage
|
|
||||||
|
|
||||||
# next.js
|
|
||||||
/.next/
|
|
||||||
/out/
|
|
||||||
|
|
||||||
# production
|
|
||||||
/build
|
|
||||||
|
|
||||||
# misc
|
|
||||||
.DS_Store
|
|
||||||
*.pem
|
|
||||||
|
|
||||||
# debug
|
|
||||||
npm-debug.log*
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
.pnpm-debug.log*
|
|
||||||
|
|
||||||
# env files (can opt-in for committing if needed)
|
|
||||||
.env*
|
|
||||||
|
|
||||||
# vercel
|
|
||||||
.vercel
|
|
||||||
|
|
||||||
# typescript
|
|
||||||
*.tsbuildinfo
|
|
||||||
next-env.d.ts
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
const express = require("express");
|
|
||||||
const app = express();
|
|
||||||
const http = require("http");
|
|
||||||
const server = http.createServer(app);
|
|
||||||
|
|
||||||
const { Server } = require("socket.io");
|
|
||||||
const io = new Server(server, {
|
|
||||||
cors: {
|
|
||||||
origin: "http://192.168.0.131:3000", // Replace with the origin of your client application
|
|
||||||
methods: ["GET", "POST", "WS"], // Allowed HTTP methods
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
app.get("/", (req, res) => {
|
|
||||||
// res.sendFile(__dirname + "/index.html");
|
|
||||||
res.send(`Upgrade`);
|
|
||||||
});
|
|
||||||
|
|
||||||
io.on("connection", (socket) => {
|
|
||||||
console.log("A user connected");
|
|
||||||
|
|
||||||
// Handle custom events from the client
|
|
||||||
socket.on("chat message", (msg) => {
|
|
||||||
io.emit("chat message", msg); // Emit the message to all connected clients
|
|
||||||
});
|
|
||||||
|
|
||||||
// Handle disconnections
|
|
||||||
socket.on("disconnect", () => {
|
|
||||||
console.log("User disconnected");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
server.listen(4000, () => {
|
|
||||||
console.log("Listening on port 4000");
|
|
||||||
});
|
|
||||||
1076
serverWS/package-lock.json
generated
1076
serverWS/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"dependencies": {
|
|
||||||
"express": "^5.2.1",
|
|
||||||
"socket.io": "^4.8.3"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
{ "main": "index.js", "output": "socket-server" }
|
|
||||||
Loading…
x
Reference in New Issue
Block a user