Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
39 changes: 3 additions & 36 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,36 +1,3 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# 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*

# local env files
.env.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
node_modules/
lib/
.DS_Store
49 changes: 8 additions & 41 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,12 @@
{
"name": "planity-app",
"version": "0.1.0",
"private": true,
"name": "clean-app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"test": "jest"
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@hookform/resolvers": "^2.9.11",
"@mui/icons-material": "^5.11.0",
"@mui/material": "^5.11.7",
"@mui/x-date-pickers": "^5.0.20",
"@next/font": "13.1.6",
"axios": "^1.3.0",
"dayjs": "^1.11.7",
"eslint": "8.33.0",
"eslint-config-next": "13.1.6",
"next": "13.1.6",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.43.3",
"react-query": "^3.39.3",
"yup": "^1.0.2",
"zod": "^3.20.6",
"zustand": "^4.3.3"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@types/jest": "^29.4.0",
"@types/node": "18.11.18",
"@types/react": "18.0.27",
"@types/react-dom": "18.0.10",
"jest": "^29.4.2",
"jest-environment-jsdom": "^29.4.2",
"ts-jest": "^29.0.5",
"typescript": "4.9.5"
}
"keywords": [],
"author": "",
"license": "ISC"
}
26 changes: 26 additions & 0 deletions packages/adapters/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "@planigo/adapters",
"private": true,
"version": "1.0.0",
"description": "",
"type": "module",
"main": "./src/index.js",
"types": "./src/index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@jest/globals": "^29.5.0",
"@types/jest": "^29.5.0",
"ts-jest": "^29.0.5",
"jest": "^29.5.0",
"typescript": "^5.0.2"
},
"dependencies": {
"axios": "^1.3.5",
"@planigo/core": "workspace:^1.0.0"
}
}
22 changes: 22 additions & 0 deletions packages/adapters/src/AuthService.adapter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { axiosInstance } from "./config/axios";
import { AuthServicePort } from "@planigo/core/lib/auth/domain/ports/AuthService.port"
import type { LoginOutput } from "@planigo/core/lib/auth/usecases/Login/LoginOutput"
import type { LoginInput } from "@planigo/core/lib/auth/usecases/Login/LoginInput"
import type { RegisterInput, RegisterOutput } from "@planigo/core/lib/auth/usecases/Register/Register.usecase"

export function useAuthService(): AuthServicePort {
const login = async (loginInput: LoginInput): Promise<LoginOutput> => {
const response = await axiosInstance.post<LoginOutput>("/auth/login", loginInput)
return response.data
}

const register = async (registerInput: RegisterInput): Promise<RegisterOutput> => {
const response = await axiosInstance.post<RegisterOutput>("/users/customer", registerInput)
return response.data
}

return {
login,
register
}
}
13 changes: 13 additions & 0 deletions packages/adapters/src/ReservationService.adapter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Reservation } from "@planigo/core/lib/reservation/domain/models/Reservation.model"
import { ReservationServicePort } from "@planigo/core/lib/reservation/domain/ports/ReservationService.port"
import { axiosInstance } from "./config/axios"

export function useReservationService(): ReservationServicePort {
const getNextReservationsSlots = async (shopId: string): Promise<Reservation[]> => {
const response = await axiosInstance.get<Reservation[]>(`/reservation/slots/${shopId}`)
return response.data
}
return {
getNextReservationsSlots
}
}
35 changes: 35 additions & 0 deletions packages/adapters/src/ShoppingService.adapter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Service } from "@planigo/core/src/shopping/domain/models/Service.model";
import { axiosInstance } from "./config/axios";
import type { Shop, ShopCategory } from "@planigo/core/src/shopping/domain/models/Shop.model";
import { ShoppingServicePort } from "@planigo/core/src/shopping/domain/ports/ShoppingService.port";

export function useShoppingService(): ShoppingServicePort {
const getShopCategories = async (): Promise<ShopCategory[]> => {
const response = await axiosInstance.get<ShopCategory[]>(`/categories`)
return response.data
}
const getShopsFilteredByCategory = async (category: string): Promise<Shop[]> => {
const response = await axiosInstance.get<Shop[]>(`/shops/category/${category}`)
return response.data
}
const getShopById = async (shopId: string): Promise<Shop> => {
const response = await axiosInstance.get(`/shops/${shopId}`)
return response.data
}

const getShopServices = async (shopId: string): Promise<Service[]> => {
const response = await axiosInstance.get(`/services/shop/${shopId}`)
return response.data
}
const getShopHours = async (shopId: string) => {
const response = await axiosInstance.get(`/hours/shop/${shopId}`)
return response.data
}
return {
getShopCategories,
getShopsFilteredByCategory,
getShopById,
getShopServices,
getShopHours
}
}
Empty file.
9 changes: 9 additions & 0 deletions packages/adapters/src/config/axios.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import axios from "axios";

export const axiosInstance = axios.create({
baseURL: "http://127.0.0.1:8080/api",
timeout: 5000,
// headers: {
// Authorization: getToken() ? `Bearer ${getToken()}` : "",
// },
});
23 changes: 23 additions & 0 deletions packages/adapters/src/storage/Localstorage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { TokenServicePort } from "@planigo/core/lib/auth/domain/ports/TokenService.port"

const tokenKey: string = "token_planigo";

export const useLocalStorage = (): TokenServicePort => {
const getToken = (): string | null => {
return typeof window !== undefined ? localStorage.getItem(tokenKey) : null;
}

const setToken = (token: string): void => {
localStorage.setItem(tokenKey, token);
}

const removeToken = (): void => {
localStorage.removeItem(tokenKey);
}

return {
getToken,
setToken,
removeToken
}
}
11 changes: 11 additions & 0 deletions packages/adapters/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.base.json",
"allowImportingTsExtensions": true,
"compilerOptions": {
"baseUrl": ".",
"module": "ES6",
"outDir": "./lib"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "src/**/*.spec.ts"]
}
File renamed without changes.
File renamed without changes.
36 changes: 36 additions & 0 deletions packages/apps/old-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# 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*

# local env files
.env.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
45 changes: 45 additions & 0 deletions packages/apps/old-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "planity-app",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"test": "jest"
},
"dependencies": {
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@hookform/resolvers": "^2.9.11",
"@mui/icons-material": "^5.11.0",
"@mui/material": "^5.11.7",
"@mui/x-date-pickers": "^5.0.20",
"@next/font": "13.1.6",
"axios": "^1.3.0",
"dayjs": "^1.11.7",
"eslint": "8.33.0",
"eslint-config-next": "13.1.6",
"next": "13.1.6",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.43.3",
"react-query": "^3.39.3",
"yup": "^1.0.2",
"zod": "^3.20.6",
"zustand": "^4.3.3"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@types/jest": "^29.4.0",
"@types/node": "18.11.18",
"@types/react": "18.0.27",
"@types/react-dom": "18.0.10",
"jest": "^29.4.2",
"jest-environment-jsdom": "^29.4.2",
"ts-jest": "^29.0.5",
"typescript": "4.9.5"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export type User = {
role: "admin" | "customer" | "owner";
isEmailVerified: boolean;
};

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tsconfig.json → packages/apps/old-app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "src/pages/styles.css"],
"include": ["old-app/next-env.d.ts", "**/*.ts", "**/*.tsx", "src/pages/styles.css"],
"exclude": ["node_modules"]
}
34 changes: 34 additions & 0 deletions packages/apps/planigo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel
Loading