Compare commits
6 Commits
87a08cef9f
...
9dfe50d24f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9dfe50d24f | ||
| 5ccd887df5 | |||
|
|
254479d475 | ||
|
|
15e56fea50 | ||
|
|
907c476567 | ||
|
|
fc9431db44 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,6 @@
|
||||
data/
|
||||
.idea/
|
||||
|
||||
# ---> Python
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
|
||||
145
README.md
145
README.md
@ -1,5 +1,111 @@
|
||||
# 🧩 SOA – Service-Oriented Architecture Project
|
||||
|
||||
## 🏗️ Architecture Overview
|
||||
|
||||
This project implements a **Service-Oriented Architecture (SOA)** for an art gallery management system using Docker containerization and microservices architecture.
|
||||
|
||||
### System Components
|
||||
|
||||
```
|
||||
🌐 HTTPS (Port 443)
|
||||
│
|
||||
┌──────────────────────────▼──────────────────────────────┐
|
||||
│ Apache Reverse Proxy │
|
||||
│ (SSL Termination + OIDC Validation) │
|
||||
│ │
|
||||
│ /api/public/* ──────┐ ┌────── /api/private/* │
|
||||
│ (No Auth) │ │ (OIDC Required) │
|
||||
└───────────────────────┼──────┼──────────────────────────┘
|
||||
│ │ |
|
||||
│ │ (+ OIDC Headers) |
|
||||
│ │ |
|
||||
┌─────────────▼──┐ ┌─▼──────────────┐ |
|
||||
│ │ │ │ |
|
||||
│ Public API │ │ Private API │ |
|
||||
│ (Laravel) │ │ (Flask) │ |
|
||||
│ Port 5001 │ │ Port 5002 │ |
|
||||
└─────────┬──────┘ └─┬──────────────┘ |
|
||||
│ │ |
|
||||
┌─────────▼──────────▼─────────┐ ┌───────▼──────┐
|
||||
│ MySQL │ │ Keycloak │
|
||||
│ (Application DB) │ │ + Postgres │
|
||||
└──────────────────────────────┘ └──────────────┘
|
||||
│
|
||||
┌─────────────────▼─────────────────┐
|
||||
│ Redis │
|
||||
│ (Cache + Events) │
|
||||
└───────────────────────────────────┘
|
||||
```
|
||||
|
||||
### Technology Stack
|
||||
|
||||
| Component | Technology | Purpose |
|
||||
|-----------|------------|---------|
|
||||
| **Reverse Proxy** | Apache HTTP Server | SSL termination, request routing |
|
||||
| **Authentication** | Keycloak | OIDC/OAuth2 identity provider |
|
||||
| **Public API** | Laravel 12 (PHP) | Public galleries and artworks API |
|
||||
| **Private API** | Flask (Python) | User management and private content |
|
||||
| **Databases** | PostgreSQL + MySQL | Data persistence |
|
||||
| **Cache/Queue** | Redis | Caching and event messaging | // NOT IMPLEMENTED YET
|
||||
|
||||
### Service Architecture
|
||||
|
||||
#### 🔓 **Public API Service** (Laravel)
|
||||
- **Port**: Internal 5001 (via Apache)
|
||||
- **Database**: MySQL
|
||||
- **Purpose**: Public access to galleries and artworks
|
||||
- **Features**:
|
||||
- RESTful API for public galleries
|
||||
- Artist directory
|
||||
- Public artwork browsing
|
||||
- Pagination and filtering
|
||||
|
||||
#### 🔒 **Private API Service** (Flask)
|
||||
- **Port**: Internal 5002 (via Apache)
|
||||
- **Database**: MySQL
|
||||
- **Authentication**: OIDC via Apache mod_auth_openidc
|
||||
- **Purpose**: Authenticated user operations
|
||||
- **Features**:
|
||||
- User profile management
|
||||
- Gallery creation and management
|
||||
- Artwork upload and editing
|
||||
- Review system for galleries/artworks
|
||||
- Invitation system for gallery members
|
||||
|
||||
#### 🔐 **Authentication Service** (Keycloak)
|
||||
- **Port**: 8080
|
||||
- **Database**: PostgreSQL
|
||||
- **Purpose**: Centralized identity and access management
|
||||
- **Features**:
|
||||
- OIDC/OAuth2 provider
|
||||
- User registration and login
|
||||
- Token-based authentication
|
||||
- Single Sign-On (SSO)
|
||||
|
||||
### Request Flow
|
||||
|
||||
All requests enter through **Apache on port 443** (HTTPS) and are processed as follows:
|
||||
|
||||
1. **SSL Termination**: Apache handles SSL/TLS encryption
|
||||
2. **Request Routing**: Based on URL path:
|
||||
- `/api/public/*` → Routes to **Public API** (Laravel on port 5001)
|
||||
- `/api/private/*` → Routes to **Private API** (Flask on port 5002)
|
||||
3. **OIDC Authentication Check**:
|
||||
- **Public API**: No authentication required
|
||||
- **Private API**: Apache mod_auth_openidc validates OIDC tokens with Keycloak
|
||||
4. **Header Injection**: Apache injects user info headers (OIDC_email, OIDC_user) for authenticated requests
|
||||
5. **API Processing**: Backend services handle business logic
|
||||
6. **Data Persistence**: MySQL stores application data
|
||||
7. **Event Publishing**: Redis handles inter-service communication
|
||||
|
||||
### Security Model
|
||||
|
||||
- **SSL/TLS**: All external communication encrypted
|
||||
- **OIDC Authentication**: Industry standard OAuth2/OIDC flow
|
||||
- **Token-based Authorization**: JWT tokens for API access
|
||||
- **Network Isolation**: Services communicate via internal network
|
||||
- **Database Security**: Separate databases for auth and application data
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
1. **Start the application stack:**
|
||||
@ -35,6 +141,37 @@
|
||||
* 👤 **Username:** `alexis`
|
||||
* 🔑 **Password:** `password`
|
||||
|
||||
### Getting Bearer Token for API Testing
|
||||
|
||||
To test the private API with Bearer token authentication, get an access token from:
|
||||
|
||||
**Endpoint:** `http://auth.local:8080/realms/master/protocol/openid-connect/token`
|
||||
**Method:** POST
|
||||
**Content-Type:** `application/x-www-form-urlencoded`
|
||||
|
||||
**Required fields:**
|
||||
- `grant_type`: `password`
|
||||
- `client_id`: `soa`
|
||||
- `client_secret`: `mysecret`
|
||||
- `username`: `alexis`
|
||||
- `password`: `password`
|
||||
|
||||
**Example curl command:**
|
||||
```bash
|
||||
curl -X POST http://auth.local:8080/realms/master/protocol/openid-connect/token \
|
||||
-H "Content-Type: application/x-www-form-urlencoded" \
|
||||
-d "grant_type=password" \
|
||||
-d "client_id=soa" \
|
||||
-d "client_secret=mysecret" \
|
||||
-d "username=alexis" \
|
||||
-d "password=password"
|
||||
```
|
||||
|
||||
Use the returned `access_token` in the Authorization header:
|
||||
```bash
|
||||
curl -H "Authorization: Bearer <access_token>" https://api.local/api/private/me
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🗂️ Public API Endpoints Overview
|
||||
@ -116,3 +253,11 @@ All routes are prefixed with `/api/private` and require a **Bearer token**.
|
||||
|
||||
---
|
||||
|
||||
# Public API:
|
||||
|
||||
## Routes :
|
||||
```
|
||||
GET|HEAD api/artists
|
||||
GET|HEAD api/galleries
|
||||
GET|HEAD api/galleries/{gallery}/artworks
|
||||
```
|
||||
|
||||
@ -4,7 +4,9 @@ FROM httpd:2.4
|
||||
RUN apt-get update && \
|
||||
apt-get install -y libapache2-mod-auth-openidc && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
# Create symlink for the module in the expected location
|
||||
ln -sf /usr/lib/apache2/modules/mod_auth_openidc.so /usr/local/apache2/modules/mod_auth_openidc.so
|
||||
|
||||
# Copy your vhost config and certs
|
||||
COPY conf/extra/httpd-vhosts.conf /usr/local/apache2/conf/extra/httpd-vhosts.conf
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
LoadModule ssl_module modules/mod_ssl.so
|
||||
LoadModule auth_openidc_module /usr/lib/apache2/modules/mod_auth_openidc.so
|
||||
LoadModule auth_openidc_module modules/mod_auth_openidc.so
|
||||
LoadModule proxy_module modules/mod_proxy.so
|
||||
LoadModule proxy_http_module modules/mod_proxy_http.so
|
||||
LoadModule headers_module modules/mod_headers.so
|
||||
@ -50,30 +50,47 @@ Listen 443
|
||||
ServerName api.local
|
||||
ErrorLog ${APACHE_LOG_DIR}/api_error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/api_access.log combined
|
||||
|
||||
SSLEngine on
|
||||
SSLCertificateFile /usr/local/apache2/conf/server.crt
|
||||
SSLCertificateKeyFile /usr/local/apache2/conf/server.key
|
||||
|
||||
# OIDC config - point to Keycloak via auth.local
|
||||
OIDCProviderMetadataURL http://keycloak:8080/realms/soa/.well-known/openid-configuration
|
||||
# Global OIDC configuration
|
||||
OIDCProviderMetadataURL https://auth.local/realms/master/.well-known/openid-configuration
|
||||
OIDCClientID soa
|
||||
OIDCRedirectURI https://api.local/api/redirect
|
||||
OIDCClientSecret NuLgdHzPldRauqIln0I0TN5216PgX3Ty
|
||||
OIDCRedirectURI https://api.local/api/private/redirect
|
||||
OIDCClientSecret mysecret
|
||||
OIDCCryptoPassphrase fdfd8280-13b5-11f0-a320-080027e6dc53
|
||||
OIDCPassClaimsAs both
|
||||
OIDCPassClaimsAs headers
|
||||
OIDCClaimPrefix OIDC-
|
||||
OIDCPassUserInfoAs claims
|
||||
OIDCRemoteUserClaim email
|
||||
OIDCScope "openid email profile"
|
||||
OIDCSessionInactivityTimeout 86400
|
||||
OIDCSSLValidateServer Off
|
||||
|
||||
# Configure OAuth2 Bearer token validation (commented out - not available in this version)
|
||||
# OIDCOAuth2IntrospectionEndpoint https://auth.local/realms/master/protocol/openid-connect/token/introspect
|
||||
# OIDCOAuth2IntrospectionEndpointAuth client_secret_basic
|
||||
# OIDCOAuth2IntrospectionClientID soa
|
||||
# OIDCOAuth2IntrospectionClientSecret mysecret
|
||||
|
||||
# Proxy public API (no auth)
|
||||
ProxyPass /public/ http://public_api:5001/
|
||||
ProxyPassReverse /public/ http://public_api:5001/
|
||||
ProxyPass /api/public http://public_api:5001/api/public
|
||||
ProxyPassReverse /api/public http://public_api:5001/api/public
|
||||
|
||||
# Proxy private API (OIDC protected)
|
||||
ProxyPass /private/ http://user_api:5002/
|
||||
ProxyPassReverse /private/ http://user_api:5002/
|
||||
# Proxy private API (supports both OIDC and Bearer tokens)
|
||||
ProxyPass /api/private http://private_api:5002/api/private
|
||||
ProxyPassReverse /api/private http://private_api:5002/api/private
|
||||
|
||||
<Location /private>
|
||||
AuthType openid-connect
|
||||
Require valid-user
|
||||
<Location /api/private>
|
||||
# Let Flask handle all authentication - pass through all requests
|
||||
# Apache will only inject OIDC headers if user is already authenticated via OIDC
|
||||
AuthType auth-openidc
|
||||
OIDCUnAuthAction pass
|
||||
Require all granted
|
||||
|
||||
# Don't modify the Authorization header - let it pass through naturally
|
||||
</Location>
|
||||
</VirtualHost>
|
||||
11
bruno/SOA/Public/Artists.bru
Normal file
11
bruno/SOA/Public/Artists.bru
Normal file
@ -0,0 +1,11 @@
|
||||
meta {
|
||||
name: Artists
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{URL}}/api/public/artists
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
11
bruno/SOA/Public/Galleries.bru
Normal file
11
bruno/SOA/Public/Galleries.bru
Normal file
@ -0,0 +1,11 @@
|
||||
meta {
|
||||
name: Galleries
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{URL}}/api/public/galleries
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
11
bruno/SOA/Public/Gallery Artwork.bru
Normal file
11
bruno/SOA/Public/Gallery Artwork.bru
Normal file
@ -0,0 +1,11 @@
|
||||
meta {
|
||||
name: Gallery Artwork
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{URL}}/api/public/galleries/{{gallery_id}}/artworks
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
8
bruno/SOA/Public/folder.bru
Normal file
8
bruno/SOA/Public/folder.bru
Normal file
@ -0,0 +1,8 @@
|
||||
meta {
|
||||
name: Public
|
||||
seq: 2
|
||||
}
|
||||
|
||||
auth {
|
||||
mode: inherit
|
||||
}
|
||||
9
bruno/SOA/bruno.json
Normal file
9
bruno/SOA/bruno.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"version": "1",
|
||||
"name": "SOA",
|
||||
"type": "collection",
|
||||
"ignore": [
|
||||
"node_modules",
|
||||
".git"
|
||||
]
|
||||
}
|
||||
6
bruno/SOA/environments/env.bru
Normal file
6
bruno/SOA/environments/env.bru
Normal file
@ -0,0 +1,6 @@
|
||||
vars {
|
||||
gallery_id: 6
|
||||
URL: https://api.local
|
||||
baseUrl: https://api.local/api/private
|
||||
authUrl: http://auth.local:8080
|
||||
}
|
||||
16
bruno/SOA/private/artwork-reviews/artwork-reviews.bru
Normal file
16
bruno/SOA/private/artwork-reviews/artwork-reviews.bru
Normal file
@ -0,0 +1,16 @@
|
||||
meta {
|
||||
name: Get Artwork Reviews
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/artwork/1/reviews
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
25
bruno/SOA/private/artwork-reviews/create-artwork-review.bru
Normal file
25
bruno/SOA/private/artwork-reviews/create-artwork-review.bru
Normal file
@ -0,0 +1,25 @@
|
||||
meta {
|
||||
name: Create Artwork Review
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{baseUrl}}/artwork/1/review
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"grade": 5,
|
||||
"description": "Absolutely stunning artwork! The colors and technique are magnificent.",
|
||||
"parent_ar_id": null
|
||||
}
|
||||
}
|
||||
16
bruno/SOA/private/artwork-reviews/given-artwork-reviews.bru
Normal file
16
bruno/SOA/private/artwork-reviews/given-artwork-reviews.bru
Normal file
@ -0,0 +1,16 @@
|
||||
meta {
|
||||
name: Get Given Artwork Reviews
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/artworks/reviews/given
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
meta {
|
||||
name: Get Received Artwork Reviews
|
||||
type: http
|
||||
seq: 5
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/artworks/reviews/received
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
24
bruno/SOA/private/artwork-reviews/update-artwork-review.bru
Normal file
24
bruno/SOA/private/artwork-reviews/update-artwork-review.bru
Normal file
@ -0,0 +1,24 @@
|
||||
meta {
|
||||
name: Update Artwork Review
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
put {
|
||||
url: {{baseUrl}}/artworks/review/1
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"grade": 4,
|
||||
"description": "Updated: Very beautiful artwork! Great technique and composition."
|
||||
}
|
||||
}
|
||||
31
bruno/SOA/private/artworks/create-artwork.bru
Normal file
31
bruno/SOA/private/artworks/create-artwork.bru
Normal file
@ -0,0 +1,31 @@
|
||||
meta {
|
||||
name: Create Artwork
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{baseUrl}}/gallery/1/artwork
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"title": "Sunset Over Mountains",
|
||||
"description": "A beautiful landscape painting capturing the golden hour",
|
||||
"image_url": "https://example.com/artwork1.jpg",
|
||||
"medium": "Oil on Canvas",
|
||||
"dimensions": "24x36 inches",
|
||||
"creation_year": 2024,
|
||||
"price": 1500.00,
|
||||
"is_visible": true,
|
||||
"is_for_sale": true
|
||||
}
|
||||
}
|
||||
16
bruno/SOA/private/artworks/gallery-artworks.bru
Normal file
16
bruno/SOA/private/artworks/gallery-artworks.bru
Normal file
@ -0,0 +1,16 @@
|
||||
meta {
|
||||
name: Get Gallery Artworks
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/gallery/1/artworks
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
16
bruno/SOA/private/artworks/get-artwork.bru
Normal file
16
bruno/SOA/private/artworks/get-artwork.bru
Normal file
@ -0,0 +1,16 @@
|
||||
meta {
|
||||
name: Get Artwork Details
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/artwork/1
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
16
bruno/SOA/private/artworks/my-artworks.bru
Normal file
16
bruno/SOA/private/artworks/my-artworks.bru
Normal file
@ -0,0 +1,16 @@
|
||||
meta {
|
||||
name: Get My Artworks
|
||||
type: http
|
||||
seq: 5
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/artworks/mine
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
26
bruno/SOA/private/artworks/update-artwork.bru
Normal file
26
bruno/SOA/private/artworks/update-artwork.bru
Normal file
@ -0,0 +1,26 @@
|
||||
meta {
|
||||
name: Update Artwork
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
put {
|
||||
url: {{baseUrl}}/artwork/1
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"title": "Updated Sunset Over Mountains",
|
||||
"description": "An updated beautiful landscape painting",
|
||||
"price": 1800.00,
|
||||
"is_for_sale": false
|
||||
}
|
||||
}
|
||||
14
bruno/SOA/private/auth/debug-headers.bru
Normal file
14
bruno/SOA/private/auth/debug-headers.bru
Normal file
@ -0,0 +1,14 @@
|
||||
meta {
|
||||
name: Debug Headers
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/debug-headers
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
13
bruno/SOA/private/auth/redirect.bru
Normal file
13
bruno/SOA/private/auth/redirect.bru
Normal file
@ -0,0 +1,13 @@
|
||||
meta {
|
||||
name: OIDC Redirect
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/redirect
|
||||
}
|
||||
|
||||
params:query {
|
||||
code: authorization_code_here
|
||||
}
|
||||
19
bruno/SOA/private/environments/Token User.bru
Normal file
19
bruno/SOA/private/environments/Token User.bru
Normal file
@ -0,0 +1,19 @@
|
||||
meta {
|
||||
name: Token User
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{authUrl}}/realms/master/protocol/openid-connect/token
|
||||
body: formUrlEncoded
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:form-urlencoded {
|
||||
grant_type: password
|
||||
client_id: soa
|
||||
client_secret: mysecret
|
||||
username: alexis
|
||||
password: password
|
||||
}
|
||||
11
bruno/SOA/private/environments/Token.bru
Normal file
11
bruno/SOA/private/environments/Token.bru
Normal file
@ -0,0 +1,11 @@
|
||||
meta {
|
||||
name: Token
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: /realms/master/protocol/openid-connect/token
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
15
bruno/SOA/private/environments/debug.bru
Normal file
15
bruno/SOA/private/environments/debug.bru
Normal file
@ -0,0 +1,15 @@
|
||||
meta {
|
||||
name: debug
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
get {
|
||||
url: https://api.local/api/private/debug-headers
|
||||
body: none
|
||||
auth: bearer
|
||||
}
|
||||
|
||||
auth:bearer {
|
||||
token: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJiVFNWa29jT2dpQm1kWm9TQzM1ZXdTWVZsaHllTGV5WmF4WWZSUjhFbkVzIn0.eyJleHAiOjE3NTEyMjEzODksImlhdCI6MTc1MTIyMTMyOSwianRpIjoiOWM2OTQwMzYtMmYyYi00OWQ0LThiZGYtNTliZWEzOGRkZWUzIiwiaXNzIjoiaHR0cHM6Ly9hdXRoLmxvY2FsL3JlYWxtcy9tYXN0ZXIiLCJhdWQiOiJhY2NvdW50Iiwic3ViIjoiNWFkMDA5ZDktMTkwOC00MTU3LThhM2MtYjhlMjNkNGRiOGZjIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoic29hIiwic2Vzc2lvbl9zdGF0ZSI6ImM0MDU1ODc2LWZiYzAtNGQzOS1iNDk3LWM2NDljNzllZTYwYiIsImFjciI6IjEiLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsiZGVmYXVsdC1yb2xlcy1tYXN0ZXIiLCJvZmZsaW5lX2FjY2VzcyIsInVtYV9hdXRob3JpemF0aW9uIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnsiYWNjb3VudCI6eyJyb2xlcyI6WyJtYW5hZ2UtYWNjb3VudCIsIm1hbmFnZS1hY2NvdW50LWxpbmtzIiwidmlldy1wcm9maWxlIl19fSwic2NvcGUiOiJwcm9maWxlIGVtYWlsIiwic2lkIjoiYzQwNTU4NzYtZmJjMC00ZDM5LWI0OTctYzY0OWM3OWVlNjBiIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsInByZWZlcnJlZF91c2VybmFtZSI6ImFsZXhpcyJ9.KH61uqBCgbktgP0VdRYDH7Fa6_SDrZTMw1Lg7Hza_tufy7MmOoOQa-hLy08rsFGCfBXSrhh4RUI8xnxDMmjV1dyVfTPRWXsl4Pcs_YSSkQto1Nf2pjwimmeQ8MVha3tUQcjP4gbsvJhfBAxDs3Ol23Ne40b0bMcWiRrPRgffC31cJPBwqMNYmEnB0fuQhpEIGf53ZH3mLk_V6xTAGdFpTLZhnUHb3PMBtmdL8LfBkiS6LInjaUGY8Ayb1sm5YgV0x5mBOdtfi8FYPLRu1VnPhU9Is3zaxssVLJvpWI1b-Ww97unQetvJdU0WyhAVlI4araTjdlm2jTX1kzYCLKm9DA
|
||||
}
|
||||
5
bruno/SOA/private/environments/local.bru
Normal file
5
bruno/SOA/private/environments/local.bru
Normal file
@ -0,0 +1,5 @@
|
||||
vars {
|
||||
baseUrl: https://api.local/api/private
|
||||
email: alexis@example.com
|
||||
username: alexis
|
||||
}
|
||||
15
bruno/SOA/private/environments/test_auth.bru
Normal file
15
bruno/SOA/private/environments/test_auth.bru
Normal file
@ -0,0 +1,15 @@
|
||||
meta {
|
||||
name: test_auth
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
get {
|
||||
url: https://api.local/api/private/test-auth
|
||||
body: none
|
||||
auth: bearer
|
||||
}
|
||||
|
||||
auth:bearer {
|
||||
token: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJiVFNWa29jT2dpQm1kWm9TQzM1ZXdTWVZsaHllTGV5WmF4WWZSUjhFbkVzIn0.eyJleHAiOjE3NTEyMjIxNTEsImlhdCI6MTc1MTIyMjA5MSwianRpIjoiMjhhN2ZmNzgtNjg0Ni00YWExLTgxNjYtZWUwM2E5YzUyYTliIiwiaXNzIjoiaHR0cHM6Ly9hdXRoLmxvY2FsL3JlYWxtcy9tYXN0ZXIiLCJhdWQiOiJhY2NvdW50Iiwic3ViIjoiNWFkMDA5ZDktMTkwOC00MTU3LThhM2MtYjhlMjNkNGRiOGZjIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoic29hIiwic2Vzc2lvbl9zdGF0ZSI6IjFmOTM5YjIwLTgxMTMtNDU0Zi1hYjkzLWQ3MmU4M2Q0N2MzOCIsImFjciI6IjEiLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsiZGVmYXVsdC1yb2xlcy1tYXN0ZXIiLCJvZmZsaW5lX2FjY2VzcyIsInVtYV9hdXRob3JpemF0aW9uIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnsiYWNjb3VudCI6eyJyb2xlcyI6WyJtYW5hZ2UtYWNjb3VudCIsIm1hbmFnZS1hY2NvdW50LWxpbmtzIiwidmlldy1wcm9maWxlIl19fSwic2NvcGUiOiJwcm9maWxlIGVtYWlsIiwic2lkIjoiMWY5MzliMjAtODExMy00NTRmLWFiOTMtZDcyZTgzZDQ3YzM4IiwiZW1haWxfdmVyaWZpZWQiOnRydWUsInByZWZlcnJlZF91c2VybmFtZSI6ImFsZXhpcyJ9.GFKPO1ykfNh7km-yU8bQCKyAbZqjqJnT62AYGiOFHb5aQOvAoFwSNIsH0j0DRYyB46JjKvWBeOqNsSc8pZQBnIT980dCog-0vdTe8oeI8lO-TUyIWEHo8R1DF-FFJavp-05opBTxbDKMr__aQAMTsRhh-GxsaJsi3WACL9NyvRiouuTOVywOeigogZO4tRB08dc17mMa1fekYLtkqDfbrfJ9zrBf-BUxDsOkpzoXLqWwR5sdhp49-ICZTIfbkKqx2r3vZFxOMsSjphNn6cmVGv1ZTWKio_w6VHGuEKbvlVtN8D66LV9FNlDqHLAfvfPlQQlC265gHpLDrjd0xJ1U_g
|
||||
}
|
||||
12
bruno/SOA/private/folder.bru
Normal file
12
bruno/SOA/private/folder.bru
Normal file
@ -0,0 +1,12 @@
|
||||
meta {
|
||||
name: private
|
||||
seq: 1
|
||||
}
|
||||
|
||||
auth {
|
||||
mode: bearer
|
||||
}
|
||||
|
||||
auth:bearer {
|
||||
token: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICI3MWRQaTVMaVRxMzF1QXRXWFZueWFLYWQtNlktUE5PWC1mSENyd1cwdnRjIn0.eyJleHAiOjE3NTEyMjkwODUsImlhdCI6MTc1MTIyNTQ4NSwianRpIjoiNmQxZjBlOTgtZTA2NC00YWY1LTgyYzctOGQ1ZDU4MGFjZjM2IiwiaXNzIjoiaHR0cHM6Ly9hdXRoLmxvY2FsL3JlYWxtcy9tYXN0ZXIiLCJhdWQiOiJhY2NvdW50Iiwic3ViIjoiMjlkNjc5YjMtOWZjMS00NDFjLWIyYTEtNzA5ZDE5NWEyYjZmIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoic29hIiwic2Vzc2lvbl9zdGF0ZSI6ImZmNzJhN2Q1LTNmZGItNGQ0OC04Mjc4LTI5NDAxNzlmNWFiOSIsImFjciI6IjEiLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsiZGVmYXVsdC1yb2xlcy1tYXN0ZXIiLCJvZmZsaW5lX2FjY2VzcyIsInVtYV9hdXRob3JpemF0aW9uIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnsiYWNjb3VudCI6eyJyb2xlcyI6WyJtYW5hZ2UtYWNjb3VudCIsIm1hbmFnZS1hY2NvdW50LWxpbmtzIiwidmlldy1wcm9maWxlIl19fSwic2NvcGUiOiJlbWFpbCBwcm9maWxlIiwic2lkIjoiZmY3MmE3ZDUtM2ZkYi00ZDQ4LTgyNzgtMjk0MDE3OWY1YWI5IiwiZW1haWxfdmVyaWZpZWQiOnRydWUsInByZWZlcnJlZF91c2VybmFtZSI6ImFsZXhpcyJ9.MrrORbBnN4z-UUhf-9pSDKlBy4sIHrXCPPbM4SKiwGx9qGTABNbaw-wstlLLoi8UsiwcZBfavjmaJO89ctXIn0zxb4rMKhKYSxnSw59lgpl6RK7oKAdvbq53imZgPvAlGO1twzJiIr3V5Eci6xudvdREvva2wMlYr3xpSdPGXjIb1IJ-O4bpxYiHhIVQ1x0YezppzqElII6K6S39Ht0kNxu0IA6KwydBRTLLJW6G0OTZ87upRhX2h6PN1IosCTsPs8_gA6uB8S88bYUg4aHxYE11SjYZxDMu-ttx59qIovzGAXv4YGzgQibK9PBZ5uupPQNKklNBObqqZX8NPm9MDA
|
||||
}
|
||||
26
bruno/SOA/private/galleries/create-gallery.bru
Normal file
26
bruno/SOA/private/galleries/create-gallery.bru
Normal file
@ -0,0 +1,26 @@
|
||||
meta {
|
||||
name: Create Gallery
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{baseUrl}}/gallery
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"title": "Modern Art Collection",
|
||||
"description": "A curated collection of contemporary artworks",
|
||||
"is_public": true,
|
||||
"publication_date": "2025-06-28T10:00:00Z"
|
||||
}
|
||||
}
|
||||
16
bruno/SOA/private/galleries/gallery-members.bru
Normal file
16
bruno/SOA/private/galleries/gallery-members.bru
Normal file
@ -0,0 +1,16 @@
|
||||
meta {
|
||||
name: Get Gallery Members
|
||||
type: http
|
||||
seq: 6
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/gallery/1/members
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
16
bruno/SOA/private/galleries/get-gallery.bru
Normal file
16
bruno/SOA/private/galleries/get-gallery.bru
Normal file
@ -0,0 +1,16 @@
|
||||
meta {
|
||||
name: Get Gallery Details
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/gallery/1
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
16
bruno/SOA/private/galleries/list-galleries.bru
Normal file
16
bruno/SOA/private/galleries/list-galleries.bru
Normal file
@ -0,0 +1,16 @@
|
||||
meta {
|
||||
name: List All Galleries
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/galleries
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
16
bruno/SOA/private/galleries/my-galleries.bru
Normal file
16
bruno/SOA/private/galleries/my-galleries.bru
Normal file
@ -0,0 +1,16 @@
|
||||
meta {
|
||||
name: Get My Galleries
|
||||
type: http
|
||||
seq: 5
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/galleries/mine
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
25
bruno/SOA/private/galleries/update-gallery.bru
Normal file
25
bruno/SOA/private/galleries/update-gallery.bru
Normal file
@ -0,0 +1,25 @@
|
||||
meta {
|
||||
name: Update Gallery
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
put {
|
||||
url: {{baseUrl}}/gallery/1
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"title": "Updated Modern Art Collection",
|
||||
"description": "An updated curated collection of contemporary artworks",
|
||||
"is_public": false
|
||||
}
|
||||
}
|
||||
25
bruno/SOA/private/gallery-reviews/create-gallery-review.bru
Normal file
25
bruno/SOA/private/gallery-reviews/create-gallery-review.bru
Normal file
@ -0,0 +1,25 @@
|
||||
meta {
|
||||
name: Create Gallery Review
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{baseUrl}}/gallery/1/review
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"grade": 5,
|
||||
"description": "Excellent gallery with amazing artwork collection!",
|
||||
"parent_gr_id": null
|
||||
}
|
||||
}
|
||||
16
bruno/SOA/private/gallery-reviews/gallery-reviews.bru
Normal file
16
bruno/SOA/private/gallery-reviews/gallery-reviews.bru
Normal file
@ -0,0 +1,16 @@
|
||||
meta {
|
||||
name: Get Gallery Reviews
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/gallery/1/reviews
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
16
bruno/SOA/private/gallery-reviews/given-gallery-reviews.bru
Normal file
16
bruno/SOA/private/gallery-reviews/given-gallery-reviews.bru
Normal file
@ -0,0 +1,16 @@
|
||||
meta {
|
||||
name: Get Given Gallery Reviews
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/galleries/reviews/given
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
meta {
|
||||
name: Get Received Gallery Reviews
|
||||
type: http
|
||||
seq: 5
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/galleries/reviews/received
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
24
bruno/SOA/private/gallery-reviews/update-gallery-review.bru
Normal file
24
bruno/SOA/private/gallery-reviews/update-gallery-review.bru
Normal file
@ -0,0 +1,24 @@
|
||||
meta {
|
||||
name: Update Gallery Review
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
put {
|
||||
url: {{baseUrl}}/galleries/review/1
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"grade": 4,
|
||||
"description": "Updated: Very good gallery with great artwork collection!"
|
||||
}
|
||||
}
|
||||
24
bruno/SOA/private/invitations/invite-user.bru
Normal file
24
bruno/SOA/private/invitations/invite-user.bru
Normal file
@ -0,0 +1,24 @@
|
||||
meta {
|
||||
name: Invite User to Gallery
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{baseUrl}}/gallery/1/invite
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"user_id": 2,
|
||||
"role": "viewer"
|
||||
}
|
||||
}
|
||||
16
bruno/SOA/private/invitations/received-invitations.bru
Normal file
16
bruno/SOA/private/invitations/received-invitations.bru
Normal file
@ -0,0 +1,16 @@
|
||||
meta {
|
||||
name: Get Received Invitations
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/invitations/received
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
23
bruno/SOA/private/invitations/respond-invitation.bru
Normal file
23
bruno/SOA/private/invitations/respond-invitation.bru
Normal file
@ -0,0 +1,23 @@
|
||||
meta {
|
||||
name: Respond to Invitation
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
put {
|
||||
url: {{baseUrl}}/invitations/1/respond
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"status": "accepted"
|
||||
}
|
||||
}
|
||||
16
bruno/SOA/private/user/get-me.bru
Normal file
16
bruno/SOA/private/user/get-me.bru
Normal file
@ -0,0 +1,16 @@
|
||||
meta {
|
||||
name: Get My Profile
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/me
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
25
bruno/SOA/private/user/update-me.bru
Normal file
25
bruno/SOA/private/user/update-me.bru
Normal file
@ -0,0 +1,25 @@
|
||||
meta {
|
||||
name: Update My Profile
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
put {
|
||||
url: {{baseUrl}}/me
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"alias": "Alexis Updated",
|
||||
"first_name": "Alexis",
|
||||
"last_name": "Doe",
|
||||
"bio": "Art enthusiast and gallery curator",
|
||||
"profile_picture_url": "https://example.com/avatar.jpg"
|
||||
}
|
||||
}
|
||||
765
bruno/bruno.sh
Executable file
765
bruno/bruno.sh
Executable file
@ -0,0 +1,765 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Bruno API Collection Generator for Private API
|
||||
# Creates a complete Bruno collection structure for testing the private API endpoints
|
||||
|
||||
set -e
|
||||
|
||||
# Configuration
|
||||
COLLECTION_NAME="private"
|
||||
BASE_URL="https://api.local/api/private"
|
||||
DEFAULT_EMAIL="alexis@example.com"
|
||||
DEFAULT_USERNAME="alexis"
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo_info() {
|
||||
echo -e "${BLUE}ℹ️ $1${NC}"
|
||||
}
|
||||
|
||||
echo_success() {
|
||||
echo -e "${GREEN}✅ $1${NC}"
|
||||
}
|
||||
|
||||
echo_warning() {
|
||||
echo -e "${YELLOW}⚠️ $1${NC}"
|
||||
}
|
||||
|
||||
echo_error() {
|
||||
echo -e "${RED}❌ $1${NC}"
|
||||
}
|
||||
|
||||
# Function to create directory structure
|
||||
create_directories() {
|
||||
local base_dir="$1"
|
||||
|
||||
echo_info "Creating directory structure..."
|
||||
|
||||
mkdir -p "${base_dir}"/{environments,auth,user,invitations,galleries,artworks,gallery-reviews,artwork-reviews}
|
||||
|
||||
echo_success "Directory structure created"
|
||||
}
|
||||
|
||||
# Function to create a file with content
|
||||
create_file() {
|
||||
local filepath="$1"
|
||||
local content="$2"
|
||||
|
||||
echo "$content" > "$filepath"
|
||||
echo_success "Created: $filepath"
|
||||
}
|
||||
|
||||
# Generate collection files
|
||||
generate_files() {
|
||||
local base_dir="$1"
|
||||
|
||||
echo_info "Generating Bruno collection files..."
|
||||
|
||||
# Main collection file
|
||||
cat > "${base_dir}/bruno.json" << EOF
|
||||
{
|
||||
"version": "1",
|
||||
"name": "Private API",
|
||||
"type": "collection"
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/bruno.json"
|
||||
|
||||
# Environment file
|
||||
cat > "${base_dir}/environments/local.bru" << EOF
|
||||
vars {
|
||||
baseUrl: ${BASE_URL}
|
||||
email: ${DEFAULT_EMAIL}
|
||||
username: ${DEFAULT_USERNAME}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/environments/local.bru"
|
||||
|
||||
# Auth files
|
||||
cat > "${base_dir}/auth/debug-headers.bru" << 'EOF'
|
||||
meta {
|
||||
name: Debug Headers
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/debug-headers
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/auth/debug-headers.bru"
|
||||
|
||||
cat > "${base_dir}/auth/redirect.bru" << 'EOF'
|
||||
meta {
|
||||
name: OIDC Redirect
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/redirect
|
||||
}
|
||||
|
||||
params:query {
|
||||
code: authorization_code_here
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/auth/redirect.bru"
|
||||
|
||||
# User files
|
||||
cat > "${base_dir}/user/get-me.bru" << 'EOF'
|
||||
meta {
|
||||
name: Get My Profile
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/me
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/user/get-me.bru"
|
||||
|
||||
cat > "${base_dir}/user/update-me.bru" << 'EOF'
|
||||
meta {
|
||||
name: Update My Profile
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
put {
|
||||
url: {{baseUrl}}/me
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"alias": "Alexis Updated",
|
||||
"first_name": "Alexis",
|
||||
"last_name": "Doe",
|
||||
"bio": "Art enthusiast and gallery curator",
|
||||
"profile_picture_url": "https://example.com/avatar.jpg"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/user/update-me.bru"
|
||||
|
||||
# Invitation files
|
||||
cat > "${base_dir}/invitations/invite-user.bru" << 'EOF'
|
||||
meta {
|
||||
name: Invite User to Gallery
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{baseUrl}}/gallery/1/invite
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"user_id": 2,
|
||||
"role": "viewer"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/invitations/invite-user.bru"
|
||||
|
||||
cat > "${base_dir}/invitations/respond-invitation.bru" << 'EOF'
|
||||
meta {
|
||||
name: Respond to Invitation
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
put {
|
||||
url: {{baseUrl}}/invitations/1/respond
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"status": "accepted"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/invitations/respond-invitation.bru"
|
||||
|
||||
cat > "${base_dir}/invitations/received-invitations.bru" << 'EOF'
|
||||
meta {
|
||||
name: Get Received Invitations
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/invitations/received
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/invitations/received-invitations.bru"
|
||||
|
||||
# Gallery files
|
||||
cat > "${base_dir}/galleries/list-galleries.bru" << 'EOF'
|
||||
meta {
|
||||
name: List All Galleries
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/galleries
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/galleries/list-galleries.bru"
|
||||
|
||||
cat > "${base_dir}/galleries/get-gallery.bru" << 'EOF'
|
||||
meta {
|
||||
name: Get Gallery Details
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/gallery/1
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/galleries/get-gallery.bru"
|
||||
|
||||
cat > "${base_dir}/galleries/create-gallery.bru" << 'EOF'
|
||||
meta {
|
||||
name: Create Gallery
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{baseUrl}}/gallery
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"title": "Modern Art Collection",
|
||||
"description": "A curated collection of contemporary artworks",
|
||||
"is_public": true,
|
||||
"publication_date": "2025-06-28T10:00:00Z"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/galleries/create-gallery.bru"
|
||||
|
||||
cat > "${base_dir}/galleries/update-gallery.bru" << 'EOF'
|
||||
meta {
|
||||
name: Update Gallery
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
put {
|
||||
url: {{baseUrl}}/gallery/1
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"title": "Updated Modern Art Collection",
|
||||
"description": "An updated curated collection of contemporary artworks",
|
||||
"is_public": false
|
||||
}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/galleries/update-gallery.bru"
|
||||
|
||||
cat > "${base_dir}/galleries/my-galleries.bru" << 'EOF'
|
||||
meta {
|
||||
name: Get My Galleries
|
||||
type: http
|
||||
seq: 5
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/galleries/mine
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/galleries/my-galleries.bru"
|
||||
|
||||
cat > "${base_dir}/galleries/gallery-members.bru" << 'EOF'
|
||||
meta {
|
||||
name: Get Gallery Members
|
||||
type: http
|
||||
seq: 6
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/gallery/1/members
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/galleries/gallery-members.bru"
|
||||
|
||||
# Artwork files
|
||||
cat > "${base_dir}/artworks/gallery-artworks.bru" << 'EOF'
|
||||
meta {
|
||||
name: Get Gallery Artworks
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/gallery/1/artworks
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/artworks/gallery-artworks.bru"
|
||||
|
||||
cat > "${base_dir}/artworks/get-artwork.bru" << 'EOF'
|
||||
meta {
|
||||
name: Get Artwork Details
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/artwork/1
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/artworks/get-artwork.bru"
|
||||
|
||||
cat > "${base_dir}/artworks/create-artwork.bru" << 'EOF'
|
||||
meta {
|
||||
name: Create Artwork
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{baseUrl}}/gallery/1/artwork
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"title": "Sunset Over Mountains",
|
||||
"description": "A beautiful landscape painting capturing the golden hour",
|
||||
"image_url": "https://example.com/artwork1.jpg",
|
||||
"medium": "Oil on Canvas",
|
||||
"dimensions": "24x36 inches",
|
||||
"creation_year": 2024,
|
||||
"price": 1500.00,
|
||||
"is_visible": true,
|
||||
"is_for_sale": true
|
||||
}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/artworks/create-artwork.bru"
|
||||
|
||||
cat > "${base_dir}/artworks/update-artwork.bru" << 'EOF'
|
||||
meta {
|
||||
name: Update Artwork
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
put {
|
||||
url: {{baseUrl}}/artwork/1
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"title": "Updated Sunset Over Mountains",
|
||||
"description": "An updated beautiful landscape painting",
|
||||
"price": 1800.00,
|
||||
"is_for_sale": false
|
||||
}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/artworks/update-artwork.bru"
|
||||
|
||||
cat > "${base_dir}/artworks/my-artworks.bru" << 'EOF'
|
||||
meta {
|
||||
name: Get My Artworks
|
||||
type: http
|
||||
seq: 5
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/artworks/mine
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/artworks/my-artworks.bru"
|
||||
|
||||
# Gallery review files
|
||||
cat > "${base_dir}/gallery-reviews/gallery-reviews.bru" << 'EOF'
|
||||
meta {
|
||||
name: Get Gallery Reviews
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/gallery/1/reviews
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/gallery-reviews/gallery-reviews.bru"
|
||||
|
||||
cat > "${base_dir}/gallery-reviews/create-gallery-review.bru" << 'EOF'
|
||||
meta {
|
||||
name: Create Gallery Review
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{baseUrl}}/gallery/1/review
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"grade": 5,
|
||||
"description": "Excellent gallery with amazing artwork collection!",
|
||||
"parent_gr_id": null
|
||||
}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/gallery-reviews/create-gallery-review.bru"
|
||||
|
||||
cat > "${base_dir}/gallery-reviews/update-gallery-review.bru" << 'EOF'
|
||||
meta {
|
||||
name: Update Gallery Review
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
put {
|
||||
url: {{baseUrl}}/galleries/review/1
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"grade": 4,
|
||||
"description": "Updated: Very good gallery with great artwork collection!"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/gallery-reviews/update-gallery-review.bru"
|
||||
|
||||
cat > "${base_dir}/gallery-reviews/given-gallery-reviews.bru" << 'EOF'
|
||||
meta {
|
||||
name: Get Given Gallery Reviews
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/galleries/reviews/given
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/gallery-reviews/given-gallery-reviews.bru"
|
||||
|
||||
cat > "${base_dir}/gallery-reviews/received-gallery-reviews.bru" << 'EOF'
|
||||
meta {
|
||||
name: Get Received Gallery Reviews
|
||||
type: http
|
||||
seq: 5
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/galleries/reviews/received
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/gallery-reviews/received-gallery-reviews.bru"
|
||||
|
||||
# Artwork review files
|
||||
cat > "${base_dir}/artwork-reviews/artwork-reviews.bru" << 'EOF'
|
||||
meta {
|
||||
name: Get Artwork Reviews
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/artwork/1/reviews
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/artwork-reviews/artwork-reviews.bru"
|
||||
|
||||
cat > "${base_dir}/artwork-reviews/create-artwork-review.bru" << 'EOF'
|
||||
meta {
|
||||
name: Create Artwork Review
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{baseUrl}}/artwork/1/review
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"grade": 5,
|
||||
"description": "Absolutely stunning artwork! The colors and technique are magnificent.",
|
||||
"parent_ar_id": null
|
||||
}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/artwork-reviews/create-artwork-review.bru"
|
||||
|
||||
cat > "${base_dir}/artwork-reviews/update-artwork-review.bru" << 'EOF'
|
||||
meta {
|
||||
name: Update Artwork Review
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
put {
|
||||
url: {{baseUrl}}/artworks/review/1
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
Content-Type: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"grade": 4,
|
||||
"description": "Updated: Very beautiful artwork! Great technique and composition."
|
||||
}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/artwork-reviews/update-artwork-review.bru"
|
||||
|
||||
cat > "${base_dir}/artwork-reviews/given-artwork-reviews.bru" << 'EOF'
|
||||
meta {
|
||||
name: Get Given Artwork Reviews
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/artworks/reviews/given
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/artwork-reviews/given-artwork-reviews.bru"
|
||||
|
||||
cat > "${base_dir}/artwork-reviews/received-artwork-reviews.bru" << 'EOF'
|
||||
meta {
|
||||
name: Get Received Artwork Reviews
|
||||
type: http
|
||||
seq: 5
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{baseUrl}}/artworks/reviews/received
|
||||
}
|
||||
|
||||
headers {
|
||||
OIDC_email: {{email}}
|
||||
OIDC_user: {{username}}
|
||||
}
|
||||
EOF
|
||||
echo_success "Created: ${base_dir}/artwork-reviews/received-artwork-reviews.bru"
|
||||
}
|
||||
|
||||
# Main function
|
||||
main() {
|
||||
echo_info "🚀 Generating Bruno API Collection for Private API..."
|
||||
echo_info "📁 Collection name: ${COLLECTION_NAME}"
|
||||
echo_info "🌐 Base URL: ${BASE_URL}"
|
||||
echo_info "👤 Default user: ${DEFAULT_USERNAME} (${DEFAULT_EMAIL})"
|
||||
echo ""
|
||||
|
||||
# Get current directory or use provided path
|
||||
local target_dir="${1:-$(pwd)}"
|
||||
local base_dir="${target_dir}/${COLLECTION_NAME}"
|
||||
|
||||
echo_info "📍 Creating collection in: ${base_dir}"
|
||||
echo ""
|
||||
|
||||
# Create directory structure
|
||||
create_directories "$base_dir"
|
||||
echo ""
|
||||
|
||||
# Generate all files
|
||||
generate_files "$base_dir"
|
||||
echo ""
|
||||
|
||||
echo_success "Bruno collection generated successfully!"
|
||||
echo ""
|
||||
echo_info "📋 Next steps:"
|
||||
echo " 1. Open Bruno and import the collection"
|
||||
echo " 2. Select the 'local' environment"
|
||||
echo " 3. Update variables in environments/local.bru if needed"
|
||||
echo " 4. Start testing with auth/debug-headers.bru"
|
||||
echo ""
|
||||
echo_info "🔧 To customize:"
|
||||
echo " - Edit environments/local.bru to change baseUrl, email, username"
|
||||
echo " - Update gallery/artwork IDs in individual requests"
|
||||
echo " - Modify request bodies to match your test data"
|
||||
echo ""
|
||||
echo_warning "💡 Don't forget to update the OIDC headers if your user changes!"
|
||||
}
|
||||
|
||||
# Help function
|
||||
show_help() {
|
||||
echo "Bruno API Collection Generator"
|
||||
echo ""
|
||||
echo "Usage: $0 [target_directory]"
|
||||
echo ""
|
||||
echo "Arguments:"
|
||||
echo " target_directory Directory where to create the collection (default: current directory)"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " $0 # Create in current directory"
|
||||
echo " $0 ~/bruno # Create in ~/bruno directory"
|
||||
echo " $0 /path/to/bruno # Create in specific path"
|
||||
echo ""
|
||||
echo "Configuration (edit script to change):"
|
||||
echo " Collection name: ${COLLECTION_NAME}"
|
||||
echo " Base URL: ${BASE_URL}"
|
||||
echo " Default email: ${DEFAULT_EMAIL}"
|
||||
echo " Default username: ${DEFAULT_USERNAME}"
|
||||
}
|
||||
|
||||
# Check for help flag
|
||||
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||
show_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Run main function
|
||||
main "$@"}
|
||||
@ -1,6 +1,7 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
|
||||
keycloak-db:
|
||||
image: postgres:15
|
||||
environment:
|
||||
@ -44,7 +45,7 @@ services:
|
||||
networks:
|
||||
- soa
|
||||
|
||||
user_api:
|
||||
private_api:
|
||||
build:
|
||||
context: ./private
|
||||
depends_on:
|
||||
@ -65,7 +66,7 @@ services:
|
||||
depends_on:
|
||||
- keycloak
|
||||
- public_api
|
||||
- user_api
|
||||
- private_api
|
||||
volumes:
|
||||
- ./apache/logs:/usr/local/apache2/conf/logs
|
||||
environment:
|
||||
@ -103,3 +104,4 @@ volumes:
|
||||
postgres_data:
|
||||
mysql_data:
|
||||
|
||||
|
||||
|
||||
166
keyclock-setup.sh
Executable file
166
keyclock-setup.sh
Executable file
@ -0,0 +1,166 @@
|
||||
#!/bin/bash
|
||||
# Variables
|
||||
KC_HOST="http://localhost:8080"
|
||||
REALM="master"
|
||||
CLIENT_ID="soa"
|
||||
CLIENT_SECRET="mysecret"
|
||||
USERNAME="alexis"
|
||||
PASSWORD="password"
|
||||
USERNAME2="fabio"
|
||||
PASSWORD2="password"
|
||||
PERSONAL_TOKEN="personaltoken"
|
||||
PERSONAL_TOKEN2="personaltoken2"
|
||||
|
||||
# Fonction d'attente
|
||||
wait_for_keycloak() {
|
||||
echo "⏳ Attente de Keycloak..."
|
||||
until curl -s "$KC_HOST" > /dev/null; do
|
||||
sleep 2
|
||||
done
|
||||
echo "✅ Keycloak est prêt."
|
||||
}
|
||||
|
||||
# Obtenir un token admin
|
||||
get_admin_token() {
|
||||
curl -s -X POST "$KC_HOST/realms/master/protocol/openid-connect/token" \
|
||||
-H "Content-Type: application/x-www-form-urlencoded" \
|
||||
-d "username=admin" \
|
||||
-d "password=admin" \
|
||||
-d "grant_type=password" \
|
||||
-d "client_id=admin-cli" |
|
||||
jq -r .access_token
|
||||
}
|
||||
|
||||
# Générer une date d'expiration (1 an à partir de maintenant)
|
||||
generate_expiry_date() {
|
||||
date -d "+1 year" --iso-8601=seconds
|
||||
}
|
||||
|
||||
# Créer un realm, client et utilisateur
|
||||
setup_keycloak() {
|
||||
TOKEN=$(get_admin_token)
|
||||
CURRENT_DATE=$(date --iso-8601=seconds)
|
||||
EXPIRY_DATE=$(generate_expiry_date)
|
||||
|
||||
echo "🛠️ Création du realm $REALM..."
|
||||
curl -s -X POST "$KC_HOST/admin/realms" \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"realm\":\"$REALM\",\"enabled\":true}" > /dev/null
|
||||
|
||||
echo "🛠️ Configuration des durées de vie des tokens..."
|
||||
curl -s -X PUT "$KC_HOST/admin/realms/$REALM" \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"accessTokenLifespan\": 3600,
|
||||
\"refreshTokenMaxReuse\": 0,
|
||||
\"ssoSessionIdleTimeout\": 7200,
|
||||
\"ssoSessionMaxLifespan\": 36000,
|
||||
\"offlineSessionIdleTimeout\": 2592000
|
||||
}" > /dev/null
|
||||
|
||||
echo "🛠️ Création du client $CLIENT_ID..."
|
||||
curl -s -X POST "$KC_HOST/admin/realms/$REALM/clients" \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"clientId\": \"$CLIENT_ID\",
|
||||
\"enabled\": true,
|
||||
\"publicClient\": false,
|
||||
\"secret\": \"$CLIENT_SECRET\",
|
||||
\"redirectUris\": [\"*\"],
|
||||
\"standardFlowEnabled\": true,
|
||||
\"directAccessGrantsEnabled\": true,
|
||||
\"serviceAccountsEnabled\": true,
|
||||
\"authorizationServicesEnabled\": false
|
||||
}"
|
||||
|
||||
echo "👤 Création de l'utilisateur $USERNAME avec token personnel..."
|
||||
curl -s -X POST "$KC_HOST/admin/realms/$REALM/users" \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"username\": \"$USERNAME\",
|
||||
\"enabled\": true,
|
||||
\"emailVerified\": true,
|
||||
\"attributes\": {
|
||||
\"api_token\": [\"$PERSONAL_TOKEN\"],
|
||||
\"token_created\": [\"$CURRENT_DATE\"],
|
||||
\"token_expires\": [\"$EXPIRY_DATE\"],
|
||||
\"created_by\": [\"setup_script\"],
|
||||
\"department\": [\"IT\"],
|
||||
\"access_level\": [\"developer\"]
|
||||
},
|
||||
\"credentials\": [{
|
||||
\"type\": \"password\",
|
||||
\"value\": \"$PASSWORD\",
|
||||
\"temporary\": false
|
||||
}]
|
||||
}"
|
||||
|
||||
echo "👤 Création du deuxième utilisateur $USERNAME2..."
|
||||
curl -s -X POST "$KC_HOST/admin/realms/$REALM/users" \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"username\": \"$USERNAME2\",
|
||||
\"enabled\": true,
|
||||
\"emailVerified\": true,
|
||||
\"email\": \"fabio@example.com\",
|
||||
\"firstName\": \"Fabio\",
|
||||
\"lastName\": \"Artist\",
|
||||
\"attributes\": {
|
||||
\"api_token\": [\"$PERSONAL_TOKEN2\"],
|
||||
\"token_created\": [\"$CURRENT_DATE\"],
|
||||
\"token_expires\": [\"$EXPIRY_DATE\"],
|
||||
\"created_by\": [\"setup_script\"],
|
||||
\"department\": [\"Artist\"],
|
||||
\"access_level\": [\"user\"]
|
||||
},
|
||||
\"credentials\": [{
|
||||
\"type\": \"password\",
|
||||
\"value\": \"$PASSWORD2\",
|
||||
\"temporary\": false
|
||||
}]
|
||||
}"
|
||||
|
||||
echo "✅ Configuration terminée !"
|
||||
echo ""
|
||||
echo "👥 Utilisateurs créés:"
|
||||
echo "🔐 Utilisateur 1: $USERNAME / $PASSWORD"
|
||||
echo "🔐 Utilisateur 2: $USERNAME2 / $PASSWORD2"
|
||||
echo ""
|
||||
echo "🪪 Client secret: $CLIENT_SECRET"
|
||||
echo "🎫 Personal Access Token 1: $PERSONAL_TOKEN"
|
||||
echo "🎫 Personal Access Token 2: $PERSONAL_TOKEN2"
|
||||
echo "📅 Tokens créés le: $CURRENT_DATE"
|
||||
echo "⏰ Tokens expirent le: $EXPIRY_DATE"
|
||||
echo ""
|
||||
echo "⏱️ Token Settings:"
|
||||
echo " • Access Token Lifespan: 3600 seconds (1 hour)"
|
||||
echo " • Direct Access Grants: ENABLED"
|
||||
echo " • SSO Session Timeout: 7200 seconds (2 hours)"
|
||||
}
|
||||
|
||||
# Fonction pour tester les tokens
|
||||
test_personal_token() {
|
||||
echo ""
|
||||
echo "🧪 Test des tokens:"
|
||||
echo ""
|
||||
echo "Token pour Alexis:"
|
||||
echo "curl -k -X POST http://auth.local:8080/realms/master/protocol/openid-connect/token \\"
|
||||
echo " -H \"Content-Type: application/x-www-form-urlencoded\" \\"
|
||||
echo " -d \"grant_type=password&client_id=soa&client_secret=mysecret&username=$USERNAME&password=$PASSWORD\""
|
||||
echo ""
|
||||
echo "Token pour Fabio:"
|
||||
echo "curl -k -X POST http://auth.local:8080/realms/master/protocol/openid-connect/token \\"
|
||||
echo " -H \"Content-Type: application/x-www-form-urlencoded\" \\"
|
||||
echo " -d \"grant_type=password&client_id=soa&client_secret=mysecret&username=$USERNAME2&password=$PASSWORD2\""
|
||||
echo ""
|
||||
}
|
||||
|
||||
# Lancer le setup
|
||||
wait_for_keycloak
|
||||
setup_keycloak
|
||||
test_personal_token
|
||||
@ -3,7 +3,7 @@ FROM python:3.11-slim
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
|
||||
RUN pip install flask flask_sqlalchemy pyjwt requests pymysql cryptography redis
|
||||
RUN pip install flask flask_sqlalchemy pyjwt requests pymysql cryptography redis python-jose
|
||||
|
||||
CMD ["python", "app.py"]
|
||||
|
||||
|
||||
1019
private/app.py
1019
private/app.py
File diff suppressed because it is too large
Load Diff
18
public/.editorconfig
Normal file
18
public/.editorconfig
Normal file
@ -0,0 +1,18 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
|
||||
[docker-compose.yml]
|
||||
indent_size = 4
|
||||
65
public/.env.example
Normal file
65
public/.env.example
Normal file
@ -0,0 +1,65 @@
|
||||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
APP_LOCALE=en
|
||||
APP_FALLBACK_LOCALE=en
|
||||
APP_FAKER_LOCALE=en_US
|
||||
|
||||
APP_MAINTENANCE_DRIVER=file
|
||||
# APP_MAINTENANCE_STORE=database
|
||||
|
||||
PHP_CLI_SERVER_WORKERS=4
|
||||
|
||||
BCRYPT_ROUNDS=12
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_STACK=single
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=laravel
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
SESSION_DRIVER=database
|
||||
SESSION_LIFETIME=120
|
||||
SESSION_ENCRYPT=false
|
||||
SESSION_PATH=/
|
||||
SESSION_DOMAIN=null
|
||||
|
||||
BROADCAST_CONNECTION=log
|
||||
FILESYSTEM_DISK=local
|
||||
QUEUE_CONNECTION=database
|
||||
|
||||
CACHE_STORE=database
|
||||
# CACHE_PREFIX=
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_CLIENT=phpredis
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=log
|
||||
MAIL_SCHEME=null
|
||||
MAIL_HOST=127.0.0.1
|
||||
MAIL_PORT=2525
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_FROM_ADDRESS="hello@example.com"
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
VITE_APP_NAME="${APP_NAME}"
|
||||
11
public/.gitattributes
vendored
Normal file
11
public/.gitattributes
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
* text=auto eol=lf
|
||||
|
||||
*.blade.php diff=html
|
||||
*.css diff=css
|
||||
*.html diff=html
|
||||
*.md diff=markdown
|
||||
*.php diff=php
|
||||
|
||||
/.github export-ignore
|
||||
CHANGELOG.md export-ignore
|
||||
.styleci.yml export-ignore
|
||||
24
public/.gitignore
vendored
Normal file
24
public/.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
*.log
|
||||
.DS_Store
|
||||
.env
|
||||
.env.backup
|
||||
.env.production
|
||||
.phpactor.json
|
||||
.phpunit.result.cache
|
||||
/.fleet
|
||||
/.idea
|
||||
/.nova
|
||||
/.phpunit.cache
|
||||
/.vscode
|
||||
/.zed
|
||||
/auth.json
|
||||
/node_modules
|
||||
/public/build
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/storage/pail
|
||||
/vendor
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
Thumbs.db
|
||||
@ -1,9 +1,73 @@
|
||||
FROM python:3.11-slim
|
||||
# ---------- Stage 1: Build with Composer ----------
|
||||
FROM php:8.2-cli-alpine AS build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install Composer and build dependencies
|
||||
RUN apk add --no-cache \
|
||||
libzip-dev zip unzip curl git oniguruma-dev libxml2-dev
|
||||
|
||||
# Install PHP extensions for Laravel
|
||||
RUN docker-php-ext-install zip mbstring xml
|
||||
|
||||
# Install Composer
|
||||
RUN curl -sS https://getcomposer.org/installer | php && \
|
||||
mv composer.phar /usr/local/bin/composer
|
||||
|
||||
# Copy project files and install dependencies
|
||||
COPY . .
|
||||
RUN composer install --no-dev --optimize-autoloader --no-interaction
|
||||
|
||||
RUN pip install redis flask flask_sqlalchemy pyjwt requests pymysql cryptography
|
||||
|
||||
CMD ["python", "app.py"]
|
||||
# ---------- Stage 2: Production Image ----------
|
||||
FROM php:8.2-fpm-alpine
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /var/www
|
||||
|
||||
# Install system and PHP dependencies
|
||||
RUN apk add --no-cache \
|
||||
nginx \
|
||||
supervisor \
|
||||
bash \
|
||||
mysql-client \
|
||||
libpng-dev \
|
||||
libjpeg-turbo-dev \
|
||||
freetype-dev \
|
||||
libxml2-dev \
|
||||
oniguruma-dev \
|
||||
libzip-dev \
|
||||
curl \
|
||||
git \
|
||||
openssh \
|
||||
php-pear \
|
||||
gcc g++ make autoconf libtool linux-headers
|
||||
|
||||
# Install PHP extensions
|
||||
RUN docker-php-ext-configure gd --with-freetype --with-jpeg && \
|
||||
docker-php-ext-install pdo pdo_mysql mbstring gd xml zip && \
|
||||
pecl install redis && \
|
||||
docker-php-ext-enable redis
|
||||
|
||||
|
||||
# Clean up build tools
|
||||
RUN apk del gcc g++ make autoconf libtool
|
||||
|
||||
# Install Ansible
|
||||
RUN apk add --no-cache ansible
|
||||
# Copy built app from previous stage
|
||||
COPY --from=build /app /var/www
|
||||
|
||||
# Set proper permissions for Laravel
|
||||
RUN chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache /var/www/database && \
|
||||
chmod -R 755 /var/www/storage /var/www/bootstrap/cache /var/www/database
|
||||
|
||||
# Copy config files
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
COPY supervisord.conf /etc/supervisord.conf
|
||||
|
||||
# Expose HTTP port
|
||||
EXPOSE 80
|
||||
|
||||
# Start services
|
||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
|
||||
|
||||
61
public/README.md
Normal file
61
public/README.md
Normal file
@ -0,0 +1,61 @@
|
||||
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
|
||||
</p>
|
||||
|
||||
## About Laravel
|
||||
|
||||
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
|
||||
|
||||
- [Simple, fast routing engine](https://laravel.com/docs/routing).
|
||||
- [Powerful dependency injection container](https://laravel.com/docs/container).
|
||||
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
|
||||
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
|
||||
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
|
||||
- [Robust background job processing](https://laravel.com/docs/queues).
|
||||
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
|
||||
|
||||
Laravel is accessible, powerful, and provides tools required for large, robust applications.
|
||||
|
||||
## Learning Laravel
|
||||
|
||||
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
|
||||
|
||||
You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
|
||||
|
||||
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
|
||||
|
||||
## Laravel Sponsors
|
||||
|
||||
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
|
||||
|
||||
### Premium Partners
|
||||
|
||||
- **[Vehikl](https://vehikl.com)**
|
||||
- **[Tighten Co.](https://tighten.co)**
|
||||
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
|
||||
- **[64 Robots](https://64robots.com)**
|
||||
- **[Curotec](https://www.curotec.com/services/technologies/laravel)**
|
||||
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
|
||||
- **[Redberry](https://redberry.international/laravel-development)**
|
||||
- **[Active Logic](https://activelogic.com)**
|
||||
|
||||
## Contributing
|
||||
|
||||
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
|
||||
|
||||
## License
|
||||
|
||||
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||
@ -1,76 +0,0 @@
|
||||
import time
|
||||
import pymysql
|
||||
from flask import Flask, jsonify
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
import redis
|
||||
import json
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://myuser:mypassword@mysql:3306/mydb'
|
||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
||||
|
||||
db = SQLAlchemy(app)
|
||||
|
||||
MYSQL_HOST = "mysql"
|
||||
MYSQL_PORT = 3306
|
||||
MYSQL_USER = "myuser"
|
||||
MYSQL_PASSWORD = "mypassword"
|
||||
MYSQL_DB = "mydb"
|
||||
|
||||
# Connexion Redis
|
||||
redis_client = redis.Redis(host='redis', port=6379, decode_responses=True)
|
||||
|
||||
while True:
|
||||
try:
|
||||
conn = pymysql.connect(
|
||||
host=MYSQL_HOST,
|
||||
port=MYSQL_PORT,
|
||||
user=MYSQL_USER,
|
||||
password=MYSQL_PASSWORD,
|
||||
database=MYSQL_DB
|
||||
)
|
||||
conn.close()
|
||||
print("MySQL is up - continuing.")
|
||||
break
|
||||
except pymysql.err.OperationalError as e:
|
||||
print("Waiting for MySQL...", e)
|
||||
time.sleep(2)
|
||||
|
||||
class Artiste(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
nom = db.Column(db.String(100), nullable=False)
|
||||
|
||||
class Galerie(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
nom = db.Column(db.String(100), nullable=False)
|
||||
|
||||
class Oeuvre(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
titre = db.Column(db.String(200), nullable=False)
|
||||
exposee = db.Column(db.Boolean, default=False)
|
||||
|
||||
@app.route("/", methods=["GET"])
|
||||
def index():
|
||||
return "Public API", 200
|
||||
|
||||
@app.route("/artistes", methods=["GET"])
|
||||
def get_artistes():
|
||||
artistes = Artiste.query.all()
|
||||
return jsonify([{"id": a.id, "nom": a.nom} for a in artistes]), 200
|
||||
|
||||
@app.route("/galeries", methods=["GET"])
|
||||
def get_galeries():
|
||||
galeries = Galerie.query.all()
|
||||
return jsonify([{"id": g.id, "nom": g.nom} for g in galeries]), 200
|
||||
|
||||
@app.route("/oeuvres", methods=["GET"])
|
||||
def get_oeuvres():
|
||||
oeuvres = Oeuvre.query.filter_by(exposee=True).all()
|
||||
return jsonify([{"id": o.id, "titre": o.titre} for o in oeuvres]), 200
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with app.app_context():
|
||||
db.create_all()
|
||||
app.run(host='0.0.0.0',port=5001, debug=True)
|
||||
|
||||
25
public/app/Http/Controllers/Api/V1/ArtistController.php
Normal file
25
public/app/Http/Controllers/Api/V1/ArtistController.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\UserResource;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ArtistController extends Controller
|
||||
{
|
||||
/**
|
||||
* Affiche la liste des utilisateurs qui sont artistes.
|
||||
* Un "artiste" est défini comme un utilisateur qui possède au moins une galerie.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$artists = User::whereHas('ownedGalleries')
|
||||
->select('id', 'username', 'first_name', 'last_name', 'bio', 'profile_picture_url')
|
||||
->paginate(15);
|
||||
|
||||
|
||||
return UserResource::collection($artists);
|
||||
}
|
||||
}
|
||||
42
public/app/Http/Controllers/Api/V1/GalleryController.php
Normal file
42
public/app/Http/Controllers/Api/V1/GalleryController.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Gallery;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Resources\GalleryResource;
|
||||
|
||||
class GalleryController extends Controller
|
||||
{
|
||||
/**
|
||||
* Affiche la liste des galeries publiques.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$publicGalleries = Gallery::where('is_public', true)
|
||||
->with('owner:id,username,first_name,last_name') // Eager loading pour la performance
|
||||
->latest() // Trie par date de création (la plus récente d'abord)
|
||||
->paginate(15);
|
||||
|
||||
return GalleryResource::collection($publicGalleries);
|
||||
}
|
||||
|
||||
/**
|
||||
* Affiche les oeuvres d'une galerie spécifique, si elle est publique.
|
||||
*/
|
||||
public function showArtworks(Gallery $gallery)
|
||||
{
|
||||
// Vérification cruciale : la galerie doit être publique
|
||||
if (!$gallery->is_public) {
|
||||
return response()->json(['message' => 'Gallery not found.'], 404);
|
||||
}
|
||||
|
||||
$artworks = $gallery->artworks()
|
||||
->with('creator:id,username')
|
||||
->where('is_public', true)
|
||||
->paginate(15);
|
||||
|
||||
return response()->json($artworks);
|
||||
}
|
||||
}
|
||||
8
public/app/Http/Controllers/Controller.php
Normal file
8
public/app/Http/Controllers/Controller.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
abstract class Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
21
public/app/Http/Resources/ArtworkResource.php
Normal file
21
public/app/Http/Resources/ArtworkResource.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ArtworkResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'isPublic' => $this->is_public,
|
||||
'publishedOn' => $this->publication_date ? $this->publication_date->toIso8601String() : null,
|
||||
'owner' => new UserResource($this->whenLoaded('owner')), // Charge la ressource User si l'owner est chargé
|
||||
];
|
||||
}
|
||||
}
|
||||
21
public/app/Http/Resources/GalleryResource.php
Normal file
21
public/app/Http/Resources/GalleryResource.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class GalleryResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'isPublic' => $this->is_public,
|
||||
'publishedOn' => $this->publication_date,
|
||||
'owner' => new UserResource($this->whenLoaded('owner')), // Charge la ressource User si l'owner est chargé
|
||||
];
|
||||
}
|
||||
}
|
||||
20
public/app/Http/Resources/UserResource.php
Normal file
20
public/app/Http/Resources/UserResource.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class UserResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'username' => $this->username,
|
||||
'fullName' => $this->first_name . ' ' . $this->last_name,
|
||||
'bio' => $this->bio,
|
||||
'avatar' => $this->profile_picture_url,
|
||||
];
|
||||
}
|
||||
}
|
||||
41
public/app/Models/Artwork.php
Normal file
41
public/app/Models/Artwork.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Artwork extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'gallery_id',
|
||||
'creator_id',
|
||||
'title',
|
||||
'description',
|
||||
'image_url',
|
||||
'medium',
|
||||
'dimensions',
|
||||
'creation_year',
|
||||
'price',
|
||||
'is_visible',
|
||||
'is_for_sale',
|
||||
];
|
||||
|
||||
/**
|
||||
* Le créateur de l'oeuvre.
|
||||
*/
|
||||
public function creator()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'creator_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* La galerie à laquelle l'oeuvre appartient.
|
||||
*/
|
||||
public function gallery()
|
||||
{
|
||||
return $this->belongsTo(Gallery::class);
|
||||
}
|
||||
}
|
||||
35
public/app/Models/Gallery.php
Normal file
35
public/app/Models/Gallery.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Gallery extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'owner_id',
|
||||
'title',
|
||||
'description',
|
||||
'is_public',
|
||||
'publication_date',
|
||||
];
|
||||
|
||||
/**
|
||||
* Le propriétaire de la galerie.
|
||||
*/
|
||||
public function owner()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'owner_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Les oeuvres contenues dans cette galerie.
|
||||
*/
|
||||
public function artworks()
|
||||
{
|
||||
return $this->hasMany(Artwork::class);
|
||||
}
|
||||
}
|
||||
198
public/app/Models/User.php
Normal file
198
public/app/Models/User.php
Normal file
@ -0,0 +1,198 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use database\GalleryMember;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasFactory, Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'username',
|
||||
'email',
|
||||
'alias',
|
||||
'password_hash',
|
||||
'first_name',
|
||||
'last_name',
|
||||
'bio',
|
||||
'profile_picture_url'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password_hash',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the password for the user (Laravel Auth compatibility).
|
||||
*/
|
||||
public function getAuthPassword()
|
||||
{
|
||||
return $this->password_hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the password hash when setting password.
|
||||
*/
|
||||
public function setPasswordAttribute($password)
|
||||
{
|
||||
$this->attributes['password_hash'] = bcrypt($password);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user's full name.
|
||||
*/
|
||||
public function getFullNameAttribute(): string
|
||||
{
|
||||
return trim($this->first_name . ' ' . $this->last_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope pour rechercher par nom d'utilisateur ou email.
|
||||
*/
|
||||
public function scopeSearch($query, $search)
|
||||
{
|
||||
return $query->where('username', 'like', "%{$search}%")
|
||||
->orWhere('email', 'like', "%{$search}%")
|
||||
->orWhere('first_name', 'like', "%{$search}%")
|
||||
->orWhere('last_name', 'like', "%{$search}%");
|
||||
}
|
||||
|
||||
// ===== RELATIONS =====
|
||||
|
||||
/**
|
||||
* Galeries possédées par cet utilisateur.
|
||||
*/
|
||||
public function ownedGalleries()
|
||||
{
|
||||
return $this->hasMany(Gallery::class, 'owner_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Œuvres créées par cet utilisateur.
|
||||
*/
|
||||
public function artworks()
|
||||
{
|
||||
return $this->hasMany(Artwork::class, 'creator_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Galeries auxquelles cet utilisateur a accès (invitations).
|
||||
*/
|
||||
public function galleryMemberships()
|
||||
{
|
||||
return $this->hasMany(GalleryMember::class, 'user_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Galeries auxquelles l'utilisateur a accès avec statut accepté.
|
||||
*/
|
||||
public function accessibleGalleries()
|
||||
{
|
||||
return $this->belongsToMany(Gallery::class, 'gallery_members', 'user_id', 'gallery_id')
|
||||
->wherePivot('status', 'accepted')
|
||||
->withPivot(['role', 'status', 'invited_at', 'updated_at']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invitations en attente pour cet utilisateur.
|
||||
*/
|
||||
public function pendingInvitations()
|
||||
{
|
||||
return $this->belongsToMany(Gallery::class, 'gallery_members', 'user_id', 'gallery_id')
|
||||
->wherePivot('status', 'pending')
|
||||
->withPivot(['role', 'status', 'invited_at', 'updated_at']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifier si l'utilisateur peut accéder à une galerie.
|
||||
*/
|
||||
public function canAccessGallery($galleryId): bool
|
||||
{
|
||||
// Propriétaire de la galerie
|
||||
if ($this->ownedGalleries()->where('id', $galleryId)->exists()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Membre avec accès accepté
|
||||
return $this->galleryMemberships()
|
||||
->where('gallery_id', $galleryId)
|
||||
->where('status', 'accepted')
|
||||
->exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* Vérifier si l'utilisateur peut éditer une galerie.
|
||||
*/
|
||||
public function canEditGallery($galleryId): bool
|
||||
{
|
||||
// Propriétaire
|
||||
if ($this->ownedGalleries()->where('id', $galleryId)->exists()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Membre avec rôle editor
|
||||
return $this->galleryMemberships()
|
||||
->where('gallery_id', $galleryId)
|
||||
->where('status', 'accepted')
|
||||
->where('role', 'editor')
|
||||
->exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtenir le rôle de l'utilisateur dans une galerie.
|
||||
*/
|
||||
public function getRoleInGallery($galleryId): ?string
|
||||
{
|
||||
// Propriétaire
|
||||
if ($this->ownedGalleries()->where('id', $galleryId)->exists()) {
|
||||
return 'owner';
|
||||
}
|
||||
|
||||
// Membre
|
||||
$membership = $this->galleryMemberships()
|
||||
->where('gallery_id', $galleryId)
|
||||
->where('status', 'accepted')
|
||||
->first();
|
||||
|
||||
return $membership ? $membership->role : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Statistiques de l'utilisateur.
|
||||
*/
|
||||
public function getStatsAttribute(): array
|
||||
{
|
||||
return [
|
||||
'galleries_count' => $this->ownedGalleries()->count(),
|
||||
'artworks_count' => $this->artworks()->count(),
|
||||
'public_galleries_count' => $this->ownedGalleries()->where('is_public', true)->count(),
|
||||
'artworks_for_sale_count' => $this->artworks()->where('is_for_sale', true)->count(),
|
||||
];
|
||||
}
|
||||
}
|
||||
24
public/app/Providers/AppServiceProvider.php
Normal file
24
public/app/Providers/AppServiceProvider.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
18
public/artisan
Executable file
18
public/artisan
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Application;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
// Register the Composer autoloader...
|
||||
require __DIR__.'/vendor/autoload.php';
|
||||
|
||||
// Bootstrap Laravel and handle the command...
|
||||
/** @var Application $app */
|
||||
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||
|
||||
$status = $app->handleCommand(new ArgvInput);
|
||||
|
||||
exit($status);
|
||||
19
public/bootstrap/app.php
Normal file
19
public/bootstrap/app.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Foundation\Configuration\Exceptions;
|
||||
use Illuminate\Foundation\Configuration\Middleware;
|
||||
|
||||
return Application::configure(basePath: dirname(__DIR__))
|
||||
->withRouting(
|
||||
web: __DIR__.'/../routes/web.php',
|
||||
commands: __DIR__.'/../routes/console.php',
|
||||
api: __DIR__.'/../routes/api.php',
|
||||
health: '/up',
|
||||
)
|
||||
->withMiddleware(function (Middleware $middleware): void {
|
||||
//
|
||||
})
|
||||
->withExceptions(function (Exceptions $exceptions): void {
|
||||
//
|
||||
})->create();
|
||||
2
public/bootstrap/cache/.gitignore
vendored
Normal file
2
public/bootstrap/cache/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
5
public/bootstrap/providers.php
Normal file
5
public/bootstrap/providers.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
App\Providers\AppServiceProvider::class,
|
||||
];
|
||||
78
public/composer.json
Normal file
78
public/composer.json
Normal file
@ -0,0 +1,78 @@
|
||||
{
|
||||
"$schema": "https://getcomposer.org/schema.json",
|
||||
"name": "laravel/laravel",
|
||||
"type": "project",
|
||||
"description": "The skeleton application for the Laravel framework.",
|
||||
"keywords": [
|
||||
"laravel",
|
||||
"framework"
|
||||
],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.2",
|
||||
"laravel/framework": "^12.0",
|
||||
"laravel/tinker": "^2.10.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.23",
|
||||
"laravel/pail": "^1.2.2",
|
||||
"laravel/pint": "^1.13",
|
||||
"laravel/sail": "^1.41",
|
||||
"mockery/mockery": "^1.6",
|
||||
"nunomaduro/collision": "^8.6",
|
||||
"phpunit/phpunit": "^11.5.3"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||
],
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
],
|
||||
"post-create-project-cmd": [
|
||||
"@php artisan key:generate --ansi",
|
||||
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
|
||||
"@php artisan migrate --graceful --ansi"
|
||||
],
|
||||
"dev": [
|
||||
"Composer\\Config::disableProcessTimeout",
|
||||
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite"
|
||||
],
|
||||
"test": [
|
||||
"@php artisan config:clear --ansi",
|
||||
"@php artisan test"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"pestphp/pest-plugin": true,
|
||||
"php-http/discovery": true
|
||||
}
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true
|
||||
}
|
||||
8091
public/composer.lock
generated
Normal file
8091
public/composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
126
public/config/app.php
Normal file
126
public/config/app.php
Normal file
@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value is the name of your application, which will be used when the
|
||||
| framework needs to place the application's name in a notification or
|
||||
| other UI elements where an application name needs to be displayed.
|
||||
|
|
||||
*/
|
||||
|
||||
'name' => env('APP_NAME', 'Laravel'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Environment
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the "environment" your application is currently
|
||||
| running in. This may determine how you prefer to configure various
|
||||
| services the application utilizes. Set this in your ".env" file.
|
||||
|
|
||||
*/
|
||||
|
||||
'env' => env('APP_ENV', 'production'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Debug Mode
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When your application is in debug mode, detailed error messages with
|
||||
| stack traces will be shown on every error that occurs within your
|
||||
| application. If disabled, a simple generic error page is shown.
|
||||
|
|
||||
*/
|
||||
|
||||
'debug' => (bool) env('APP_DEBUG', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This URL is used by the console to properly generate URLs when using
|
||||
| the Artisan command line tool. You should set this to the root of
|
||||
| the application so that it's available within Artisan commands.
|
||||
|
|
||||
*/
|
||||
|
||||
'url' => env('APP_URL', 'http://localhost'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Timezone
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default timezone for your application, which
|
||||
| will be used by the PHP date and date-time functions. The timezone
|
||||
| is set to "UTC" by default as it is suitable for most use cases.
|
||||
|
|
||||
*/
|
||||
|
||||
'timezone' => 'UTC',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Locale Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The application locale determines the default locale that will be used
|
||||
| by Laravel's translation / localization methods. This option can be
|
||||
| set to any locale for which you plan to have translation strings.
|
||||
|
|
||||
*/
|
||||
|
||||
'locale' => env('APP_LOCALE', 'en'),
|
||||
|
||||
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
|
||||
|
||||
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This key is utilized by Laravel's encryption services and should be set
|
||||
| to a random, 32 character string to ensure that all encrypted values
|
||||
| are secure. You should do this prior to deploying the application.
|
||||
|
|
||||
*/
|
||||
|
||||
'cipher' => 'AES-256-CBC',
|
||||
|
||||
'key' => env('APP_KEY'),
|
||||
|
||||
'previous_keys' => [
|
||||
...array_filter(
|
||||
explode(',', env('APP_PREVIOUS_KEYS', ''))
|
||||
),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Maintenance Mode Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These configuration options determine the driver used to determine and
|
||||
| manage Laravel's "maintenance mode" status. The "cache" driver will
|
||||
| allow maintenance mode to be controlled across multiple machines.
|
||||
|
|
||||
| Supported drivers: "file", "cache"
|
||||
|
|
||||
*/
|
||||
|
||||
'maintenance' => [
|
||||
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
|
||||
'store' => env('APP_MAINTENANCE_STORE', 'database'),
|
||||
],
|
||||
|
||||
];
|
||||
115
public/config/auth.php
Normal file
115
public/config/auth.php
Normal file
@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Defaults
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default authentication "guard" and password
|
||||
| reset "broker" for your application. You may change these values
|
||||
| as required, but they're a perfect start for most applications.
|
||||
|
|
||||
*/
|
||||
|
||||
'defaults' => [
|
||||
'guard' => env('AUTH_GUARD', 'web'),
|
||||
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next, you may define every authentication guard for your application.
|
||||
| Of course, a great default configuration has been defined for you
|
||||
| which utilizes session storage plus the Eloquent user provider.
|
||||
|
|
||||
| All authentication guards have a user provider, which defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| system used by the application. Typically, Eloquent is utilized.
|
||||
|
|
||||
| Supported: "session"
|
||||
|
|
||||
*/
|
||||
|
||||
'guards' => [
|
||||
'web' => [
|
||||
'driver' => 'session',
|
||||
'provider' => 'users',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| User Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| All authentication guards have a user provider, which defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| system used by the application. Typically, Eloquent is utilized.
|
||||
|
|
||||
| If you have multiple user tables or models you may configure multiple
|
||||
| providers to represent the model / table. These providers may then
|
||||
| be assigned to any extra authentication guards you have defined.
|
||||
|
|
||||
| Supported: "database", "eloquent"
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
'users' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => env('AUTH_MODEL', App\Models\User::class),
|
||||
],
|
||||
|
||||
// 'users' => [
|
||||
// 'driver' => 'database',
|
||||
// 'table' => 'users',
|
||||
// ],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Resetting Passwords
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These configuration options specify the behavior of Laravel's password
|
||||
| reset functionality, including the table utilized for token storage
|
||||
| and the user provider that is invoked to actually retrieve users.
|
||||
|
|
||||
| The expiry time is the number of minutes that each reset token will be
|
||||
| considered valid. This security feature keeps tokens short-lived so
|
||||
| they have less time to be guessed. You may change this as needed.
|
||||
|
|
||||
| The throttle setting is the number of seconds a user must wait before
|
||||
| generating more password reset tokens. This prevents the user from
|
||||
| quickly generating a very large amount of password reset tokens.
|
||||
|
|
||||
*/
|
||||
|
||||
'passwords' => [
|
||||
'users' => [
|
||||
'provider' => 'users',
|
||||
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
|
||||
'expire' => 60,
|
||||
'throttle' => 60,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Confirmation Timeout
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define the number of seconds before a password confirmation
|
||||
| window expires and users are asked to re-enter their password via the
|
||||
| confirmation screen. By default, the timeout lasts for three hours.
|
||||
|
|
||||
*/
|
||||
|
||||
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
|
||||
|
||||
];
|
||||
108
public/config/cache.php
Normal file
108
public/config/cache.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default cache store that will be used by the
|
||||
| framework. This connection is utilized if another isn't explicitly
|
||||
| specified when running a cache operation inside the application.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('CACHE_STORE', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Stores
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the cache "stores" for your application as
|
||||
| well as their drivers. You may even define multiple stores for the
|
||||
| same cache driver to group types of items stored in your caches.
|
||||
|
|
||||
| Supported drivers: "array", "database", "file", "memcached",
|
||||
| "redis", "dynamodb", "octane", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'stores' => [
|
||||
|
||||
'array' => [
|
||||
'driver' => 'array',
|
||||
'serialize' => false,
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'connection' => env('DB_CACHE_CONNECTION'),
|
||||
'table' => env('DB_CACHE_TABLE', 'cache'),
|
||||
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
|
||||
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
|
||||
],
|
||||
|
||||
'file' => [
|
||||
'driver' => 'file',
|
||||
'path' => storage_path('framework/cache/data'),
|
||||
'lock_path' => storage_path('framework/cache/data'),
|
||||
],
|
||||
|
||||
'memcached' => [
|
||||
'driver' => 'memcached',
|
||||
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
||||
'sasl' => [
|
||||
env('MEMCACHED_USERNAME'),
|
||||
env('MEMCACHED_PASSWORD'),
|
||||
],
|
||||
'options' => [
|
||||
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
||||
],
|
||||
'servers' => [
|
||||
[
|
||||
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||
'port' => env('MEMCACHED_PORT', 11211),
|
||||
'weight' => 100,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
|
||||
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
|
||||
],
|
||||
|
||||
'dynamodb' => [
|
||||
'driver' => 'dynamodb',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
|
||||
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
||||
],
|
||||
|
||||
'octane' => [
|
||||
'driver' => 'octane',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Key Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
|
||||
| stores, there might be other applications using the same cache. For
|
||||
| that reason, you may prefix every cache key to avoid collisions.
|
||||
|
|
||||
*/
|
||||
|
||||
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
|
||||
|
||||
];
|
||||
174
public/config/database.php
Normal file
174
public/config/database.php
Normal file
@ -0,0 +1,174 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Database Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify which of the database connections below you wish
|
||||
| to use as your default connection for database operations. This is
|
||||
| the connection which will be utilized unless another connection
|
||||
| is explicitly specified when you execute a query / statement.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('DB_CONNECTION', 'sqlite'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Database Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Below are all of the database connections defined for your application.
|
||||
| An example configuration is provided for each database system which
|
||||
| is supported by Laravel. You're free to add / remove connections.
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sqlite' => [
|
||||
'driver' => 'sqlite',
|
||||
'url' => env('DB_URL'),
|
||||
'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
||||
'prefix' => '',
|
||||
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||
'busy_timeout' => null,
|
||||
'journal_mode' => null,
|
||||
'synchronous' => null,
|
||||
],
|
||||
|
||||
'mysql' => [
|
||||
'driver' => 'mysql',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8mb4'),
|
||||
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'mariadb' => [
|
||||
'driver' => 'mariadb',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8mb4'),
|
||||
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'pgsql' => [
|
||||
'driver' => 'pgsql',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '5432'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'search_path' => 'public',
|
||||
'sslmode' => 'prefer',
|
||||
],
|
||||
|
||||
'sqlsrv' => [
|
||||
'driver' => 'sqlsrv',
|
||||
'url' => env('DB_URL'),
|
||||
'host' => env('DB_HOST', 'localhost'),
|
||||
'port' => env('DB_PORT', '1433'),
|
||||
'database' => env('DB_DATABASE', 'laravel'),
|
||||
'username' => env('DB_USERNAME', 'root'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => env('DB_CHARSET', 'utf8'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
|
||||
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migration Repository Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This table keeps track of all the migrations that have already run for
|
||||
| your application. Using this information, we can determine which of
|
||||
| the migrations on disk haven't actually been run on the database.
|
||||
|
|
||||
*/
|
||||
|
||||
'migrations' => [
|
||||
'table' => 'migrations',
|
||||
'update_date_on_publish' => true,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Redis Databases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Redis is an open source, fast, and advanced key-value store that also
|
||||
| provides a richer body of commands than a typical key-value system
|
||||
| such as Memcached. You may define your connection settings here.
|
||||
|
|
||||
*/
|
||||
|
||||
'redis' => [
|
||||
|
||||
'client' => env('REDIS_CLIENT', 'phpredis'),
|
||||
|
||||
'options' => [
|
||||
'cluster' => env('REDIS_CLUSTER', 'redis'),
|
||||
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
|
||||
'persistent' => env('REDIS_PERSISTENT', false),
|
||||
],
|
||||
|
||||
'default' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_DB', '0'),
|
||||
],
|
||||
|
||||
'cache' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_CACHE_DB', '1'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
80
public/config/filesystems.php
Normal file
80
public/config/filesystems.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Filesystem Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default filesystem disk that should be used
|
||||
| by the framework. The "local" disk, as well as a variety of cloud
|
||||
| based disks are available to your application for file storage.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('FILESYSTEM_DISK', 'local'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filesystem Disks
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Below you may configure as many filesystem disks as necessary, and you
|
||||
| may even configure multiple disks for the same driver. Examples for
|
||||
| most supported storage drivers are configured here for reference.
|
||||
|
|
||||
| Supported drivers: "local", "ftp", "sftp", "s3"
|
||||
|
|
||||
*/
|
||||
|
||||
'disks' => [
|
||||
|
||||
'local' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/private'),
|
||||
'serve' => true,
|
||||
'throw' => false,
|
||||
'report' => false,
|
||||
],
|
||||
|
||||
'public' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public'),
|
||||
'url' => env('APP_URL').'/storage',
|
||||
'visibility' => 'public',
|
||||
'throw' => false,
|
||||
'report' => false,
|
||||
],
|
||||
|
||||
's3' => [
|
||||
'driver' => 's3',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION'),
|
||||
'bucket' => env('AWS_BUCKET'),
|
||||
'url' => env('AWS_URL'),
|
||||
'endpoint' => env('AWS_ENDPOINT'),
|
||||
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||
'throw' => false,
|
||||
'report' => false,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Symbolic Links
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the symbolic links that will be created when the
|
||||
| `storage:link` Artisan command is executed. The array keys should be
|
||||
| the locations of the links and the values should be their targets.
|
||||
|
|
||||
*/
|
||||
|
||||
'links' => [
|
||||
public_path('storage') => storage_path('app/public'),
|
||||
],
|
||||
|
||||
];
|
||||
132
public/config/logging.php
Normal file
132
public/config/logging.php
Normal file
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
use Monolog\Handler\NullHandler;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Handler\SyslogUdpHandler;
|
||||
use Monolog\Processor\PsrLogMessageProcessor;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default log channel that is utilized to write
|
||||
| messages to your logs. The value provided here should match one of
|
||||
| the channels present in the list of "channels" configured below.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('LOG_CHANNEL', 'stack'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Deprecations Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the log channel that should be used to log warnings
|
||||
| regarding deprecated PHP and library features. This allows you to get
|
||||
| your application ready for upcoming major versions of dependencies.
|
||||
|
|
||||
*/
|
||||
|
||||
'deprecations' => [
|
||||
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
|
||||
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Channels
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the log channels for your application. Laravel
|
||||
| utilizes the Monolog PHP logging library, which includes a variety
|
||||
| of powerful log handlers and formatters that you're free to use.
|
||||
|
|
||||
| Available drivers: "single", "daily", "slack", "syslog",
|
||||
| "errorlog", "monolog", "custom", "stack"
|
||||
|
|
||||
*/
|
||||
|
||||
'channels' => [
|
||||
|
||||
'stack' => [
|
||||
'driver' => 'stack',
|
||||
'channels' => explode(',', env('LOG_STACK', 'single')),
|
||||
'ignore_exceptions' => false,
|
||||
],
|
||||
|
||||
'single' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'daily' => [
|
||||
'driver' => 'daily',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'days' => env('LOG_DAILY_DAYS', 14),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'driver' => 'slack',
|
||||
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||
'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
|
||||
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
|
||||
'level' => env('LOG_LEVEL', 'critical'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'papertrail' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
|
||||
'handler_with' => [
|
||||
'host' => env('PAPERTRAIL_URL'),
|
||||
'port' => env('PAPERTRAIL_PORT'),
|
||||
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
|
||||
],
|
||||
'processors' => [PsrLogMessageProcessor::class],
|
||||
],
|
||||
|
||||
'stderr' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => StreamHandler::class,
|
||||
'handler_with' => [
|
||||
'stream' => 'php://stderr',
|
||||
],
|
||||
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||
'processors' => [PsrLogMessageProcessor::class],
|
||||
],
|
||||
|
||||
'syslog' => [
|
||||
'driver' => 'syslog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'errorlog' => [
|
||||
'driver' => 'errorlog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => NullHandler::class,
|
||||
],
|
||||
|
||||
'emergency' => [
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
118
public/config/mail.php
Normal file
118
public/config/mail.php
Normal file
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Mailer
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default mailer that is used to send all email
|
||||
| messages unless another mailer is explicitly specified when sending
|
||||
| the message. All additional mailers can be configured within the
|
||||
| "mailers" array. Examples of each type of mailer are provided.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('MAIL_MAILER', 'log'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mailer Configurations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure all of the mailers used by your application plus
|
||||
| their respective settings. Several examples have been configured for
|
||||
| you and you are free to add your own as your application requires.
|
||||
|
|
||||
| Laravel supports a variety of mail "transport" drivers that can be used
|
||||
| when delivering an email. You may specify which one you're using for
|
||||
| your mailers below. You may also add additional mailers if needed.
|
||||
|
|
||||
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
|
||||
| "postmark", "resend", "log", "array",
|
||||
| "failover", "roundrobin"
|
||||
|
|
||||
*/
|
||||
|
||||
'mailers' => [
|
||||
|
||||
'smtp' => [
|
||||
'transport' => 'smtp',
|
||||
'scheme' => env('MAIL_SCHEME'),
|
||||
'url' => env('MAIL_URL'),
|
||||
'host' => env('MAIL_HOST', '127.0.0.1'),
|
||||
'port' => env('MAIL_PORT', 2525),
|
||||
'username' => env('MAIL_USERNAME'),
|
||||
'password' => env('MAIL_PASSWORD'),
|
||||
'timeout' => null,
|
||||
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url(env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'transport' => 'ses',
|
||||
],
|
||||
|
||||
'postmark' => [
|
||||
'transport' => 'postmark',
|
||||
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
|
||||
// 'client' => [
|
||||
// 'timeout' => 5,
|
||||
// ],
|
||||
],
|
||||
|
||||
'resend' => [
|
||||
'transport' => 'resend',
|
||||
],
|
||||
|
||||
'sendmail' => [
|
||||
'transport' => 'sendmail',
|
||||
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'transport' => 'log',
|
||||
'channel' => env('MAIL_LOG_CHANNEL'),
|
||||
],
|
||||
|
||||
'array' => [
|
||||
'transport' => 'array',
|
||||
],
|
||||
|
||||
'failover' => [
|
||||
'transport' => 'failover',
|
||||
'mailers' => [
|
||||
'smtp',
|
||||
'log',
|
||||
],
|
||||
'retry_after' => 60,
|
||||
],
|
||||
|
||||
'roundrobin' => [
|
||||
'transport' => 'roundrobin',
|
||||
'mailers' => [
|
||||
'ses',
|
||||
'postmark',
|
||||
],
|
||||
'retry_after' => 60,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global "From" Address
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may wish for all emails sent by your application to be sent from
|
||||
| the same address. Here you may specify a name and address that is
|
||||
| used globally for all emails that are sent by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
],
|
||||
|
||||
];
|
||||
112
public/config/queue.php
Normal file
112
public/config/queue.php
Normal file
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Queue Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Laravel's queue supports a variety of backends via a single, unified
|
||||
| API, giving you convenient access to each backend using identical
|
||||
| syntax for each. The default queue connection is defined below.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('QUEUE_CONNECTION', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Queue Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the connection options for every queue backend
|
||||
| used by your application. An example configuration is provided for
|
||||
| each backend supported by Laravel. You're also free to add more.
|
||||
|
|
||||
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sync' => [
|
||||
'driver' => 'sync',
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'connection' => env('DB_QUEUE_CONNECTION'),
|
||||
'table' => env('DB_QUEUE_TABLE', 'jobs'),
|
||||
'queue' => env('DB_QUEUE', 'default'),
|
||||
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'beanstalkd' => [
|
||||
'driver' => 'beanstalkd',
|
||||
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
|
||||
'queue' => env('BEANSTALKD_QUEUE', 'default'),
|
||||
'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
|
||||
'block_for' => 0,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'sqs' => [
|
||||
'driver' => 'sqs',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
|
||||
'queue' => env('SQS_QUEUE', 'default'),
|
||||
'suffix' => env('SQS_SUFFIX'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
|
||||
'queue' => env('REDIS_QUEUE', 'default'),
|
||||
'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90),
|
||||
'block_for' => null,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Job Batching
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following options configure the database and table that store job
|
||||
| batching information. These options can be updated to any database
|
||||
| connection and table which has been defined by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'batching' => [
|
||||
'database' => env('DB_CONNECTION', 'sqlite'),
|
||||
'table' => 'job_batches',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Failed Queue Jobs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These options configure the behavior of failed queue job logging so you
|
||||
| can control how and where failed jobs are stored. Laravel ships with
|
||||
| support for storing failed jobs in a simple file or in a database.
|
||||
|
|
||||
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'failed' => [
|
||||
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
|
||||
'database' => env('DB_CONNECTION', 'sqlite'),
|
||||
'table' => 'failed_jobs',
|
||||
],
|
||||
|
||||
];
|
||||
38
public/config/services.php
Normal file
38
public/config/services.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Third Party Services
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This file is for storing the credentials for third party services such
|
||||
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
||||
| location for this type of information, allowing packages to have
|
||||
| a conventional file to locate the various service credentials.
|
||||
|
|
||||
*/
|
||||
|
||||
'postmark' => [
|
||||
'token' => env('POSTMARK_TOKEN'),
|
||||
],
|
||||
|
||||
'resend' => [
|
||||
'key' => env('RESEND_KEY'),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'notifications' => [
|
||||
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
|
||||
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
217
public/config/session.php
Normal file
217
public/config/session.php
Normal file
@ -0,0 +1,217 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Session Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines the default session driver that is utilized for
|
||||
| incoming requests. Laravel supports a variety of storage options to
|
||||
| persist session data. Database storage is a great default choice.
|
||||
|
|
||||
| Supported: "file", "cookie", "database", "memcached",
|
||||
| "redis", "dynamodb", "array"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => env('SESSION_DRIVER', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Lifetime
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the number of minutes that you wish the session
|
||||
| to be allowed to remain idle before it expires. If you want them
|
||||
| to expire immediately when the browser is closed then you may
|
||||
| indicate that via the expire_on_close configuration option.
|
||||
|
|
||||
*/
|
||||
|
||||
'lifetime' => (int) env('SESSION_LIFETIME', 120),
|
||||
|
||||
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Encryption
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to easily specify that all of your session data
|
||||
| should be encrypted before it's stored. All encryption is performed
|
||||
| automatically by Laravel and you may use the session like normal.
|
||||
|
|
||||
*/
|
||||
|
||||
'encrypt' => env('SESSION_ENCRYPT', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session File Location
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing the "file" session driver, the session files are placed
|
||||
| on disk. The default storage location is defined here; however, you
|
||||
| are free to provide another location where they should be stored.
|
||||
|
|
||||
*/
|
||||
|
||||
'files' => storage_path('framework/sessions'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Connection
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" or "redis" session drivers, you may specify a
|
||||
| connection that should be used to manage these sessions. This should
|
||||
| correspond to a connection in your database configuration options.
|
||||
|
|
||||
*/
|
||||
|
||||
'connection' => env('SESSION_CONNECTION'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" session driver, you may specify the table to
|
||||
| be used to store sessions. Of course, a sensible default is defined
|
||||
| for you; however, you're welcome to change this to another table.
|
||||
|
|
||||
*/
|
||||
|
||||
'table' => env('SESSION_TABLE', 'sessions'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using one of the framework's cache driven session backends, you may
|
||||
| define the cache store which should be used to store the session data
|
||||
| between requests. This must match one of your defined cache stores.
|
||||
|
|
||||
| Affects: "dynamodb", "memcached", "redis"
|
||||
|
|
||||
*/
|
||||
|
||||
'store' => env('SESSION_STORE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Sweeping Lottery
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Some session drivers must manually sweep their storage location to get
|
||||
| rid of old sessions from storage. Here are the chances that it will
|
||||
| happen on a given request. By default, the odds are 2 out of 100.
|
||||
|
|
||||
*/
|
||||
|
||||
'lottery' => [2, 100],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the name of the session cookie that is created by
|
||||
| the framework. Typically, you should not need to change this value
|
||||
| since doing so does not grant a meaningful security improvement.
|
||||
|
|
||||
*/
|
||||
|
||||
'cookie' => env(
|
||||
'SESSION_COOKIE',
|
||||
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
|
||||
),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The session cookie path determines the path for which the cookie will
|
||||
| be regarded as available. Typically, this will be the root path of
|
||||
| your application, but you're free to change this when necessary.
|
||||
|
|
||||
*/
|
||||
|
||||
'path' => env('SESSION_PATH', '/'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Domain
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the domain and subdomains the session cookie is
|
||||
| available to. By default, the cookie will be available to the root
|
||||
| domain and all subdomains. Typically, this shouldn't be changed.
|
||||
|
|
||||
*/
|
||||
|
||||
'domain' => env('SESSION_DOMAIN'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTPS Only Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By setting this option to true, session cookies will only be sent back
|
||||
| to the server if the browser has a HTTPS connection. This will keep
|
||||
| the cookie from being sent to you when it can't be done securely.
|
||||
|
|
||||
*/
|
||||
|
||||
'secure' => env('SESSION_SECURE_COOKIE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTP Access Only
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will prevent JavaScript from accessing the
|
||||
| value of the cookie and the cookie will only be accessible through
|
||||
| the HTTP protocol. It's unlikely you should disable this option.
|
||||
|
|
||||
*/
|
||||
|
||||
'http_only' => env('SESSION_HTTP_ONLY', true),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Same-Site Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines how your cookies behave when cross-site requests
|
||||
| take place, and can be used to mitigate CSRF attacks. By default, we
|
||||
| will set this value to "lax" to permit secure cross-site requests.
|
||||
|
|
||||
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
||||
|
|
||||
| Supported: "lax", "strict", "none", null
|
||||
|
|
||||
*/
|
||||
|
||||
'same_site' => env('SESSION_SAME_SITE', 'lax'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Partitioned Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will tie the cookie to the top-level site for
|
||||
| a cross-site context. Partitioned cookies are accepted by the browser
|
||||
| when flagged "secure" and the Same-Site attribute is set to "none".
|
||||
|
|
||||
*/
|
||||
|
||||
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
|
||||
|
||||
];
|
||||
1
public/database/.gitignore
vendored
Normal file
1
public/database/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.sqlite*
|
||||
36
public/database/GalleryMember.php
Normal file
36
public/database/GalleryMember.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace database;
|
||||
|
||||
use App\Models\Gallery;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class GalleryMember extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'gallery_members';
|
||||
protected $primaryKey = ['gallery_id', 'user_id'];
|
||||
public $timestamps = true;
|
||||
protected $fillable = [
|
||||
'gallery_id',
|
||||
'user_id',
|
||||
'role',
|
||||
'status',
|
||||
'invited_at',
|
||||
'entered_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function gallery()
|
||||
{
|
||||
return $this->belongsTo(Gallery::class, 'gallery_id');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
}
|
||||
44
public/database/factories/UserFactory.php
Normal file
44
public/database/factories/UserFactory.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The current password being used by the factory.
|
||||
*/
|
||||
protected static ?string $password;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => static::$password ??= Hash::make('password'),
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*/
|
||||
public function unverified(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
// database/migrations/2024_01_01_000000_create_users_table.php
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id(); // Auto-increment primary key
|
||||
$table->string('username', 50)->unique();
|
||||
$table->string('email', 255)->unique();
|
||||
$table->string('password_hash', 255);
|
||||
$table->string('first_name', 100)->nullable();
|
||||
$table->string('last_name', 100)->nullable();
|
||||
$table->text('bio')->nullable();
|
||||
$table->string('profile_picture_url', 255)->nullable();
|
||||
$table->timestamps(); // created_at et updated_at
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('cache', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->mediumText('value');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
|
||||
Schema::create('cache_locks', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->string('owner');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cache');
|
||||
Schema::dropIfExists('cache_locks');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
|
||||
Schema::create('job_batches', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->string('name');
|
||||
$table->integer('total_jobs');
|
||||
$table->integer('pending_jobs');
|
||||
$table->integer('failed_jobs');
|
||||
$table->longText('failed_job_ids');
|
||||
$table->mediumText('options')->nullable();
|
||||
$table->integer('cancelled_at')->nullable();
|
||||
$table->integer('created_at');
|
||||
$table->integer('finished_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
Schema::dropIfExists('job_batches');
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('artworks', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('gallery_id')->constrained('galleries')->onDelete('cascade');
|
||||
$table->foreignId('creator_id')->constrained('users')->onDelete('cascade');
|
||||
$table->string('title');
|
||||
$table->text('description')->nullable();
|
||||
$table->string('image_url');
|
||||
$table->string('medium', 100)->nullable();
|
||||
$table->string('dimensions', 50)->nullable();
|
||||
$table->year('creation_year')->nullable();
|
||||
$table->decimal('price', 10, 2)->nullable();
|
||||
$table->boolean('is_for_sale')->default(false);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('artworks');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('galleries', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('owner_id')->constrained('users')->onDelete('cascade');
|
||||
$table->string('title');
|
||||
$table->text('description')->nullable();
|
||||
$table->boolean('is_public')->default(false);
|
||||
$table->timestamp('publication_date')->nullable();
|
||||
$table->timestamps(); // created_at et updated_at
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('galleries');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('gallery_members', function (Blueprint $table) {
|
||||
$table->foreignId('gallery_id')->constrained()->onDelete('cascade');
|
||||
$table->foreignId('user_id')->constrained()->onDelete('cascade');
|
||||
$table->string('role', 50)->default('viewer');
|
||||
$table->string('status', 50)->default('pending');
|
||||
$table->timestamp('invited_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate();
|
||||
|
||||
// Clé primaire composite
|
||||
$table->primary(['gallery_id', 'user_id']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('gallery_members');
|
||||
}
|
||||
};
|
||||
171
public/database/seeders/ArtworkSeeder.php
Normal file
171
public/database/seeders/ArtworkSeeder.php
Normal file
@ -0,0 +1,171 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ArtworkSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$artworks = [
|
||||
// Galerie de Monet (id: 1)
|
||||
[
|
||||
'gallery_id' => 1,
|
||||
'creator_id' => 1,
|
||||
'title' => 'Nymphéas, Matin',
|
||||
'description' => 'Capturer la lumière matinale sur l\'étang de mon jardin reste un défi constant. Cette œuvre représente la sérénité du petit matin.',
|
||||
'image_url' => 'https://images.unsplash.com/photo-1578662996442-48f60103fc96?w=800&h=600',
|
||||
'medium' => 'Huile sur toile',
|
||||
'dimensions' => '200cm x 300cm',
|
||||
'creation_year' => 1920,
|
||||
'price' => 2500000.00,
|
||||
'is_for_sale' => false,
|
||||
'created_at' => Carbon::now()->subDays(35),
|
||||
'updated_at' => Carbon::now()->subDays(20),
|
||||
],
|
||||
[
|
||||
'gallery_id' => 1,
|
||||
'creator_id' => 1,
|
||||
'title' => 'Le Pont Japonais au Coucher du Soleil',
|
||||
'description' => 'Mon pont japonais sous une lumière dorée. Les reflets dans l\'eau créent une symphonie de couleurs chaudes.',
|
||||
'image_url' => 'https://images.unsplash.com/photo-1541961017774-22349e4a1262?w=800&h=600',
|
||||
'medium' => 'Huile sur toile',
|
||||
'dimensions' => '150cm x 120cm',
|
||||
'creation_year' => 1922,
|
||||
'price' => 1800000.00,
|
||||
'is_for_sale' => true,
|
||||
'created_at' => Carbon::now()->subDays(32),
|
||||
'updated_at' => Carbon::now()->subDays(18),
|
||||
],
|
||||
|
||||
// Galerie de Frida (id: 2)
|
||||
[
|
||||
'gallery_id' => 2,
|
||||
'creator_id' => 2,
|
||||
'title' => 'Autoportrait aux Épines',
|
||||
'description' => 'Un regard introspectif sur ma douleur physique et émotionnelle. Les épines représentent les épreuves de ma vie.',
|
||||
'image_url' => 'https://images.unsplash.com/photo-1571115764595-644a1f56a55c?w=800&h=600',
|
||||
'medium' => 'Huile sur masonite',
|
||||
'dimensions' => '40cm x 30cm',
|
||||
'creation_year' => 1940,
|
||||
'price' => 3200000.00,
|
||||
'is_for_sale' => false,
|
||||
'created_at' => Carbon::now()->subDays(30),
|
||||
'updated_at' => Carbon::now()->subDays(15),
|
||||
],
|
||||
[
|
||||
'gallery_id' => 2,
|
||||
'creator_id' => 2,
|
||||
'title' => 'Les Deux Fridas',
|
||||
'description' => 'Mes deux identités : la Frida aimée par Diego et celle qui existe indépendamment. Une œuvre sur la dualité de l\'être.',
|
||||
'image_url' => 'https://images.unsplash.com/photo-1578662996442-48f60103fc96?w=800&h=600',
|
||||
'medium' => 'Huile sur toile',
|
||||
'dimensions' => '173cm x 173cm',
|
||||
'creation_year' => 1939,
|
||||
'price' => 5000000.00,
|
||||
'is_for_sale' => false,
|
||||
'created_at' => Carbon::now()->subDays(28),
|
||||
'updated_at' => Carbon::now()->subDays(12),
|
||||
],
|
||||
|
||||
// Galerie de Van Gogh (id: 3)
|
||||
[
|
||||
'gallery_id' => 3,
|
||||
'creator_id' => 3,
|
||||
'title' => 'La Nuit Étoilée sur le Rhône',
|
||||
'description' => 'Les étoiles ont toujours fasciné mon esprit tourmenté. Cette toile capture la magie d\'une nuit d\'été à Arles.',
|
||||
'image_url' => 'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=800&h=600',
|
||||
'medium' => 'Huile sur toile',
|
||||
'dimensions' => '72cm x 92cm',
|
||||
'creation_year' => 1888,
|
||||
'price' => 4500000.00,
|
||||
'is_for_sale' => false,
|
||||
'created_at' => Carbon::now()->subDays(20),
|
||||
'updated_at' => Carbon::now()->subDays(10),
|
||||
],
|
||||
|
||||
// Galerie de Leonardo (id: 4)
|
||||
[
|
||||
'gallery_id' => 4,
|
||||
'creator_id' => 4,
|
||||
'title' => 'Étude Anatomique - Main Gauche',
|
||||
'description' => 'Une étude détaillée de l\'anatomie humaine, base essentielle pour tout artiste souhaitant représenter le corps avec précision.',
|
||||
'image_url' => 'https://images.unsplash.com/photo-1594736797933-d0151ba6e056?w=800&h=600',
|
||||
'medium' => 'Sanguine sur papier',
|
||||
'dimensions' => '25cm x 35cm',
|
||||
'creation_year' => 1510,
|
||||
'price' => 8000000.00,
|
||||
'is_for_sale' => false,
|
||||
'created_at' => Carbon::now()->subDays(45),
|
||||
'updated_at' => Carbon::now()->subDays(25),
|
||||
],
|
||||
|
||||
// Galerie de Picasso (id: 5)
|
||||
[
|
||||
'gallery_id' => 5,
|
||||
'creator_id' => 5,
|
||||
'title' => 'Femme Assise - Période Bleue',
|
||||
'description' => 'Une œuvre de ma période bleue, empreinte de mélancolie mais d\'une beauté saisissante. Le bleu exprime toute ma tristesse de l\'époque.',
|
||||
'image_url' => 'https://images.unsplash.com/photo-1578662996442-48f60103fc96?w=800&h=600',
|
||||
'medium' => 'Huile sur toile',
|
||||
'dimensions' => '100cm x 80cm',
|
||||
'creation_year' => 1903,
|
||||
'price' => 6200000.00,
|
||||
'is_for_sale' => true,
|
||||
'created_at' => Carbon::now()->subDays(18),
|
||||
'updated_at' => Carbon::now()->subDays(8),
|
||||
],
|
||||
|
||||
// Galerie collaborative de Maya (id: 6)
|
||||
[
|
||||
'gallery_id' => 6,
|
||||
'creator_id' => 1, // Monet contribue
|
||||
'title' => 'Hommage aux Maîtres - Variation Moderne',
|
||||
'description' => 'Une interprétation contemporaine de mes techniques impressionnistes, créée spécialement pour cette exposition collaborative.',
|
||||
'image_url' => 'https://images.unsplash.com/photo-1541961017774-22349e4a1262?w=800&h=600',
|
||||
'medium' => 'Acrylique sur toile',
|
||||
'dimensions' => '120cm x 90cm',
|
||||
'creation_year' => 2024,
|
||||
'price' => 45000.00,
|
||||
'is_for_sale' => true,
|
||||
'created_at' => Carbon::now()->subDays(12),
|
||||
'updated_at' => Carbon::now()->subDays(3),
|
||||
],
|
||||
[
|
||||
'gallery_id' => 6,
|
||||
'creator_id' => 5, // Picasso contribue
|
||||
'title' => 'Cubisme Digital',
|
||||
'description' => 'Si j\'avais eu accès aux outils numériques, voici comment j\'aurais exploré le cubisme. Une œuvre qui mélange tradition et innovation.',
|
||||
'image_url' => 'https://images.unsplash.com/photo-1578662996442-48f60103fc96?w=800&h=600',
|
||||
'medium' => 'Art numérique imprimé sur toile',
|
||||
'dimensions' => '80cm x 80cm',
|
||||
'creation_year' => 2024,
|
||||
'price' => 25000.00,
|
||||
'is_for_sale' => true,
|
||||
'created_at' => Carbon::now()->subDays(10),
|
||||
'updated_at' => Carbon::now()->subDays(2),
|
||||
],
|
||||
|
||||
// Galerie privée de Monet (id: 7)
|
||||
[
|
||||
'gallery_id' => 7,
|
||||
'creator_id' => 1,
|
||||
'title' => 'Impression, Soleil Levant - Étude Préparatoire N°1',
|
||||
'description' => 'La toute première esquisse de ce qui deviendrait l\'œuvre fondatrice de l\'impressionnisme. Un moment historique capturé.',
|
||||
'image_url' => 'https://images.unsplash.com/photo-1578662996442-48f60103fc96?w=800&h=600',
|
||||
'medium' => 'Huile sur carton',
|
||||
'dimensions' => '30cm x 40cm',
|
||||
'creation_year' => 1872,
|
||||
'price' => 12000000.00,
|
||||
'is_for_sale' => false,
|
||||
'created_at' => Carbon::now()->subDays(50),
|
||||
'updated_at' => Carbon::now()->subDays(40),
|
||||
],
|
||||
];
|
||||
|
||||
DB::table('artworks')->insert($artworks);
|
||||
}
|
||||
}
|
||||
30
public/database/seeders/DatabaseSeeder.php
Normal file
30
public/database/seeders/DatabaseSeeder.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
\DB::statement('PRAGMA foreign_keys = OFF;');
|
||||
|
||||
// Supprimer les données existantes dans l'ordre inverse des dépendances
|
||||
\DB::table('gallery_members')->delete();
|
||||
\DB::table('artworks')->delete();
|
||||
\DB::table('galleries')->delete();
|
||||
\DB::table('users')->delete();
|
||||
|
||||
// Réactiver les contraintes
|
||||
\DB::statement('PRAGMA foreign_keys = ON;');
|
||||
|
||||
// Lancer nos seeders personnalisés
|
||||
$this->call([
|
||||
UserSeeder::class,
|
||||
GallerySeeder::class,
|
||||
ArtworkSeeder::class,
|
||||
GalleryMemberSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
99
public/database/seeders/GalleryMemberSeeder.php
Normal file
99
public/database/seeders/GalleryMemberSeeder.php
Normal file
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class GalleryMemberSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$memberships = [
|
||||
// Maya (collectionneuse) invitée à voir plusieurs galeries privées
|
||||
[
|
||||
'gallery_id' => 3, // Galerie privée de Van Gogh
|
||||
'user_id' => 6, // Maya
|
||||
'role' => 'viewer',
|
||||
'status' => 'accepted',
|
||||
'invited_at' => Carbon::now()->subDays(15),
|
||||
'updated_at' => Carbon::now()->subDays(12),
|
||||
],
|
||||
[
|
||||
'gallery_id' => 7, // Galerie privée de Monet
|
||||
'user_id' => 6, // Maya
|
||||
'role' => 'viewer',
|
||||
'status' => 'accepted',
|
||||
'invited_at' => Carbon::now()->subDays(20),
|
||||
'updated_at' => Carbon::now()->subDays(18),
|
||||
],
|
||||
|
||||
// Collaborations entre artistes
|
||||
[
|
||||
'gallery_id' => 6, // Galerie collaborative de Maya
|
||||
'user_id' => 1, // Monet invité comme contributeur
|
||||
'role' => 'editor',
|
||||
'status' => 'accepted',
|
||||
'invited_at' => Carbon::now()->subDays(10),
|
||||
'updated_at' => Carbon::now()->subDays(8),
|
||||
],
|
||||
[
|
||||
'gallery_id' => 6, // Galerie collaborative de Maya
|
||||
'user_id' => 5, // Picasso invité comme contributeur
|
||||
'role' => 'editor',
|
||||
'status' => 'accepted',
|
||||
'invited_at' => Carbon::now()->subDays(9),
|
||||
'updated_at' => Carbon::now()->subDays(7),
|
||||
],
|
||||
[
|
||||
'gallery_id' => 6, // Galerie collaborative de Maya
|
||||
'user_id' => 2, // Frida invitée mais n'a pas encore répondu
|
||||
'role' => 'editor',
|
||||
'status' => 'pending',
|
||||
'invited_at' => Carbon::now()->subDays(5),
|
||||
'updated_at' => Carbon::now()->subDays(5),
|
||||
],
|
||||
|
||||
// Leonardo donne accès à Van Gogh à sa galerie pour inspiration
|
||||
[
|
||||
'gallery_id' => 4, // Galerie de Leonardo
|
||||
'user_id' => 3, // Van Gogh
|
||||
'role' => 'viewer',
|
||||
'status' => 'accepted',
|
||||
'invited_at' => Carbon::now()->subDays(25),
|
||||
'updated_at' => Carbon::now()->subDays(22),
|
||||
],
|
||||
|
||||
// Picasso refuse l'accès à sa galerie à un utilisateur
|
||||
[
|
||||
'gallery_id' => 5, // Galerie de Picasso
|
||||
'user_id' => 4, // Leonardo
|
||||
'role' => 'viewer',
|
||||
'status' => 'rejected',
|
||||
'invited_at' => Carbon::now()->subDays(8),
|
||||
'updated_at' => Carbon::now()->subDays(6),
|
||||
],
|
||||
|
||||
// Invitations en attente
|
||||
[
|
||||
'gallery_id' => 1, // Galerie de Monet
|
||||
'user_id' => 2, // Frida
|
||||
'role' => 'viewer',
|
||||
'status' => 'pending',
|
||||
'invited_at' => Carbon::now()->subDays(3),
|
||||
'updated_at' => Carbon::now()->subDays(3),
|
||||
],
|
||||
[
|
||||
'gallery_id' => 2, // Galerie de Frida
|
||||
'user_id' => 3, // Van Gogh
|
||||
'role' => 'viewer',
|
||||
'status' => 'pending',
|
||||
'invited_at' => Carbon::now()->subDays(2),
|
||||
'updated_at' => Carbon::now()->subDays(2),
|
||||
],
|
||||
];
|
||||
|
||||
DB::table('gallery_members')->insert($memberships);
|
||||
}
|
||||
}
|
||||
81
public/database/seeders/GallerySeeder.php
Normal file
81
public/database/seeders/GallerySeeder.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class GallerySeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$galleries = [
|
||||
[
|
||||
'owner_id' => 1, // Claude Monet
|
||||
'title' => 'Les Nymphéas - Collection Privée',
|
||||
'description' => 'Une collection exclusive de mes œuvres inspirées par mon jardin de Giverny. Ces toiles capturent la beauté changeante des nénuphars selon les saisons et les heures du jour.',
|
||||
'is_public' => true,
|
||||
'publication_date' => Carbon::now()->subDays(30),
|
||||
'created_at' => Carbon::now()->subDays(35),
|
||||
'updated_at' => Carbon::now()->subDays(20),
|
||||
],
|
||||
[
|
||||
'owner_id' => 2, // Frida Kahlo
|
||||
'title' => 'Autoportraits et Douleur',
|
||||
'description' => 'Une exposition intime de mes autoportraits les plus personnels, explorant les thèmes de la souffrance, de l\'amour et de l\'identité mexicaine.',
|
||||
'is_public' => true,
|
||||
'publication_date' => Carbon::now()->subDays(25),
|
||||
'created_at' => Carbon::now()->subDays(30),
|
||||
'updated_at' => Carbon::now()->subDays(15),
|
||||
],
|
||||
[
|
||||
'owner_id' => 3, // Van Gogh
|
||||
'title' => 'Nuit Étoilée - Série Complète',
|
||||
'description' => 'Ma fascination pour les ciels nocturnes et les étoiles. Cette galerie présente l\'évolution de mon style à travers différentes représentations de la nuit.',
|
||||
'is_public' => false,
|
||||
'publication_date' => null,
|
||||
'created_at' => Carbon::now()->subDays(20),
|
||||
'updated_at' => Carbon::now()->subDays(10),
|
||||
],
|
||||
[
|
||||
'owner_id' => 4, // Leonardo
|
||||
'title' => 'Renaissance et Innovation',
|
||||
'description' => 'Mes œuvres qui allient art et science. Découvrez comment j\'ai révolutionné la peinture en étudiant l\'anatomie et la perspective.',
|
||||
'is_public' => true,
|
||||
'publication_date' => Carbon::now()->subDays(40),
|
||||
'created_at' => Carbon::now()->subDays(45),
|
||||
'updated_at' => Carbon::now()->subDays(25),
|
||||
],
|
||||
[
|
||||
'owner_id' => 5, // Picasso
|
||||
'title' => 'Période Bleue Revisitée',
|
||||
'description' => 'Un retour sur ma période bleue avec des œuvres inédites et des variations sur mes thèmes favoris de cette époque mélancolique.',
|
||||
'is_public' => true,
|
||||
'publication_date' => Carbon::now()->subDays(15),
|
||||
'created_at' => Carbon::now()->subDays(18),
|
||||
'updated_at' => Carbon::now()->subDays(8),
|
||||
],
|
||||
[
|
||||
'owner_id' => 6, // Maya
|
||||
'title' => 'Curation Contemporaine',
|
||||
'description' => 'Ma sélection personnelle d\'œuvres d\'artistes contemporains émergents. Une galerie collaborative pour promouvoir les nouveaux talents.',
|
||||
'is_public' => true,
|
||||
'publication_date' => Carbon::now()->subDays(10),
|
||||
'created_at' => Carbon::now()->subDays(12),
|
||||
'updated_at' => Carbon::now()->subDays(3),
|
||||
],
|
||||
[
|
||||
'owner_id' => 1, // Claude Monet - 2ème galerie
|
||||
'title' => 'Impression, Soleil Levant - Études',
|
||||
'description' => 'Les études préparatoires et variations autour de mon œuvre la plus célèbre qui a donné son nom à l\'impressionnisme.',
|
||||
'is_public' => false,
|
||||
'publication_date' => null,
|
||||
'created_at' => Carbon::now()->subDays(50),
|
||||
'updated_at' => Carbon::now()->subDays(40),
|
||||
],
|
||||
];
|
||||
|
||||
DB::table('galleries')->insert($galleries);
|
||||
}
|
||||
}
|
||||
85
public/database/seeders/UserSeeder.php
Normal file
85
public/database/seeders/UserSeeder.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class UserSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$users = [
|
||||
[
|
||||
'username' => 'claude_monet',
|
||||
'email' => 'claude.monet@art.com',
|
||||
'password_hash' => Hash::make('password123'),
|
||||
'first_name' => 'Claude',
|
||||
'last_name' => 'Monet',
|
||||
'bio' => 'Peintre impressionniste français, passionné par les jeux de lumière et les paysages aquatiques. Créateur de la série des Nymphéas.',
|
||||
'profile_picture_url' => 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=300&h=300&fit=crop&crop=face',
|
||||
'created_at' => Carbon::now()->subDays(120),
|
||||
'updated_at' => Carbon::now()->subDays(120),
|
||||
],
|
||||
[
|
||||
'username' => 'frida_kahlo',
|
||||
'email' => 'frida.kahlo@art.com',
|
||||
'password_hash' => Hash::make('password123'),
|
||||
'first_name' => 'Frida',
|
||||
'last_name' => 'Kahlo',
|
||||
'bio' => 'Artiste peintre mexicaine, connue pour ses autoportraits et son style unique mêlant réalisme et surréalisme.',
|
||||
'profile_picture_url' => 'https://images.unsplash.com/photo-1494790108755-2616b9a7e4b3?w=300&h=300&fit=crop&crop=face',
|
||||
'created_at' => Carbon::now()->subDays(90),
|
||||
'updated_at' => Carbon::now()->subDays(45),
|
||||
],
|
||||
[
|
||||
'username' => 'vincent_van_gogh',
|
||||
'email' => 'vincent.vangogh@art.com',
|
||||
'password_hash' => Hash::make('password123'),
|
||||
'first_name' => 'Vincent',
|
||||
'last_name' => 'Van Gogh',
|
||||
'bio' => 'Peintre et dessinateur néerlandais post-impressionniste. Passionné par les couleurs vives et les coups de pinceau expressifs.',
|
||||
'profile_picture_url' => 'https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=300&h=300&fit=crop&crop=face',
|
||||
'created_at' => Carbon::now()->subDays(75),
|
||||
'updated_at' => Carbon::now()->subDays(30),
|
||||
],
|
||||
[
|
||||
'username' => 'leonardo_da_vinci',
|
||||
'email' => 'leo.davinci@art.com',
|
||||
'password_hash' => Hash::make('password123'),
|
||||
'first_name' => 'Leonardo',
|
||||
'last_name' => 'Da Vinci',
|
||||
'bio' => 'Artiste, inventeur et scientifique de la Renaissance. Maître de la peinture, de la sculpture et de l\'innovation.',
|
||||
'profile_picture_url' => 'https://images.unsplash.com/photo-1500648767791-00dcc994a43e?w=300&h=300&fit=crop&crop=face',
|
||||
'created_at' => Carbon::now()->subDays(60),
|
||||
'updated_at' => Carbon::now()->subDays(15),
|
||||
],
|
||||
[
|
||||
'username' => 'pablo_picasso',
|
||||
'email' => 'pablo.picasso@art.com',
|
||||
'password_hash' => Hash::make('password123'),
|
||||
'first_name' => 'Pablo',
|
||||
'last_name' => 'Picasso',
|
||||
'bio' => 'Peintre, sculpteur et céramiste espagnol. Co-fondateur du mouvement cubiste et l\'un des artistes les plus influents du XXe siècle.',
|
||||
'profile_picture_url' => 'https://images.unsplash.com/photo-1463453091185-61582044d556?w=300&h=300&fit=crop&crop=face',
|
||||
'created_at' => Carbon::now()->subDays(45),
|
||||
'updated_at' => Carbon::now()->subDays(10),
|
||||
],
|
||||
[
|
||||
'username' => 'maya_art_collector',
|
||||
'email' => 'maya.collector@art.com',
|
||||
'password_hash' => Hash::make('password123'),
|
||||
'first_name' => 'Maya',
|
||||
'last_name' => 'Rodriguez',
|
||||
'bio' => 'Collectionneuse d\'art contemporain et curatrice indépendante. Passionnée par la découverte de nouveaux talents.',
|
||||
'profile_picture_url' => 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=300&h=300&fit=crop&crop=face',
|
||||
'created_at' => Carbon::now()->subDays(30),
|
||||
'updated_at' => Carbon::now()->subDays(5),
|
||||
],
|
||||
];
|
||||
|
||||
DB::table('users')->insert($users);
|
||||
}
|
||||
}
|
||||
33
public/nginx.conf
Normal file
33
public/nginx.conf
Normal file
@ -0,0 +1,33 @@
|
||||
worker_processes 1;
|
||||
|
||||
events { worker_connections 1024; }
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
|
||||
server {
|
||||
listen 5001;
|
||||
|
||||
root /var/www/public;
|
||||
|
||||
index index.php index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
include fastcgi_params;
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
}
|
||||
}
|
||||
2419
public/package-lock.json
generated
Normal file
2419
public/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
17
public/package.json
Normal file
17
public/package.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/package.json",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "vite build",
|
||||
"dev": "vite"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/vite": "^4.0.0",
|
||||
"axios": "^1.8.2",
|
||||
"concurrently": "^9.0.1",
|
||||
"laravel-vite-plugin": "^1.2.0",
|
||||
"tailwindcss": "^4.0.0",
|
||||
"vite": "^6.2.4"
|
||||
}
|
||||
}
|
||||
33
public/phpunit.xml
Normal file
33
public/phpunit.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
<directory>tests/Unit</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Feature">
|
||||
<directory>tests/Feature</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<source>
|
||||
<include>
|
||||
<directory>app</directory>
|
||||
</include>
|
||||
</source>
|
||||
<php>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
|
||||
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||
<env name="CACHE_STORE" value="array"/>
|
||||
<env name="DB_CONNECTION" value="sqlite"/>
|
||||
<env name="DB_DATABASE" value=":memory:"/>
|
||||
<env name="MAIL_MAILER" value="array"/>
|
||||
<env name="PULSE_ENABLED" value="false"/>
|
||||
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
<env name="TELESCOPE_ENABLED" value="false"/>
|
||||
</php>
|
||||
</phpunit>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user