Merge remote-tracking branch 'origin/dev/guerby' into dev/cedric

This commit is contained in:
cdricms
2025-01-14 14:51:43 +01:00
12 changed files with 278 additions and 11 deletions

View File

@@ -11,6 +11,12 @@ cd ./latosa-frontend
deno install
```
then use the init to developp
```bash
./init.sh
```
## Run
To run the frontend part:
@@ -20,7 +26,17 @@ cd ./latosa-frontend/
deno task dev
```
It should launch properly, go at http://localhost:3000
It should launch properly, go at http://localhost:8000
Use this to sync with backend
```bash
docker compose up -d --build
```
## deploy
For deployement, it can be found at http://localhost:3000
## Committing

View File

@@ -3,6 +3,7 @@ module fr.latosa-escrima
go 1.23.4
require (
github.com/google/uuid v1.6.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/joho/godotenv v1.5.1 // indirect
github.com/puzpuzpuz/xsync/v3 v3.4.0 // indirect

View File

@@ -1,3 +1,5 @@
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=

75
backend/schemas.go Normal file
View File

@@ -0,0 +1,75 @@
package main
import (
"time"
"github.com/uptrace/bun"
"github.com/google/uuid"
)
type Role string
const (
AdminRole Role = "admin"
UserRole Role = "user"
)
type User struct {
bun.BaseModel `bun:"table:users"`
ID uuid.UUID `bun:"type:uuid,pk,default:gen_random_uuid()"`
FirstName string `bun:"firstname,notnull"`
LastName string `bun:"lastname,notnull"`
Email string `bun:"email,unique,notnull"`
Phone string `bun:"phone,notnull"`
Role Role `bun:"role,notnull,default:'user'"`
CreatedAt time.Time `bun:"created_at,default:current_timestamp"`
UpdatedAt time.Time `bun:"updated_at,default:current_timestamp"`
}
type Event struct {
bun.BaseModel `bun:"table:events"`
EventID uuid.UUID `bun:"type:uuid,pk"`
CreationDate time.Time `bun:"creation_date,notnull,default:current_timestamp"`
ScheduleStart time.Time `bun:"schedule_start,notnull"`
ScheduleEnd time.Time `bun:"schedule_end,notnull"`
Status string `bun:"status,notnull"`
}
type EventsToUsers struct {
bun.BaseModel `bun:"table:events_to_users"`
EventID uuid.UUID `bun:"type:uuid,notnull"`
UserID uuid.UUID `bun:"type:uuid,notnull"`
Event *Event `bun:"rel:belongs_to,join:event_id=event_id"`
User *User `bun:"rel:belongs_to,join:user_id=user_id"`
PrimaryKey struct {
EventID uuid.UUID `bun:"pk"`
UserID uuid.UUID `bun:"pk"`
}
}
type Blog struct {
bun.BaseModel `bun:"table:blogs"`
UUID uuid.UUID `bun:"type:uuid,pk"`
Slug string `bun:"slug,unique,notnull"`
Content string `bun:"content,notnull"`
Label string `bun:"label"`
AuthorID uuid.UUID `bun:"author,notnull"`
Published time.Time `bun:"published,default:current_timestamp"`
Summary string `bun:"summary"`
Image string `bun:"image"`
Href string `bun:"href"`
Author *User `bun:"rel:belongs_to,join:author=author_id"`
}
type WebsiteSettings struct {
bun.BaseModel `bun:"table:website_settings"`
ID uuid.UUID `bun:"type:uuid,pk,default:gen_random_uuid()"`
AutoAcceptDemand bool `bun:"auto_accept_demand,default:false"`
}

25
database/mock-up.md Normal file
View File

@@ -0,0 +1,25 @@
Latosa-escrima-db
- user (cedric job)
- planning_events
- event_id uuid PK,
- creation_date id,
- schedule_start date,
- schedule_end end,
- status { 'Canceled', 'Active', '' }
CHECK schedule_start < schedule_end
- events_to_users
- event_id uuid references planning_events(event_id),
- user_id uuid references user(user_id)
- blog
uuid: slug PK,
slug: string unique,
content: string,
label: string,
author: uuid references user_id,
published: string,
summary: string,
image: string,
href: string
- website settings
- auto accept demand ? true/false

12
database/schemas/blog.sql Normal file
View File

@@ -0,0 +1,12 @@
CREATE TABLE blogs (
uuid UUID PRIMARY KEY, -- The blog primary key
slug VARCHAR(255) UNIQUE NOT NULL, -- Slug must be unique and non-null
content TEXT NOT NULL, -- Content cannot be null
label VARCHAR(100), -- Optional label
author UUID REFERENCES users(user_id) ON DELETE SET NULL, -- Foreign key to user with cascading null for author deletion
published TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- Automatically set the published time
summary VARCHAR(500), -- A brief summary of the blog
image VARCHAR(255), -- URL for the blog image
href VARCHAR(255), -- Link to the blog if external
CONSTRAINT check_slug_length CHECK (length(slug) > 0) -- Ensure slug is not empty
);

View File

@@ -0,0 +1,11 @@
CREATE EXTENSION IF NOT EXISTS pgcrypto;
CREATE TYPE Event_status as ENUM('Canceled', 'Active')
CREATE TABLE events (
event_id UUID PRIMARY KEY, -- Use UUID as the primary key
creation_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- Automatically capture the creation date
schedule_start DATE NOT NULL,
schedule_end DATE NOT NULL,
status Event_status DEFAULT 'Active', -- enum-like constraint for status
CHECK (schedule_start < schedule_end) -- Ensure the start date is before the end date
);

View File

@@ -0,0 +1,6 @@
CREATE TABLE events_to_users (
event_id UUID REFERENCES events(event_id) ON DELETE CASCADE, -- Foreign key with cascading delete for referential integrity
user_id UUID REFERENCES users(user_id) ON DELETE CASCADE, -- Foreign key with cascading delete
PRIMARY KEY (event_id, user_id) -- Ensure uniqueness of event-user pairs
);

View File

@@ -0,0 +1,4 @@
CREATE TABLE website_settings (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(), -- Auto-generate UUID for settings table
auto_accept_demand BOOLEAN DEFAULT FALSE -- Automatically accept demands by default is false
);

View File

@@ -0,0 +1,16 @@
"use server"
export default async function About() {
return (
<div>
<div>
About us
will :
+explain what we
+pricing
+plannign for what will come next
</div>
</div>
)
}

View File

@@ -69,7 +69,7 @@ const subMenuItemsTwo = [
const Navbar = () => {
return (
<section className="p-4 bg-white top-0 sticky z-[100]">
<div className="">
<div>
<nav className="hidden justify-between lg:flex">
<div className="flex items-center gap-6">
<div className="flex items-center gap-2">
@@ -103,9 +103,8 @@ const Navbar = () => {
variant: "ghost",
}),
)}
href="/"
>
Calendar
href="/">
Planning
</a>
<a
className={cn(
@@ -115,9 +114,9 @@ const Navbar = () => {
variant: "ghost",
}),
)}
href="#"
href="/about"
>
Pricing
A propos
</a>
<a
className={cn(

108
frontend/deno.lock generated
View File

@@ -4,11 +4,15 @@
"npm:@eslint/eslintrc@3": "3.2.0",
"npm:@radix-ui/react-accordion@^1.2.2": "1.2.2_@types+react@19.0.5_@types+react-dom@19.0.3__@types+react@19.0.5_react@19.0.0_react-dom@19.0.0__react@19.0.0",
"npm:@radix-ui/react-avatar@^1.1.2": "1.1.2_@types+react@19.0.5_@types+react-dom@19.0.3__@types+react@19.0.5_react@19.0.0_react-dom@19.0.0__react@19.0.0",
"npm:@radix-ui/react-collapsible@^1.1.2": "1.1.2_@types+react@19.0.5_@types+react-dom@19.0.3__@types+react@19.0.5_react@19.0.0_react-dom@19.0.0__react@19.0.0",
"npm:@radix-ui/react-dialog@^1.1.4": "1.1.4_@types+react@19.0.5_@types+react-dom@19.0.3__@types+react@19.0.5_react@19.0.0_react-dom@19.0.0__react@19.0.0",
"npm:@radix-ui/react-dropdown-menu@^2.1.4": "2.1.4_@types+react@19.0.5_@types+react-dom@19.0.3__@types+react@19.0.5_react@19.0.0_react-dom@19.0.0__react@19.0.0",
"npm:@radix-ui/react-label@^2.1.1": "2.1.1_@types+react@19.0.5_@types+react-dom@19.0.3__@types+react@19.0.5_react@19.0.0_react-dom@19.0.0__react@19.0.0",
"npm:@radix-ui/react-navigation-menu@^1.2.3": "1.2.3_@types+react@19.0.5_@types+react-dom@19.0.3__@types+react@19.0.5_react@19.0.0_react-dom@19.0.0__react@19.0.0",
"npm:@radix-ui/react-select@^2.1.4": "2.1.4_@types+react@19.0.5_@types+react-dom@19.0.3__@types+react@19.0.5_react@19.0.0_react-dom@19.0.0__react@19.0.0",
"npm:@radix-ui/react-separator@^1.1.1": "1.1.1_@types+react@19.0.5_@types+react-dom@19.0.3__@types+react@19.0.5_react@19.0.0_react-dom@19.0.0__react@19.0.0",
"npm:@radix-ui/react-slot@^1.1.1": "1.1.1_@types+react@19.0.5_react@19.0.0",
"npm:@radix-ui/react-tooltip@^1.1.6": "1.1.6_@types+react@19.0.5_@types+react-dom@19.0.3__@types+react@19.0.5_react@19.0.0_react-dom@19.0.0__react@19.0.0",
"npm:@types/node@20": "20.17.12",
"npm:@types/react-dom@19": "19.0.3_@types+react@19.0.5",
"npm:@types/react@19": "19.0.5",
@@ -17,7 +21,7 @@
"npm:embla-carousel-react@^8.5.2": "8.5.2_react@19.0.0_embla-carousel@8.5.2",
"npm:eslint-config-next@15.1.4": "15.1.4_eslint@9.18.0_typescript@5.7.3_@typescript-eslint+parser@8.19.1__eslint@9.18.0__typescript@5.7.3_eslint-plugin-import@2.31.0__eslint@9.18.0",
"npm:eslint@9": "9.18.0",
"npm:lucide-react@0.471": "0.471.0_react@19.0.0",
"npm:lucide-react@~0.471.1": "0.471.1_react@19.0.0",
"npm:next@15.1.4": "15.1.4_react@19.0.0_react-dom@19.0.0__react@19.0.0",
"npm:postcss@8": "8.4.49",
"npm:react-dom@19": "19.0.0_react@19.0.0",
@@ -442,6 +446,22 @@
"react-dom"
]
},
"@radix-ui/react-dropdown-menu@2.1.4_@types+react@19.0.5_@types+react-dom@19.0.3__@types+react@19.0.5_react@19.0.0_react-dom@19.0.0__react@19.0.0": {
"integrity": "sha512-iXU1Ab5ecM+yEepGAWK8ZhMyKX4ubFdCNtol4sT9D0OVErG9PNElfx3TQhjw7n7BC5nFVz68/5//clWy+8TXzA==",
"dependencies": [
"@radix-ui/primitive",
"@radix-ui/react-compose-refs",
"@radix-ui/react-context",
"@radix-ui/react-id",
"@radix-ui/react-menu",
"@radix-ui/react-primitive",
"@radix-ui/react-use-controllable-state",
"@types/react",
"@types/react-dom",
"react",
"react-dom"
]
},
"@radix-ui/react-focus-guards@1.1.1_@types+react@19.0.5_react@19.0.0": {
"integrity": "sha512-pSIwfrT1a6sIoDASCSpFwOasEwKTZWDw/iBdtnqKO7v6FeOzYJ7U53cPzYFVR3geGGXgVHaH+CdngrrAzqUGxg==",
"dependencies": [
@@ -479,6 +499,33 @@
"react-dom"
]
},
"@radix-ui/react-menu@2.1.4_@types+react@19.0.5_@types+react-dom@19.0.3__@types+react@19.0.5_react@19.0.0_react-dom@19.0.0__react@19.0.0": {
"integrity": "sha512-BnOgVoL6YYdHAG6DtXONaR29Eq4nvbi8rutrV/xlr3RQCMMb3yqP85Qiw/3NReozrSW+4dfLkK+rc1hb4wPU/A==",
"dependencies": [
"@radix-ui/primitive",
"@radix-ui/react-collection",
"@radix-ui/react-compose-refs",
"@radix-ui/react-context",
"@radix-ui/react-direction",
"@radix-ui/react-dismissable-layer",
"@radix-ui/react-focus-guards",
"@radix-ui/react-focus-scope",
"@radix-ui/react-id",
"@radix-ui/react-popper",
"@radix-ui/react-portal",
"@radix-ui/react-presence",
"@radix-ui/react-primitive",
"@radix-ui/react-roving-focus",
"@radix-ui/react-slot",
"@radix-ui/react-use-callback-ref",
"@types/react",
"@types/react-dom",
"aria-hidden",
"react",
"react-dom",
"react-remove-scroll"
]
},
"@radix-ui/react-navigation-menu@1.2.3_@types+react@19.0.5_@types+react-dom@19.0.3__@types+react@19.0.5_react@19.0.0_react-dom@19.0.0__react@19.0.0": {
"integrity": "sha512-IQWAsQ7dsLIYDrn0WqPU+cdM7MONTv9nqrLVYoie3BPiabSfUVDe6Fr+oEt0Cofsr9ONDcDe9xhmJbL1Uq1yKg==",
"dependencies": [
@@ -553,6 +600,24 @@
"react-dom"
]
},
"@radix-ui/react-roving-focus@1.1.1_@types+react@19.0.5_@types+react-dom@19.0.3__@types+react@19.0.5_react@19.0.0_react-dom@19.0.0__react@19.0.0": {
"integrity": "sha512-QE1RoxPGJ/Nm8Qmk0PxP8ojmoaS67i0s7hVssS7KuI2FQoc/uzVlZsqKfQvxPE6D8hICCPHJ4D88zNhT3OOmkw==",
"dependencies": [
"@radix-ui/primitive",
"@radix-ui/react-collection",
"@radix-ui/react-compose-refs",
"@radix-ui/react-context",
"@radix-ui/react-direction",
"@radix-ui/react-id",
"@radix-ui/react-primitive",
"@radix-ui/react-use-callback-ref",
"@radix-ui/react-use-controllable-state",
"@types/react",
"@types/react-dom",
"react",
"react-dom"
]
},
"@radix-ui/react-select@2.1.4_@types+react@19.0.5_@types+react-dom@19.0.3__@types+react@19.0.5_react@19.0.0_react-dom@19.0.0__react@19.0.0": {
"integrity": "sha512-pOkb2u8KgO47j/h7AylCj7dJsm69BXcjkrvTqMptFqsE2i0p8lHkfgneXKjAgPzBMivnoMyt8o4KiV4wYzDdyQ==",
"dependencies": [
@@ -583,6 +648,16 @@
"react-remove-scroll"
]
},
"@radix-ui/react-separator@1.1.1_@types+react@19.0.5_@types+react-dom@19.0.3__@types+react@19.0.5_react@19.0.0_react-dom@19.0.0__react@19.0.0": {
"integrity": "sha512-RRiNRSrD8iUiXriq/Y5n4/3iE8HzqgLHsusUSg5jVpU2+3tqcUFPJXHDymwEypunc2sWxDUS3UC+rkZRlHedsw==",
"dependencies": [
"@radix-ui/react-primitive",
"@types/react",
"@types/react-dom",
"react",
"react-dom"
]
},
"@radix-ui/react-slot@1.1.1_@types+react@19.0.5_react@19.0.0": {
"integrity": "sha512-RApLLOcINYJA+dMVbOju7MYv1Mb2EBp2nH4HdDzXTSyaR5optlm6Otrz1euW3HbdOR8UmmFK06TD+A9frYWv+g==",
"dependencies": [
@@ -591,6 +666,27 @@
"react"
]
},
"@radix-ui/react-tooltip@1.1.6_@types+react@19.0.5_@types+react-dom@19.0.3__@types+react@19.0.5_react@19.0.0_react-dom@19.0.0__react@19.0.0": {
"integrity": "sha512-TLB5D8QLExS1uDn7+wH/bjEmRurNMTzNrtq7IjaS4kjion9NtzsTGkvR5+i7yc9q01Pi2KMM2cN3f8UG4IvvXA==",
"dependencies": [
"@radix-ui/primitive",
"@radix-ui/react-compose-refs",
"@radix-ui/react-context",
"@radix-ui/react-dismissable-layer",
"@radix-ui/react-id",
"@radix-ui/react-popper",
"@radix-ui/react-portal",
"@radix-ui/react-presence",
"@radix-ui/react-primitive",
"@radix-ui/react-slot",
"@radix-ui/react-use-controllable-state",
"@radix-ui/react-visually-hidden",
"@types/react",
"@types/react-dom",
"react",
"react-dom"
]
},
"@radix-ui/react-use-callback-ref@1.1.0_@types+react@19.0.5_react@19.0.0": {
"integrity": "sha512-CasTfvsy+frcFkbXtSJ2Zu9JHpN8TYKxkgJGWbjiZhFivxaeW7rMeZt7QELGVLaYVfFMsKHjb7Ak0nMEe+2Vfw==",
"dependencies": [
@@ -2006,8 +2102,8 @@
"lru-cache@10.4.3": {
"integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="
},
"lucide-react@0.471.0_react@19.0.0": {
"integrity": "sha512-3L0OOJClsKDETJGK7nABqW8ftaVmUjWzluzPpw/6dGdI1bOmzsLsCjZpAEpg24Xs/U7xdYveQU+CBkHxWy7MrA==",
"lucide-react@0.471.1_react@19.0.0": {
"integrity": "sha512-syOxwPhf62gg2YOsz72HRn+CIpeudFy67AeKnSR8Hn/fIIF4ubhNbRF+pQ2CaJrl+X9Os4PL87z2DXQi3DVeDA==",
"dependencies": [
"react"
]
@@ -2932,11 +3028,15 @@
"npm:@eslint/eslintrc@3",
"npm:@radix-ui/react-accordion@^1.2.2",
"npm:@radix-ui/react-avatar@^1.1.2",
"npm:@radix-ui/react-collapsible@^1.1.2",
"npm:@radix-ui/react-dialog@^1.1.4",
"npm:@radix-ui/react-dropdown-menu@^2.1.4",
"npm:@radix-ui/react-label@^2.1.1",
"npm:@radix-ui/react-navigation-menu@^1.2.3",
"npm:@radix-ui/react-select@^2.1.4",
"npm:@radix-ui/react-separator@^1.1.1",
"npm:@radix-ui/react-slot@^1.1.1",
"npm:@radix-ui/react-tooltip@^1.1.6",
"npm:@types/node@20",
"npm:@types/react-dom@19",
"npm:@types/react@19",
@@ -2945,7 +3045,7 @@
"npm:embla-carousel-react@^8.5.2",
"npm:eslint-config-next@15.1.4",
"npm:eslint@9",
"npm:lucide-react@0.471",
"npm:lucide-react@~0.471.1",
"npm:next@15.1.4",
"npm:postcss@8",
"npm:react-dom@19",