feat(monorepo): migrate to typescript monorepo

This commit is contained in:
2025-11-07 17:09:29 +02:00
committed by BernardNganduDev
parent 3e09956f05
commit 075a388ccb
745 changed files with 2341 additions and 5082 deletions
+71
View File
@@ -0,0 +1,71 @@
# In all environments, the following files are loaded if they exist,
# the latter taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
#
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
# https://symfony.com/doc/current/configuration/secrets.html
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=f51bc23b4d778b25fcb9804bb9dfaf39
###< symfony/framework-bundle ###
BASANGO_CRAWLER_TOKEN=dev
BASANGO_NOTIFICATION_EMAIL=
BASANGO_TIMEZONE=Africa/Lubumbashi
BASANGO_GOOGLE_SEARCH_API_KEY=
BASANGO_NEWS_DATA_API_KEY=
###> Devy ###
DEVY_TOKEN=
DEVY_CHANNEL=
DEVY_TOPIC=4919
###< Devy ###
###> symfony/mailer ###
MAILER_DSN=smtp://mailer:1025?encryption=null&auth_mode=null
###< symfony/mailer ###
###> symfony/messenger ###
# Choose one of the transports below
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
###< symfony/messenger ###
###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
#
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
#DATABASE_URL="mysql://root:root@mariadb:3306/app?serverVersion=Mariadb-10.11.11&charset=utf8mb4"
DATABASE_URL="postgresql://postgres:postgres@postgres:5432/app?serverVersion=16&charset=utf8"
###< doctrine/doctrine-bundle ###
###> lexik/jwt-authentication-bundle ###
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
JWT_PASSPHRASE=fa85ee5fac0b5ab29b4bd41927d12fd56420d28994be1738bb7e52dcf9dc163a
JWT_TTL=84600
###< lexik/jwt-authentication-bundle ###
###> sentry/sentry-symfony ###
SENTRY_DSN=
###< sentry/sentry-symfony ###
###> blackfilre/blackfire ###
BLACKFIRE_SERVER_ID=
BLACKFIRE_SERVER_TOKEN=
BLACKFIRE_CLIENT_ID=
BLACKFIRE_CLIENT_TOKEN=
###< blackfire/blackfire ###
+6
View File
@@ -0,0 +1,6 @@
# define your env variables for the test env here
KERNEL_CLASS='Basango\SharedKernel\Infrastructure\Framework\Symfony\Kernel'
APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999
PANTHER_APP_ENV=panther
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
+28
View File
@@ -0,0 +1,28 @@
.idea
/data/
.deptrac.cache
.nohup.out
.*.out
.DS_Store
###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###
###> phpstan/phpstan ###
phpstan.neon
###< phpstan/phpstan ###
###> phpunit/phpunit ###
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###
###> lexik/jwt-authentication-bundle ###
/config/jwt/*.pem
###< lexik/jwt-authentication-bundle ###
+68
View File
@@ -0,0 +1,68 @@
<IfModule mod_headers.c>
<FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>
<IfModule mod_rewrite.c >
RewriteEngine on
RewriteOptions inherit
# SSL and let's encrypt
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/.+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^.well-known/acme-challenge - [L]
# redirect to no-www
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# https redirect
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# redirect all requests to public directory
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]
</IfModule>
# Enable Gzip Compression for page speed
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
# Enable Deflate Comporession for page speed
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE image/jpeg
AddOutputFilterByType DEFLATE image/png
AddOutputFilterByType DEFLATE image/gif
AddOutputFilterByType DEFLATE image/bmp
AddOutputFilterByType DEFLATE image/jpeg,
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE audio/mpeg
AddOutputFilterByType DEFLATE audio/*
AddOutputFilterByType DEFLATE video/mp4
</IfModule>
+24
View File
@@ -0,0 +1,24 @@
# CHANGELOG
This changelog references the relevant changes (bug and security fixes) done
## [Unreleased]
- Added: `app:stats' command to get the number of articles in the database
- Modified: use `hash` instead of `link` field as index in `articles` table
- Added: support for wp-json plugin via `WordPressJson` class
- Added: `getPagination` method to `Source` abstract class
- Added: `--parallel` option to `app:crawl` command to crawl multiple pages in parallel
- Added: `app:update` command to update the database with the latest articles
- Added: `$sep` parameter to `DateRange::from` method
- Added: support for mysql database
- Added: export to csv feature
- Removed: `--filename` option from `app:crawl` command
### 1.2.1
- Added: '--page' option to 'app:crawl' command
- Added: '--date' option to 'app:crawl' command
- Added: notification by email when the crawl is finished
### 1.0.0
- Initial release
+38
View File
@@ -0,0 +1,38 @@
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!
cff-version: 1.2.0
title: Basango
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Bernard
name-particle: Tshabu
family-names: Ngandu
email: bernard@devscast.tech
affiliation: Devscast Community
orcid: 'https://orcid.org/0009-0003-9777-6349'
repository-code: 'https://github.com/bernard-ng/basango'
repository: >-
https://www.huggingface.c0/datasets/bernard-ng/basango
abstract: >-
The "Basango" is a curated collection of news
articles sourced from major media outlets covering a wide
spectrum of topics related to the Democratic Republic of
Congo (DRC). This dataset encompasses a diverse range of
news stories, including but not limited to politics,
economy, social issues, culture, environment, and
international relations, providing comprehensive coverage
of events and developments within the country.
keywords:
- news
- datasets
- DRC
- politics
- NLP
license: CC-BY-NC-SA-4.0
commit: b1d386986b196ae0ab637ec1a50fd992cf829d34
version: 1.2.1
date-released: '2024-03-31'
+175
View File
@@ -0,0 +1,175 @@
## creative commons
# Attribution-NonCommercial-ShareAlike 4.0 International
Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
### Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses.
* __Considerations for licensors:__ Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. [More considerations for licensors](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensors).
* __Considerations for the public:__ By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensors permission is not necessary for any reasonfor example, because of any applicable exception or limitation to copyrightthen that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. [More considerations for the public](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensees).
## Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
### Section 1 Definitions.
a. __Adapted Material__ means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
b. __Adapter's License__ means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
c. __BY-NC-SA Compatible License__ means a license listed at [creativecommons.org/compatiblelicenses](http://creativecommons.org/compatiblelicenses), approved by Creative Commons as essentially the equivalent of this Public License.
d. __Copyright and Similar Rights__ means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
e. __Effective Technological Measures__ means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
f. __Exceptions and Limitations__ means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
g. __License Elements__ means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution, NonCommercial, and ShareAlike.
h. __Licensed Material__ means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
i. __Licensed Rights__ means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
j. __Licensor__ means the individual(s) or entity(ies) granting rights under this Public License.
k. __NonCommercial__ means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
l. __Share__ means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
m. __Sui Generis Database Rights__ means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
n. __You__ means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
### Section 2 Scope.
a. ___License grant.___
1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
A. reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
B. produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
2. __Exceptions and Limitations.__ For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
3. __Term.__ The term of this Public License is specified in Section 6(a).
4. __Media and formats; technical modifications allowed.__ The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
5. __Downstream recipients.__
A. __Offer from the Licensor Licensed Material.__ Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
B. __Additional offer from the Licensor Adapted Material.__ Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapters License You apply.
C. __No downstream restrictions.__ You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
6. __No endorsement.__ Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
b. ___Other rights.___
1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this Public License.
3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
### Section 3 License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
a. ___Attribution.___
1. If You Share the Licensed Material (including in modified form), You must:
A. retain the following if it is supplied by the Licensor with the Licensed Material:
i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of warranties;
v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
b. ___ShareAlike.___
In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
1. The Adapters License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-NC-SA Compatible License.
2. You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
3. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
### Section 4 Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
### Section 5 Disclaimer of Warranties and Limitation of Liability.
a. __Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.__
b. __To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.__
c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
### Section 6 Term and Termination.
a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
### Section 7 Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
### Section 8 Interpretation.
a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
> Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at [creativecommons.org/policies](http://creativecommons.org/policies), Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
>
> Creative Commons may be contacted at creativecommons.org
+97
View File
@@ -0,0 +1,97 @@
.PHONY: default
default: help
# -----------------------------------
# Variables
# -----------------------------------
user := $(shell id -u)
group := $(shell id -g)
dc := USER_ID=$(user) GROUP_ID=$(group) docker compose -f ../../compose.yaml
.PHONY: help
help:
@echo Tasks:
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
# -----------------------------------
# Docker Compose
# -----------------------------------
FORCE:
.PHONY: build
build: ## Build & start .docker containers for development
$(dc) build && \
$(dc) up -d
$(dc) run --rm php composer install && \
$(dc) run --rm php bin/console c:c
.PHONY: ssh
ssh: ## SSH into container
$(dc) exec php bash
.PHONY: start
start: ## Start .docker containers
$(dc) --env-file .env.local up -d
.PHONY: restart
restart: ## Restart .docker containers
$(dc) restart
.PHONY: stop
stop: ## Stop .docker containers
$(dc) stop
.PHONY: logs
logs: ## Show logs of .docker containers
@$(dc) logs --tail=0 --follow
.PHONY: destroy
destroy: ## Destroy .docker containers
$(dc) kill && \
$(dc) rm -f
# -----------------------------------
# CI / CD
# -----------------------------------
.PHONY: lint
lint: ## code quality analysis
$(dc) run --rm php composer app:cs
.PHONY: test
test: ## unit and functional tests
$(dc) run --rm php composer app:test
#$(dc) run --rm php composer app:behat
.PHONY: audit
audit: ## security audit
$(dc) run --rm php composer audit
.PHONY: deploy
deploy: ## Deployment tasks
/usr/bin/php ~/composer.phar install --optimize-autoloader
/usr/bin/php bin/console doctrine:database:create --if-not-exists
/usr/bin/php bin/console doctrine:migrations:migrate --no-interaction --allow-no-migration --all-or-nothing
/usr/bin/php bin/console cache:clear --env=prod
/usr/bin/php bin/console secrets:decrypt-to-local --env=prod
/usr/bin/php ~/composer.phar symfony:dump-env prod
# -----------------------------------
# Symfony
# -----------------------------------
.PHONY: migrate
migrate: ## Run migrations
$(dc) run --rm php bin/console doctrine:databases:create --if-not-exists
$(dc) run --rm php bin/console doctrine:migrations:migrate --no-interaction
.PHONY: cache
cache: ## Clear cache
$(dc) run --rm php bin/console cache:clear
$(dc) run --rm php bin/console cache:warmup
# -----------------------------------
# Dependencies
# -----------------------------------
.PHONY: deps
deps: ## Install dependencies
$(dc) run --rm php composer install
$(dc) run --rm node yarn install --force
$(dc) run --rm node yarn build
+108
View File
@@ -0,0 +1,108 @@
# Core and Backend
![Deployed](https://github.com/bernard-ng/basango/actions/workflows/deploy.yaml/badge.svg)
![Coding Standard](https://github.com/bernard-ng/basango/actions/workflows/quality.yaml/badge.svg)
![Tests](https://github.com/bernard-ng/basango/actions/workflows/tests.yaml/badge.svg)
![Security](https://github.com/bernard-ng/basango/actions/workflows/audit.yaml/badge.svg)
| Scope | Link |
|-------------------|------------------------------------------------------------|
| core and backend | https://github.com/bernard-ng/basango |
| ML models | https://github.com/bernard-ng/drc-news-ml |
| Mobile App | https://github.com/bernard-ng/basango |
| Dataset (partial) | https://huggingface.co/datasets/bernard-ng/basango |
---
## Basango : Towards a scalable and intelligent system for Congolese News curation
### Introduction
The **"Basango"** is a structured and scalable dataset of news articles sourced from major media outlets covering diverse aspects of the Democratic Republic of Congo (DRC). Designed for efficiency, this system enables the automated collection, processing, and organization of news stories spanning politics, economy, society, culture, environment, and international affairs.
### Scalability and Use Cases:
This dataset is built to support large-scale text analysis, making it a valuable resource for researchers, journalists, policymakers, and data scientists. It facilitates tasks such as sentiment analysis, trend detection, entity recognition, and language modeling, providing deep insights into the evolving socio-political and economic landscape of the DRC.
To ensure quality and reliability, the dataset prioritizes reputable news sources while maintaining an adaptable framework for continuous expansion. However, users are encouraged to critically assess the content, as journalistic standards and perspectives may vary.
### Sources
| Source | Articles | Link |
|----------------------|----------|--------------------------------------|
| radiookapi.net | +100k | https://www.radiookapi.net/actualite |
| mediacongo.cd | +100k | https://www.mediacongo.net/ |
| beto.cd | +30k | https://www.beto.cd/ |
| actualite.cd | +57k | https://actualite.cd/ |
| 7sur7.cd | +50k | https://7sur7.cd |
| newscd.net | +5k | https://newscd.net |
| congoindependant.com | +10k | https://www.congoindependant.com/ |
| congoactu.net | +10k | https://www.congoactu.net/ |
### Build the dataset
If you want to rebuild the dataset follow the steps bellow :
#### Installation
```bash
git clone https://github.com/bernard-ng/basango.git && cd basango
make build
make start
```
#### Usage
See supported sources above. you can also add your own source by extending the `App/Aggregator/Infrastructure/Crawler/Source/Source` abstract class.
if you want to crawl `radiookapi.net` you can run the following command:
##### 1. **Crawling**
```bash
php bin/console app:crawl radiookapi.net
# You can specify a date range to crawl articles.
php bin/console app:crawl beto.cd --date="2022-01-01:2022-12-31"
# You can specify a page range to crawl articles.
php bin/console app:crawl mediacongo.net --page="0:6"
# You can specify both date and page range.
php bin/console app:crawl actualite.cd --date="2022-01-01:2022-12-31" --page="0:6"
# some sources require a category to crawl articles.
php bin/console app:crawl 7sur7.cd --category=politique
# You can crawl multiple pages in parallel (WIP - not stable).
php bin/console app:crawl radiookapi.net --parallel=20
```
##### 2. **Updating**
```bash
# Update the database with the latest articles.
php bin/console app:update radiookapi.net
```
Notice that this can take a while depending on the number of articles you want to crawl and will store the articles in the database.
running this command in the background is recommended. by default no output is generated, you can add the `-v` option to see the progress.
```bash
nohup php bin/console app:crawl radiookapi.net -v > crawling.log
```
##### 3. **Statistics**
```bash
# Get the number of articles in the database.
php bin/console app:stats
```
### Export the dataset
You can export the dataset to a CSV file by running the following command:
```bash
php bin/console app:export radiookapi.net
```
a CSV file will be generated in the `data` directory.
### Acknowledgment:
The compilation and curation of the "Basango" were conducted by Tshabu Ngandu Bernard with the primary objective of facilitating research and analysis related to the Democratic Republic of Congo.
I do not own the content of the articles, and all rights belong to the respective publishers. The dataset is intended for non-commercial research purposes only.
@@ -0,0 +1,32 @@
meta {
name: add-article
type: http
seq: 1
}
post {
url: {{baseUrl}}/aggregator/articles?token=dev
body: json
auth: inherit
}
params:query {
token: dev
}
body:json {
{
"title": "test",
"body": "hello world",
"link": "https://devscast.tech",
"categories": ["a", "b"],
"source": "radiookapi.net",
"timestamp": 12,
"metadata": {
"title": "test",
"description": "some description",
"image": "https://devscast.tech/logo.svg",
"locale": "fr"
}
}
}
@@ -0,0 +1,8 @@
meta {
name: aggregator
seq: 3
}
auth {
mode: inherit
}
+9
View File
@@ -0,0 +1,9 @@
{
"version": "1",
"name": "basango",
"type": "collection",
"ignore": [
"node_modules",
".git"
]
}
+7
View File
@@ -0,0 +1,7 @@
vars {
baseUrl: http://localhost:8000/api
}
vars:secret [
token,
refreshToken
]
@@ -0,0 +1,7 @@
vars {
baseUrl: https://devscast.org/api
}
vars:secret [
refreshToken,
token
]
@@ -0,0 +1,25 @@
meta {
name: add-comment-to-article
type: http
seq: 2
}
post {
url: {{baseUrl}}/feed/articles/:articleId/comments
body: json
auth: bearer
}
params:path {
articleId: 019589b9-7137-7156-9aeb-1e3f0f138a15
}
auth:bearer {
token: {{token}}
}
body:json {
{
"content": "this is a comment !"
}
}
@@ -0,0 +1,19 @@
meta {
name: article-comment-list
type: http
seq: 5
}
get {
url: {{baseUrl}}/feed/articles/:articleId/comments
body: none
auth: bearer
}
params:path {
articleId: 019589b9-7137-7156-9aeb-1e3f0f138a15
}
auth:bearer {
token: {{token}}
}
@@ -0,0 +1,19 @@
meta {
name: article-details
type: http
seq: 1
}
get {
url: {{baseUrl}}/feed/articles/:articleId
body: none
auth: bearer
}
params:path {
articleId: 019589b9-7137-7156-9aeb-1e3f0f138a15
}
auth:bearer {
token: {{token}}
}
@@ -0,0 +1,24 @@
meta {
name: article-overview-list
type: http
seq: 3
}
get {
url: {{baseUrl}}/feed/articles
body: none
auth: bearer
}
params:query {
~lastId: 019589b9-7137-7af1-96b3-9ff7427218fb
~dateRange[start]: 1740614400
~dateRange[end]: 1740700800
~page: 22
~limit: 100
~search: Tshisekedi
}
auth:bearer {
token: {{token}}
}
@@ -0,0 +1,4 @@
meta {
name: article
seq: 3
}
@@ -0,0 +1,20 @@
meta {
name: remove-comment-from-article
type: http
seq: 4
}
delete {
url: {{baseUrl}}/feed/articles/:articleId/comments/:commentId
body: none
auth: bearer
}
params:path {
commentId: 01971449-6f1b-724f-bb43-2bc0af698c5f
articleId: 019589b9-7137-7156-9aeb-1e3f0f138a15
}
auth:bearer {
token: {{token}}
}
@@ -0,0 +1,20 @@
meta {
name: add-article-to-bookmark
type: http
seq: 3
}
post {
url: {{baseUrl}}/feed/bookmarks/:bookmarkId/articles/:articleId
body: none
auth: bearer
}
params:path {
articleId: 01957834-0d68-7a45-9f77-39e66fd92b4f
bookmarkId: 0196d6e6-dd3b-7f46-8097-a8b260dcd2de
}
auth:bearer {
token: {{token}}
}
@@ -0,0 +1,15 @@
meta {
name: bookmark-list
type: http
seq: 6
}
get {
url: {{baseUrl}}/feed/bookmarks
body: none
auth: bearer
}
auth:bearer {
token: {{token}}
}
@@ -0,0 +1,19 @@
meta {
name: bookmarked-articles-list
type: http
seq: 7
}
get {
url: {{baseUrl}}/feed/bookmarks/:bookmarkId/articles
body: none
auth: bearer
}
params:path {
bookmarkId: 0196d6e6-dd3b-7f46-8097-a8b260dcd2de
}
auth:bearer {
token: {{token}}
}
@@ -0,0 +1,24 @@
meta {
name: create-bookmark
type: http
seq: 1
}
post {
url: {{baseUrl}}/feed/bookmarks
body: json
auth: bearer
}
auth:bearer {
token: {{token}}
}
body:json {
{
"name": "read later",
"description": null,
"isPublic": false
}
}
@@ -0,0 +1,19 @@
meta {
name: delete-bookmark
type: http
seq: 2
}
delete {
url: {{baseUrl}}/feed/bookmarks/:bookmarkId
body: none
auth: bearer
}
params:path {
bookmarkId: 0196d1dc-eb76-7481-8ba5-90c73f838411
}
auth:bearer {
token: {{token}}
}
@@ -0,0 +1,3 @@
meta {
name: bookmark
}
@@ -0,0 +1,20 @@
meta {
name: remove-article-from-bookmark
type: http
seq: 4
}
delete {
url: {{baseUrl}}/feed/bookmarks/:bookmarkId/articles/:articleId
body: none
auth: bearer
}
params:path {
articleId: 019549f9-13d8-725b-81f6-3c7e75aa5a26
bookmarkId: 0196d1dc-eb76-7481-8ba5-90c73f838411
}
auth:bearer {
token: {{token}}
}
@@ -0,0 +1,27 @@
meta {
name: update-bookmark
type: http
seq: 5
}
put {
url: {{baseUrl}}/feed/bookmarks/:bookmarkId
body: json
auth: bearer
}
params:path {
bookmarkId: 0196d1dc-eb76-7481-8ba5-90c73f838411
}
auth:bearer {
token: {{token}}
}
body:json {
{
"name": "updated name",
"description": "some description",
"isPublic": true
}
}
@@ -0,0 +1,3 @@
meta {
name: feed-management
}
@@ -0,0 +1,4 @@
meta {
name: source
seq: 2
}
@@ -0,0 +1,19 @@
meta {
name: follow-source
type: http
seq: 2
}
post {
url: {{baseUrl}}/feed/sources/:sourceId/follow
body: none
auth: bearer
}
params:path {
sourceId: 01970f05-a945-7ef0-bfe3-4583491d58d2
}
auth:bearer {
token: {{token}}
}
@@ -0,0 +1,28 @@
meta {
name: source-article-overview-list
type: http
seq: 4
}
get {
url: {{baseUrl}}/feed/sources/:sourceId/articles
body: none
auth: bearer
}
params:query {
~lastId: 019549f9-0962-7fb5-9197-29b1754d13a5
~dateRange[start]: 1740614400
~dateRange[end]: 1740700800
~page: 22
~limit: 100
~search: Lubumbashi
}
params:path {
sourceId: 01970f05-a945-7ef0-bfe3-4583491d58d2
}
auth:bearer {
token: {{token}}
}
@@ -0,0 +1,24 @@
meta {
name: source-details
type: http
seq: 1
}
get {
url: {{baseUrl}}/feed/sources/:sourceId
body: none
auth: bearer
}
params:path {
sourceId: 01970f05-a945-7ef0-bfe3-4583491d58d2
}
headers {
accept: application/json
:
}
auth:bearer {
token: {{token}}
}
@@ -0,0 +1,26 @@
meta {
name: sources-overview-list
type: http
seq: 3
}
get {
url: {{baseUrl}}/feed/sources
body: none
auth: bearer
}
params:query {
~lastId: 01970f05-a945-7ef0-bfe3-45834b6bc40e
~limit: 10
~page: 1
}
headers {
accept: application/json
:
}
auth:bearer {
token: {{token}}
}
@@ -0,0 +1,19 @@
meta {
name: unfollow-source
type: http
seq: 5
}
delete {
url: {{baseUrl}}/feed/sources/:sourceId/unfollow
body: none
auth: bearer
}
params:path {
sourceId: 01970f05-a945-7ef0-bfe3-4583491d58d2
}
auth:bearer {
token: {{token}}
}
@@ -0,0 +1,15 @@
meta {
name: account-confirm
type: http
seq: 8
}
get {
url: {{baseUrl}}/account/confirm/:token
body: none
auth: none
}
params:path {
token: WNg8QWMENL77hbCXXkrqyCtYLn5MV7ngEbSJledP9DB6V701LwDPfMJZdkn2
}
@@ -0,0 +1,15 @@
meta {
name: account-unlock
type: http
seq: 7
}
get {
url: {{baseUrl}}/account/unlock/:token
body: none
auth: none
}
params:path {
token: KFgBaXF4dxX4PtOMlrpjOoO6g1bkm6zAuvm8ocxC41LwJ27XQOHMn1J7V3kI
}
@@ -0,0 +1,18 @@
meta {
name: login
type: http
seq: 1
}
post {
url: {{baseUrl}}/login_check
body: json
auth: none
}
body:json {
{
"username": "bernard@devscast.tech",
"password": "#New--123pass@"
}
}
@@ -0,0 +1,15 @@
meta {
name: logout
type: http
seq: 10
}
post {
url: {{baseUrl}}/token/invalidate
body: none
auth: bearer
}
auth:bearer {
token:
}
@@ -0,0 +1,17 @@
meta {
name: password-request
type: http
seq: 3
}
post {
url: {{baseUrl}}/password/request
body: json
auth: none
}
body:json {
{
"email": "bernard@devscast.tech"
}
}
@@ -0,0 +1,22 @@
meta {
name: password-reset
type: http
seq: 4
}
post {
url: {{baseUrl}}/password/reset/:token
body: json
auth: none
}
params:path {
token: qCdtZkciu7C82LVlnZhjpogfYfxUbApkHdSQmJuFQhqaINHjU2bro5uMzuY3
}
body:json {
{
"password": "#New--123pass@",
"confirm": "#New--123pass@"
}
}
@@ -0,0 +1,23 @@
meta {
name: password-update
type: http
seq: 6
}
post {
url: {{baseUrl}}/password/update
body: json
auth: bearer
}
auth:bearer {
token: {{token}}
}
body:json {
{
"current": "#1231AZuu*---23213",
"password": "#New--123pass@",
"confirm": "#New--123pass@"
}
}
@@ -0,0 +1,17 @@
meta {
name: refresh-token
type: http
seq: 2
}
post {
url: {{baseUrl}}/token/refresh
body: json
auth: none
}
body:json {
{
"refresh_token": "{{refreshToken}}"
}
}
@@ -0,0 +1,19 @@
meta {
name: register
type: http
seq: 5
}
post {
url: {{baseUrl}}/register
body: json
auth: none
}
body:json {
{
"name": "bernard",
"email": "bernard@devscast.org",
"password": "#New--123pass@"
}
}
@@ -0,0 +1,15 @@
meta {
name: user-profile
type: http
seq: 9
}
get {
url: {{baseUrl}}/me
body: none
auth: bearer
}
auth:bearer {
token: {{token}}
}
+16
View File
@@ -0,0 +1,16 @@
default:
suites:
default:
contexts:
- Tests\Behat\Hook\DatabasePurger
paths:
- tests/Behat/features
formatters:
progress: true
extensions:
FriendsOfBehat\SymfonyExtension:
bootstrap: tests/bootstrap.php
kernel:
class: Basango\SharedKernel\Infrastructure\Framework\Symfony\Kernel
+52
View File
@@ -0,0 +1,52 @@
#!/usr/bin/env bash
# Get the script directory and define data directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DATA_DIR="${SCRIPT_DIR}/../data"
DUMP_FILE="${DATA_DIR}/data.sql"
ARCHIVE_FILE="${DUMP_FILE}.gz"
# Ensure data directory exists
mkdir -p "$DATA_DIR"
# Load environment variables from .env.local
set -a
if [ -f "${SCRIPT_DIR}/../.env.local" ]; then
export "$(grep -v '^#' "${SCRIPT_DIR}/../.env.local" | grep '=' | xargs)"
fi
set +a
# Parse DATABASE_URL into components
if [[ -z "$DATABASE_URL" ]]; then
echo "DATABASE_URL is not set in .env.local"
exit 1
fi
regex="^mysql:\/\/([^:]+):([^@]+)@([^:]+):([0-9]+)\/([^?]+)"
if [[ "$DATABASE_URL" =~ $regex ]]; then
DB_USER="${BASH_REMATCH[1]}"
DB_PASSWORD="${BASH_REMATCH[2]}"
DB_HOST="${BASH_REMATCH[3]}"
DB_PORT="${BASH_REMATCH[4]}"
DB_NAME="${BASH_REMATCH[5]}"
else
echo "Invalid DATABASE_URL format"
exit 1
fi
# Step 1: Dump the database
mysqldump --host="${DB_HOST}" --port="${DB_PORT}" \
--user="${DB_USER}" --password="${DB_PASSWORD}" \
--max_allowed-packet=1G --net-buffer-length=32704 --skip-extended-insert \
"${DB_NAME}" > "$DUMP_FILE"
gzip -f "$DUMP_FILE"
# Step 2: Send the file to Telegram
curl -F "chat_id=${DEVY_CHANNEL}" \
-F "message_thread_id=${DEVY_TOPIC}" \
-F "document=@${ARCHIVE_FILE}" \
"https://api.telegram.org/bot${DEVY_TOKEN}/sendDocument"
# Step 3: Clean up
rm -f "$ARCHIVE_FILE" "$DUMP_FILE"
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env php
<?php
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Basango\SharedKernel\Infrastructure\Framework\Symfony\Kernel;
if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
return function (array $context) {
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
return new Application($kernel);
};
+141
View File
@@ -0,0 +1,141 @@
{
"type": "project",
"license": "proprietary",
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": ">=8.4",
"ext-ctype": "*",
"ext-dom": "*",
"ext-iconv": "*",
"cweagans/composer-patches": "^1.7.3",
"doctrine/dbal": "^3.9.4",
"doctrine/doctrine-bundle": "^2.13.2",
"doctrine/doctrine-migrations-bundle": "^3.4.1",
"doctrine/orm": "^3.3.1",
"geoip2/geoip2": "^3.1",
"gesdinet/jwt-refresh-token-bundle": "^1.4",
"knplabs/knp-paginator-bundle": "^6.7",
"league/csv": "^9.21",
"lexik/jwt-authentication-bundle": "^3.1",
"martin-georgiev/postgresql-for-doctrine": "^3.5",
"matomo/device-detector": "^6.4",
"phpdocumentor/reflection-docblock": "^5.6",
"phpstan/phpdoc-parser": "^2.1",
"sentry/sentry-symfony": "^5.2",
"symfony/console": "7.2.*",
"symfony/css-selector": "7.2.*",
"symfony/dom-crawler": "7.2.*",
"symfony/dotenv": "7.2.*",
"symfony/flex": "^2.4.7",
"symfony/framework-bundle": "7.2.*",
"symfony/http-client": "7.2.*",
"symfony/mailer": "7.2.*",
"symfony/messenger": "7.2.*",
"symfony/monolog-bundle": "^3.10",
"symfony/property-access": "7.2.*",
"symfony/property-info": "7.2.*",
"symfony/runtime": "7.2.*",
"symfony/security-bundle": "7.2.*",
"symfony/serializer": "7.2.*",
"symfony/stopwatch": "7.2.*",
"symfony/twig-bundle": "7.2.*",
"symfony/uid": "7.2.*",
"symfony/validator": "7.2.*",
"symfony/yaml": "7.2.*",
"twig/extra-bundle": "^2.12|^3.19",
"twig/twig": "^2.12|^3.19",
"webmozart/assert": "^1.11"
},
"require-dev": {
"behat/behat": "^3.22",
"deptrac/deptrac": "^2.0.7",
"doctrine/doctrine-fixtures-bundle": "^4.1",
"friends-of-behat/symfony-extension": "^2.6",
"phpstan/phpstan": "^2.1.12",
"phpstan/phpstan-doctrine": "^2.0",
"phpstan/phpstan-symfony": "^2.0",
"phpunit/phpunit": "^12.1.1",
"rector/rector": "^2.0.12",
"shipmonk/composer-dependency-analyser": "^1.8.2",
"symfony/maker-bundle": "^1.62.1",
"symfony/web-profiler-bundle": "7.2.*",
"symplify/easy-coding-standard": "^12.1.13",
"tomasvotruba/class-leak": "^1.2.7"
},
"config": {
"allow-plugins": {
"php-http/discovery": true,
"symfony/flex": true,
"symfony/runtime": true,
"cweagans/composer-patches": true
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"Basango\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"replace": {
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php72": "*",
"symfony/polyfill-php73": "*",
"symfony/polyfill-php74": "*",
"symfony/polyfill-php80": "*",
"symfony/polyfill-php81": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
],
"app:cs": [
"./vendor/bin/ecs check",
"bin/console lint:yaml config --parse-tags",
"bin/console lint:twig templates",
"bin/console lint:container",
"./vendor/bin/phpstan analyse --memory-limit=-1 --configuration=phpstan.dist.neon",
"./vendor/bin/rector --dry-run"
],
"app:tests": [
"APP_ENV=test ./vendor/bin/phpunit"
],
"app:behat": [
"APP_ENV=test bin/console doctrine:database:create",
"APP_ENV=test bin/console doctrine:migration:migrate --no-interaction --allow-no-migration --all-or-nothing",
"APP_ENV=test ./vendor/bin/behat --format=progress --no-interaction"
],
"app:env": [
"APP_RUNTIME_ENV=prod bin/console secrets:decrypt-to-local --force",
"bin/console dotenv:dump prod"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "7.2.*"
},
"patches": {
"symfony/monolog-bundle": {
"support telegram topic in configuration": "./patches/monolog-telegram-configuration.patch",
"support telegram topic in extension": "./patches/monolog-telegram-extension.patch"
}
}
}
}
+11632
View File
File diff suppressed because it is too large Load Diff
+19
View File
@@ -0,0 +1,19 @@
<?php
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Knp\Bundle\PaginatorBundle\KnpPaginatorBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true],
Gesdinet\JWTRefreshTokenBundle\GesdinetJWTRefreshTokenBundle::class => ['all' => true],
Sentry\SentryBundle\SentryBundle::class => ['prod' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
];
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity
name="Basango\Aggregator\Domain\Model\Entity\Article"
repository-class="Basango\Aggregator\Infrastructure\Persistence\Doctrine\ORM\ArticleOrmRepository"
table="article"
>
<id name="id" type="article_id">
<generator strategy="NONE" />
</id>
<field name="title" length="1024" />
<field name="body" type="text" />
<embedded name="link" class="Basango\Aggregator\Domain\Model\ValueObject\Link" use-column-prefix="false" />
<field name="hash" length="32" />
<field name="categories" type="text[]" nullable="true" />
<many-to-one field="source" target-entity="Basango\Aggregator\Domain\Model\Entity\Source" fetch="EAGER">
<join-column nullable="false" on-delete="CASCADE" />
</many-to-one>
<embedded name="credibility" class="Basango\Aggregator\Domain\Model\ValueObject\Scoring\Credibility" use-column-prefix="false" />
<field name="sentiment" enum-type="Basango\Aggregator\Domain\Model\ValueObject\Scoring\Sentiment" length="30">
<options>
<option name="default">neutral</option>
</options>
</field>
<field name="metadata" type="open_graph" nullable="true" />
<embedded name="readingTime" class="Basango\Aggregator\Domain\Model\ValueObject\ReadingTime" use-column-prefix="false" />
<field name="tokenStatistics" type="token_statistics" nullable="true" />
<field name="image"
insertable="false"
updatable="false"
column-definition="VARCHAR(1024) GENERATED ALWAYS AS ((metadata->>'image')) STORED"
/>
<field
name="excerpt"
insertable="false"
updatable="false"
column-definition="VARCHAR(255) GENERATED ALWAYS AS ((left(body, 200) || '...')) STORED"
/>
<field name="publishedAt" type="datetime_immutable" />
<field name="crawledAt" type="datetime_immutable" />
<field name="updatedAt" type="datetime_immutable" nullable="true" />
</entity>
</doctrine-mapping>
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity
name="Basango\Aggregator\Domain\Model\Entity\Source"
repository-class="Basango\Aggregator\Infrastructure\Persistence\Doctrine\ORM\SourceOrmRepository"
table="source"
>
<id name="id" type="source_id">
<generator strategy="NONE"/>
</id>
<field name="url" />
<field name="name" />
<embedded name="credibility" class="Basango\Aggregator\Domain\Model\ValueObject\Scoring\Credibility" use-column-prefix="false" />
<field name="displayName" nullable="true" />
<field name="description" length="1024" nullable="true" />
<field name="updatedAt" type="datetime_immutable" nullable="true"/>
</entity>
</doctrine-mapping>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="https://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<embeddable name="Basango\Aggregator\Domain\Model\ValueObject\Link">
<field name="link" length="1024" />
</embeddable>
</doctrine-mapping>
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="https://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<embeddable name="Basango\Aggregator\Domain\Model\ValueObject\ReadingTime">
<field name="readingTime" type="integer" nullable="true">
<options>
<option name="default">1</option>
<option name="unsigned">true</option>
</options>
</field>
</embeddable>
</doctrine-mapping>
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="https://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<embeddable name="Basango\Aggregator\Domain\Model\ValueObject\Scoring\Credibility">
<field name="bias" enum-type="Basango\Aggregator\Domain\Model\ValueObject\Scoring\Bias" length="30">
<options>
<option name="default">neutral</option>
</options>
</field>
<field name="reliability" enum-type="Basango\Aggregator\Domain\Model\ValueObject\Scoring\Reliability" length="30">
<options>
<option name="default">reliable</option>
</options>
</field>
<field name="transparency" enum-type="Basango\Aggregator\Domain\Model\ValueObject\Scoring\Transparency" length="30">
<options>
<option name="default">medium</option>
</options>
</field>
</embeddable>
</doctrine-mapping>
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity
name="Basango\FeedManagement\Domain\Model\Entity\Bookmark"
repository-class="Basango\IdentityAndAccess\Infrastructure\Persistence\Doctrine\ORM\BookmarkOrmRepository"
table="bookmark"
>
<id name="id" type="bookmark_id">
<generator strategy="NONE"/>
</id>
<many-to-one field="user" target-entity="Basango\IdentityAndAccess\Domain\Model\Entity\User" fetch="EAGER">
<join-column nullable="false" on-delete="CASCADE" />
</many-to-one>
<field name="name" length="255" />
<field name="description" length="512" nullable="true" />
<field name="isPublic" type="boolean">
<options>
<option name="default">0</option>
</options>
</field>
<many-to-many field="articles" target-entity="Basango\Aggregator\Domain\Model\Entity\Article">
<join-table name="bookmark_article">
<join-columns>
<join-column name="bookmark_id" referenced-column-name="id" on-delete="CASCADE" />
</join-columns>
<inverse-join-columns>
<join-column name="article_id" referenced-column-name="id" on-delete="CASCADE" />
</inverse-join-columns>
</join-table>
</many-to-many>
<field name="createdAt" type="datetime_immutable"/>
<field name="updatedAt" type="datetime_immutable" nullable="true"/>
</entity>
</doctrine-mapping>
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity
name="Basango\FeedManagement\Domain\Model\Entity\Comment"
repository-class="Basango\FeedManagement\Infrastructure\Persistence\Doctrine\ORM\CommentOrmRepository"
table="comment"
>
<id name="id" type="comment_id">
<generator strategy="NONE"/>
</id>
<many-to-one field="user" target-entity="Basango\IdentityAndAccess\Domain\Model\Entity\User">
<join-column nullable="false" on-delete="CASCADE" />
</many-to-one>
<many-to-one field="article" target-entity="Basango\Aggregator\Domain\Model\Entity\Article">
<join-column nullable="false" on-delete="CASCADE" />
</many-to-one>
<field name="content" length="512" />
<field name="sentiment" enum-type="Basango\Aggregator\Domain\Model\ValueObject\Scoring\Sentiment" length="30">
<options>
<option name="default">neutral</option>
</options>
</field>
<field name="isSpam" type="boolean">
<options>
<option name="default">0</option>
</options>
</field>
<field name="createdAt" type="datetime_immutable"/>
</entity>
</doctrine-mapping>
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity
name="Basango\FeedManagement\Domain\Model\Entity\FollowedSource"
repository-class="Basango\IdentityAndAccess\Infrastructure\Persistence\Doctrine\ORM\FollowedSourceOrmRepository"
table="followed_source"
>
<id name="id" type="followed_source_id">
<generator strategy="NONE"/>
</id>
<many-to-one field="follower" target-entity="Basango\IdentityAndAccess\Domain\Model\Entity\User">
<join-column nullable="false" on-delete="CASCADE" />
</many-to-one>
<many-to-one field="source" target-entity="Basango\Aggregator\Domain\Model\Entity\Source">
<join-column nullable="false" on-delete="CASCADE" />
</many-to-one>
<field name="createdAt" type="datetime_immutable"/>
</entity>
</doctrine-mapping>
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity
name="Basango\IdentityAndAccess\Domain\Model\Entity\LoginAttempt"
repository-class="Basango\IdentityAndAccess\Infrastructure\Persistence\Doctrine\ORM\LoginAttemptOrmRepository"
table="login_attempt"
>
<id name="id" type="login_attempt_id">
<generator strategy="NONE"/>
</id>
<many-to-one field="user" target-entity="Basango\IdentityAndAccess\Domain\Model\Entity\User">
<join-column nullable="false" on-delete="CASCADE" />
</many-to-one>
<field name="createdAt" type="datetime_immutable"/>
</entity>
</doctrine-mapping>
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity
name="Basango\IdentityAndAccess\Domain\Model\Entity\LoginHistory"
repository-class="Basango\IdentityAndAccess\Infrastructure\Persistence\Doctrine\ORM\LoginAttemptOrmRepository"
table="login_history"
>
<id name="id" type="login_history_id">
<generator strategy="NONE"/>
</id>
<many-to-one field="user" target-entity="Basango\IdentityAndAccess\Domain\Model\Entity\User">
<join-column nullable="false" on-delete="CASCADE" />
</many-to-one>
<field name="ipAddress" type="inet" nullable="true" length="15" />
<embedded name="device" class="Basango\SharedKernel\Domain\Model\ValueObject\Tracking\Device" />
<embedded name="location" class="Basango\SharedKernel\Domain\Model\ValueObject\Tracking\GeoLocation" />
<field name="createdAt" type="datetime_immutable"/>
</entity>
</doctrine-mapping>
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity
name="Basango\IdentityAndAccess\Domain\Model\Entity\RefreshToken"
repository-class="Gesdinet\JWTRefreshTokenBundle\Entity\RefreshTokenRepository"
table="refresh_tokens"
>
<id name="id" type="integer">
<generator strategy="SEQUENCE" />
<sequence-generator sequence-name="refresh_tokens_id_seq" allocation-size="100" initial-value="1" />
</id>
<field name="refreshToken" type="string" column="refresh_token" length="128" unique="true"/>
<field name="username" type="string" length="255" column="username"/>
<field name="valid" type="datetime"/>
</entity>
</doctrine-mapping>
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity
name="Basango\IdentityAndAccess\Domain\Model\Entity\User"
repository-class="Basango\IdentityAndAccess\Infrastructure\Persistence\Doctrine\ORM\UserOrmRepository"
table="user"
>
<id name="id" type="user_id">
<generator strategy="NONE" />
</id>
<field name="name"/>
<field name="email" type="email" />
<field name="password" length="512" />
<embedded name="roles" class="Basango\IdentityAndAccess\Domain\Model\ValueObject\Roles" use-column-prefix="false" />
<field name="isLocked" type="boolean">
<options>
<option name="default">false</option>
</options>
</field>
<field name="isConfirmed" type="boolean">
<options>
<option name="default">false</option>
</options>
</field>
<field name="createdAt" type="datetime_immutable" />
<field name="updatedAt" type="datetime_immutable" nullable="true" />
</entity>
</doctrine-mapping>
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity
name="Basango\IdentityAndAccess\Domain\Model\Entity\VerificationToken"
repository-class="Basango\IdentityAndAccess\Infrastructure\Persistence\Doctrine\ORM\VerificationTokenOrmRepository"
table="verification_token"
>
<id name="id" type="verification_token_id">
<generator strategy="NONE"/>
</id>
<many-to-one field="user" target-entity="Basango\IdentityAndAccess\Domain\Model\Entity\User" fetch="EAGER">
<join-column nullable="false" on-delete="CASCADE" />
</many-to-one>
<field name="purpose" enum-type="Basango\IdentityAndAccess\Domain\Model\ValueObject\Secret\TokenPurpose" />
<embedded name="token" class="Basango\IdentityAndAccess\Domain\Model\ValueObject\Secret\GeneratedToken" use-column-prefix="false" />
<field name="createdAt" type="datetime_immutable"/>
</entity>
</doctrine-mapping>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<embeddable name="Basango\IdentityAndAccess\Domain\Model\ValueObject\Roles">
<field name="roles" type="jsonb"/>
</embeddable>
</doctrine-mapping>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<embeddable name="Basango\IdentityAndAccess\Domain\Model\ValueObject\Secret\GeneratedToken">
<field name="token" length="60" nullable="true" />
</embeddable>
</doctrine-mapping>
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="https://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<embeddable name="Basango\SharedKernel\Domain\Model\ValueObject\Tracking\Device">
<field name="operatingSystem" type="string" nullable="true" />
<field name="client" type="string" nullable="true" />
<field name="device" type="string" nullable="true" />
<field name="isBot" type="boolean" nullable="false" >
<options>
<option name="default">false</option>
</options>
</field>
</embeddable>
</doctrine-mapping>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="https://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<embeddable name="Basango\SharedKernel\Domain\Model\ValueObject\Tracking\GeoLocation">
<field name="timeZone" type="string" nullable="true"/>
<field name="longitude" type="float" nullable="true"/>
<field name="latitude" type="float" nullable="true" />
<field name="accuracyRadius" type="integer" nullable="true" />
</embeddable>
</doctrine-mapping>
@@ -0,0 +1,291 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
use Doctrine\Migrations\Exception\IrreversibleMigration;
/**
* Class Version20251019151441.
*
* @author bernard-ng <bernard@devscast.tech>
*/
final class Version20251019151441 extends AbstractMigration
{
public function getDescription(): string
{
return 'initial postgresql schema';
}
public function up(Schema $schema): void
{
$this->addSql("CREATE EXTENSION IF NOT EXISTS pg_trgm;"); // for trigram indexes (links, titles, etc.)
$this->addSql("SET SESSION TIME ZONE 'UTC';");
// -- ---------- TABLE: article ----------
$this->addSql(<<<SQL
CREATE TABLE article (
id UUID NOT NULL,
source_id UUID NOT NULL,
title VARCHAR(1024) NOT NULL,
body TEXT NOT NULL,
hash VARCHAR(32) NOT NULL,
categories TEXT[] DEFAULT NULL,
sentiment VARCHAR(30) DEFAULT 'neutral' NOT NULL,
metadata JSONB DEFAULT NULL,
image VARCHAR(1024) GENERATED ALWAYS AS ((metadata->>'image')) STORED,
excerpt VARCHAR(255) GENERATED ALWAYS AS ((LEFT(body, 200) || '...')) STORED,
published_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL,
crawled_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL,
updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL,
link VARCHAR(1024) NOT NULL,
bias VARCHAR(30) DEFAULT 'neutral' NOT NULL,
reliability VARCHAR(30) DEFAULT 'reliable' NOT NULL,
transparency VARCHAR(30) DEFAULT 'medium' NOT NULL,
reading_time INT DEFAULT 1,
CONSTRAINT CHK_ARTICLE_READING_TIME CHECK (reading_time >= 0),
CONSTRAINT CHK_ARTICLE_SENTIMENT CHECK (sentiment IN ('positive','neutral','negative')),
CONSTRAINT CHK_ARTICLE_METADATA_JSON CHECK (metadata IS NULL OR JSONB_TYPEOF(metadata) IN ('object','array')),
PRIMARY KEY (id)
)
SQL
);
$this->addSql('CREATE INDEX IDX_23A0E66953C1C61 ON article (source_id)');
$this->addSql('CREATE INDEX IDX_ARTICLE_PUBLISHED_AT ON article (published_at DESC)');
$this->addSql('CREATE INDEX IDX_ARTICLE_PUBLISHED_ID ON article (published_at DESC, id DESC)');
$this->addSql('CREATE UNIQUE INDEX UNQ_ARTICLE_HASH ON article (hash)');
$this->addSql(<<<SQL
ALTER TABLE article ADD COLUMN tsv TSVECTOR GENERATED ALWAYS AS (
SETWEIGHT(TO_TSVECTOR('french', COALESCE(title,'')), 'A') ||
SETWEIGHT(TO_TSVECTOR('french', COALESCE(body ,'')), 'B')
) STORED;
SQL
);
$this->addSql('CREATE INDEX GIN_ARTICLE_TSV ON article USING GIN(tsv)');
$this->addSql('CREATE INDEX GIN_ARTICLE_LINK_TRGM ON article USING GIN (link gin_trgm_ops)');
$this->addSql('CREATE INDEX GIN_ARTICLE_TITLE_TRGM ON article USING GIN (title gin_trgm_ops)');
$this->addSql('CREATE INDEX GIN_ARTICLE_CATEGORIES ON article USING GIN (categories)');
$this->addSql("COMMENT ON COLUMN article.id IS '(DC2Type:article_id)';");
$this->addSql("COMMENT ON COLUMN article.source_id IS '(DC2Type:source_id)';");
$this->addSql("COMMENT ON COLUMN article.published_at IS '(DC2Type:datetime_immutable)'");
$this->addSql("COMMENT ON COLUMN article.crawled_at IS '(DC2Type:datetime_immutable)'");
$this->addSql("COMMENT ON COLUMN article.updated_at IS '(DC2Type:datetime_immutable)'");
// -- ---------- TABLE: bookmark ----------
$this->addSql(<<<SQL
CREATE TABLE bookmark (
id UUID NOT NULL,
user_id UUID NOT NULL,
name VARCHAR(255) NOT NULL,
description VARCHAR(512) DEFAULT NULL,
is_public BOOLEAN DEFAULT false NOT NULL,
created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL,
updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL,
PRIMARY KEY(id)
)
SQL
);
$this->addSql('CREATE INDEX IDX_DA62921DA76ED395 ON bookmark (user_id)');
$this->addSql('CREATE INDEX IDX_BOOKMARK_USER_CREATED ON bookmark (user_id, created_at DESC)');
$this->addSql("COMMENT ON COLUMN bookmark.id IS '(DC2Type:bookmark_id)'");
$this->addSql("COMMENT ON COLUMN bookmark.user_id IS '(DC2Type:user_id)'");
$this->addSql("COMMENT ON COLUMN bookmark.created_at IS '(DC2Type:datetime_immutable)'");
$this->addSql("COMMENT ON COLUMN bookmark.updated_at IS '(DC2Type:datetime_immutable)'");
// -- ---------- TABLE: bookmark_article ----------
$this->addSql(<<<SQL
CREATE TABLE bookmark_article (
bookmark_id UUID NOT NULL,
article_id UUID NOT NULL,
PRIMARY KEY(bookmark_id, article_id)
)
SQL
);
$this->addSql('CREATE INDEX IDX_6FE2655D92741D25 ON bookmark_article (bookmark_id)');
$this->addSql('CREATE INDEX IDX_6FE2655D7294869C ON bookmark_article (article_id)');
$this->addSql("COMMENT ON COLUMN bookmark_article.bookmark_id IS '(DC2Type:bookmark_id)'");
$this->addSql("COMMENT ON COLUMN bookmark_article.article_id IS '(DC2Type:article_id)'");
// -- ---------- TABLE: comment ----------
$this->addSql(<<<SQL
CREATE TABLE comment (
id UUID NOT NULL,
user_id UUID NOT NULL,
article_id UUID NOT NULL,
content VARCHAR(512) NOT NULL,
sentiment VARCHAR(30) DEFAULT 'neutral' NOT NULL,
is_spam BOOLEAN DEFAULT false NOT NULL,
created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL,
PRIMARY KEY(id)
)
SQL
);
$this->addSql('CREATE INDEX IDX_9474526CA76ED395 ON comment (user_id)');
$this->addSql('CREATE INDEX IDX_9474526C7294869C ON comment (article_id)');
$this->addSql('CREATE INDEX IDX_COMMENT_ARTICLE_CREATED ON comment (article_id, created_at DESC)');
$this->addSql("COMMENT ON COLUMN comment.id IS '(DC2Type:comment_id)'");
$this->addSql("COMMENT ON COLUMN comment.user_id IS '(DC2Type:user_id)'");
$this->addSql("COMMENT ON COLUMN comment.article_id IS '(DC2Type:article_id)'");
$this->addSql("COMMENT ON COLUMN comment.created_at IS '(DC2Type:datetime_immutable)'");
// -- ---------- TABLE: followed_source ----------
$this->addSql(<<<SQL
CREATE TABLE followed_source (
id UUID NOT NULL,
follower_id UUID NOT NULL,
source_id UUID NOT NULL,
created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL,
PRIMARY KEY(id)
)
SQL
);
$this->addSql('CREATE INDEX IDX_7A763A3EAC24F853 ON followed_source (follower_id)');
$this->addSql('CREATE INDEX IDX_7A763A3E953C1C61 ON followed_source (source_id)');
$this->addSql('CREATE INDEX IDX_FOLLOWED_SOURCE_FOLLOWER_CREATED ON followed_source (follower_id, created_at DESC)');
$this->addSql("COMMENT ON COLUMN followed_source.id IS '(DC2Type:followed_source_id)'");
$this->addSql("COMMENT ON COLUMN followed_source.follower_id IS '(DC2Type:user_id)'");
$this->addSql("COMMENT ON COLUMN followed_source.source_id IS '(DC2Type:source_id)'");
$this->addSql("COMMENT ON COLUMN followed_source.created_at IS '(DC2Type:datetime_immutable)'");
// -- ---------- TABLE: login_attempt ----------
$this->addSql(<<<SQL
CREATE TABLE login_attempt (
id UUID NOT NULL,
user_id UUID NOT NULL,
created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL,
PRIMARY KEY(id)
)
SQL
);
$this->addSql('CREATE INDEX IDX_8C11C1BA76ED395 ON login_attempt (user_id)');
$this->addSql('CREATE INDEX IDX_LOGIN_ATTEMPT_CREATED_AT ON login_attempt (created_at DESC)');
$this->addSql("COMMENT ON COLUMN login_attempt.id IS '(DC2Type:login_attempt_id)'");
$this->addSql("COMMENT ON COLUMN login_attempt.user_id IS '(DC2Type:user_id)'");
$this->addSql("COMMENT ON COLUMN login_attempt.created_at IS '(DC2Type:datetime_immutable)'");
// -- ---------- TABLE: login_history ----------
$this->addSql(<<<SQL
CREATE TABLE login_history (
id UUID NOT NULL,
user_id UUID NOT NULL,
ip_address INET DEFAULT NULL,
created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL,
device_operating_system VARCHAR(255) DEFAULT NULL,
device_client VARCHAR(255) DEFAULT NULL,
device_device VARCHAR(255) DEFAULT NULL,
device_is_bot BOOLEAN DEFAULT false NOT NULL,
location_time_zone VARCHAR(255) DEFAULT NULL,
location_longitude DOUBLE PRECISION DEFAULT NULL,
location_latitude DOUBLE PRECISION DEFAULT NULL,
location_accuracy_radius INT DEFAULT NULL,
PRIMARY KEY(id)
)
SQL
);
$this->addSql('CREATE INDEX IDX_37976E36A76ED395 ON login_history (user_id)');
$this->addSql('CREATE INDEX IDX_LOGIN_HISTORY_CREATED_AT ON login_history (user_id, created_at DESC)');
$this->addSql('CREATE INDEX IDX_LOGIN_HISTORY_IP_ADDRESS ON login_history (ip_address)');
$this->addSql("COMMENT ON COLUMN login_history.id IS '(DC2Type:login_history_id)'");
$this->addSql("COMMENT ON COLUMN login_history.user_id IS '(DC2Type:user_id)'");
$this->addSql("COMMENT ON COLUMN login_history.created_at IS '(DC2Type:datetime_immutable)'");
// -- ---------- TABLE: refresh_tokens ----------
$this->addSql('CREATE SEQUENCE refresh_tokens_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql(<<<SQL
CREATE TABLE refresh_tokens (
id INT NOT NULL,
refresh_token VARCHAR(128) NOT NULL,
username VARCHAR(255) NOT NULL,
valid TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id)
)
SQL
);
$this->addSql('CREATE UNIQUE INDEX UNIQ_9BACE7E1C74F2195 ON refresh_tokens (refresh_token)');
// -- ---------- TABLE: source ----------
$this->addSql(<<<SQL
CREATE TABLE source (
id UUID NOT NULL,
url VARCHAR(255) NOT NULL,
name VARCHAR(255) NOT NULL,
display_name VARCHAR(255) DEFAULT NULL,
description VARCHAR(1024) DEFAULT NULL,
updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL,
bias VARCHAR(30) DEFAULT 'neutral' NOT NULL,
reliability VARCHAR(30) DEFAULT 'reliable' NOT NULL,
transparency VARCHAR(30) DEFAULT 'medium' NOT NULL,
PRIMARY KEY(id)
)
SQL
);
$this->addSql('CREATE UNIQUE INDEX UNQ_SOURCE_NAME ON source (LOWER(name))');
$this->addSql('CREATE UNIQUE INDEX UNQ_SOURCE_URL ON source (LOWER(url))');
$this->addSql("COMMENT ON COLUMN source.id IS '(DC2Type:source_id)'");
$this->addSql("COMMENT ON COLUMN source.updated_at IS '(DC2Type:datetime_immutable)'");
// -- ---------- TABLE: user ----------
$this->addSql(<<<SQL
CREATE TABLE "user" (
id UUID NOT NULL,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
password VARCHAR(512) NOT NULL,
is_locked BOOLEAN DEFAULT false NOT NULL,
is_confirmed BOOLEAN DEFAULT false NOT NULL,
created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL,
updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL,
roles JSONB NOT NULL,
PRIMARY KEY(id),
CONSTRAINT CHK_USER_ROLES_JSON CHECK (JSONB_TYPEOF(roles) = 'array')
)
SQL
);
$this->addSql(<<<SQL
CREATE UNIQUE INDEX UNQ_USER_EMAIL ON "user" (LOWER(email));
SQL
);
$this->addSql("COMMENT ON COLUMN \"user\".id IS '(DC2Type:user_id)'");
$this->addSql("COMMENT ON COLUMN \"user\".created_at IS '(DC2Type:datetime_immutable)'");
$this->addSql("COMMENT ON COLUMN \"user\".updated_at IS '(DC2Type:datetime_immutable)'");
// -- ---------- TABLE: verification_token ----------
$this->addSql(<<<SQL
CREATE TABLE verification_token (
id UUID NOT NULL,
user_id UUID NOT NULL,
purpose VARCHAR(255) NOT NULL,
created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL,
token VARCHAR(60) DEFAULT NULL,
PRIMARY KEY(id)
)
SQL
);
$this->addSql('CREATE INDEX IDX_C1CC006BA76ED395 ON verification_token (user_id)');
$this->addSql('CREATE INDEX IDX_VERIF_TOKEN_CREATED_AT ON verification_token (created_at DESC)');
$this->addSql('CREATE UNIQUE INDEX UNQ_VERIF_USER_PURPOSE_TOKEN ON verification_token (user_id, purpose) WHERE token IS NOT NULL');
$this->addSql("COMMENT ON COLUMN verification_token.id IS '(DC2Type:verification_token_id)'");
$this->addSql("COMMENT ON COLUMN verification_token.user_id IS '(DC2Type:user_id)'");
$this->addSql("COMMENT ON COLUMN verification_token.created_at IS '(DC2Type:datetime_immutable)'");
// -- ---------- FOREIGN KEY CONSTRAINTS ----------
$this->addSql('ALTER TABLE article ADD CONSTRAINT FK_23A0E66953C1C61 FOREIGN KEY (source_id) REFERENCES source (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE bookmark ADD CONSTRAINT FK_DA62921DA76ED395 FOREIGN KEY (user_id) REFERENCES "user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE bookmark_article ADD CONSTRAINT FK_6FE2655D92741D25 FOREIGN KEY (bookmark_id) REFERENCES bookmark (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE bookmark_article ADD CONSTRAINT FK_6FE2655D7294869C FOREIGN KEY (article_id) REFERENCES article (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE comment ADD CONSTRAINT FK_9474526CA76ED395 FOREIGN KEY (user_id) REFERENCES "user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE comment ADD CONSTRAINT FK_9474526C7294869C FOREIGN KEY (article_id) REFERENCES article (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE followed_source ADD CONSTRAINT FK_7A763A3EAC24F853 FOREIGN KEY (follower_id) REFERENCES "user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE followed_source ADD CONSTRAINT FK_7A763A3E953C1C61 FOREIGN KEY (source_id) REFERENCES source (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE login_attempt ADD CONSTRAINT FK_8C11C1BA76ED395 FOREIGN KEY (user_id) REFERENCES "user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE login_history ADD CONSTRAINT FK_37976E36A76ED395 FOREIGN KEY (user_id) REFERENCES "user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE verification_token ADD CONSTRAINT FK_C1CC006BA76ED395 FOREIGN KEY (user_id) REFERENCES "user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
throw new IrreversibleMigration('Sometimes in life you have to accept that you can\'t go back.');
}
}
@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Class Version20251024234318.
*
* @author bernard-ng <bernard@devscast.tech>
*/
final class Version20251024234318 extends AbstractMigration
{
public function getDescription(): string
{
return 'add token statistics to article';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE article ADD token_statistics JSONB DEFAULT NULL');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE article DROP token_statistics');
}
}
@@ -0,0 +1,5 @@
framework:
cache:
pools:
cache.dbal:
adapter: cache.adapter.filesystem
@@ -0,0 +1,2 @@
maker:
root_namespace: Basango
@@ -0,0 +1,338 @@
doctrine:
dbal:
connections:
default:
url: '%env(resolve:DATABASE_URL)%'
server_version: '16'
profiling_collect_backtrace: false
idle_connection_ttl: 172800
use_savepoints: true
result_cache: 'cache.dbal'
mapping_types:
# Array type mappings
'bool[]': 'bool[]'
_bool: 'bool[]'
'smallint[]': 'smallint[]'
_int2: 'smallint[]'
'integer[]': 'integer[]'
_int4: 'integer[]'
'bigint[]': 'bigint[]'
_int8: 'bigint[]'
'double precision[]': 'double precision[]'
_float8: 'double precision[]'
'real[]': 'real[]'
_float4: 'real[]'
'text[]': 'text[]'
_text: 'text[]'
# JSON type mappings
jsonb: jsonb
'jsonb[]': 'jsonb[]'
_jsonb: 'jsonb[]'
# Network type mappings
cidr: cidr
'cidr[]': 'cidr[]'
_cidr: 'cidr[]'
inet: inet
'inet[]': 'inet[]'
_inet: 'inet[]'
macaddr: macaddr
'macaddr[]': 'macaddr[]'
_macaddr: 'macaddr[]'
# Spatial type mappings
point: point
'point[]': 'point[]'
_point: 'point[]'
geometry: geometry
'geometry[]': 'geometry[]'
_geometry: 'geometry[]'
geography: geography
'geography[]': 'geography[]'
_geography: 'geography[]'
# Range type mappings
daterange: daterange
int4range: int4range
int8range: int8range
numrange: numrange
tsrange: tsrange
tstzrange: tstzrange
# Hierarchical type mappings
ltree: ltree
types:
# Shared Kernel
email: Basango\SharedKernel\Infrastructure\Persistence\Doctrine\DBAL\Types\EmailType
# Aggregator
article_id: Basango\Aggregator\Infrastructure\Persistence\Doctrine\DBAL\Types\ArticleIdType
source_id: Basango\Aggregator\Infrastructure\Persistence\Doctrine\DBAL\Types\SourceIdType
open_graph: Basango\Aggregator\Infrastructure\Persistence\Doctrine\DBAL\Types\OpenGraphType
token_statistics: Basango\Aggregator\Infrastructure\Persistence\Doctrine\DBAL\Types\TokenStatisticsType
# Identity and Access
user_id: Basango\IdentityAndAccess\Infrastructure\Persistence\Doctrine\DBAL\Types\UserIdType
login_attempt_id: Basango\IdentityAndAccess\Infrastructure\Persistence\Doctrine\DBAL\Types\LoginAttemptIdType
login_history_id: Basango\IdentityAndAccess\Infrastructure\Persistence\Doctrine\DBAL\Types\LoginHistoryIdType
verification_token_id: Basango\IdentityAndAccess\Infrastructure\Persistence\Doctrine\DBAL\Types\VerificationTokenIdType
# FeedManagement
bookmark_id: Basango\FeedManagement\Infrastructure\Persistence\Doctrine\DBAL\Types\BookmarkIdType
followed_source_id: Basango\FeedManagement\Infrastructure\Persistence\Doctrine\DBAL\Types\FollowedSourceIdType
comment_id: Basango\FeedManagement\Infrastructure\Persistence\Doctrine\DBAL\Types\CommentIdType
# PostgreSQL Specific Types
# Array types
'bool[]': MartinGeorgiev\Doctrine\DBAL\Types\BooleanArray
'smallint[]': MartinGeorgiev\Doctrine\DBAL\Types\SmallIntArray
'integer[]': MartinGeorgiev\Doctrine\DBAL\Types\IntegerArray
'bigint[]': MartinGeorgiev\Doctrine\DBAL\Types\BigIntArray
'double precision[]': MartinGeorgiev\Doctrine\DBAL\Types\DoublePrecisionArray
'real[]': MartinGeorgiev\Doctrine\DBAL\Types\RealArray
'text[]': MartinGeorgiev\Doctrine\DBAL\Types\TextArray
# JSON types
jsonb: MartinGeorgiev\Doctrine\DBAL\Types\Jsonb
'jsonb[]': MartinGeorgiev\Doctrine\DBAL\Types\JsonbArray
# Network types
cidr: MartinGeorgiev\Doctrine\DBAL\Types\Cidr
'cidr[]': MartinGeorgiev\Doctrine\DBAL\Types\CidrArray
inet: MartinGeorgiev\Doctrine\DBAL\Types\Inet
'inet[]': MartinGeorgiev\Doctrine\DBAL\Types\InetArray
macaddr: MartinGeorgiev\Doctrine\DBAL\Types\Macaddr
'macaddr[]': MartinGeorgiev\Doctrine\DBAL\Types\MacaddrArray
# Spatial types
point: MartinGeorgiev\Doctrine\DBAL\Types\Point
'point[]': MartinGeorgiev\Doctrine\DBAL\Types\PointArray
geometry: MartinGeorgiev\Doctrine\DBAL\Types\Geometry
'geometry[]': MartinGeorgiev\Doctrine\DBAL\Types\GeometryArray
geography: MartinGeorgiev\Doctrine\DBAL\Types\Geography
'geography[]': MartinGeorgiev\Doctrine\DBAL\Types\GeographyArray
# Range types
daterange: MartinGeorgiev\Doctrine\DBAL\Types\DateRange
int4range: MartinGeorgiev\Doctrine\DBAL\Types\Int4Range
int8range: MartinGeorgiev\Doctrine\DBAL\Types\Int8Range
numrange: MartinGeorgiev\Doctrine\DBAL\Types\NumRange
tsrange: MartinGeorgiev\Doctrine\DBAL\Types\TsRange
tstzrange: MartinGeorgiev\Doctrine\DBAL\Types\TstzRange
# Hierarchical types
ltree: MartinGeorgiev\Doctrine\DBAL\Types\Ltree
orm:
auto_generate_proxy_classes: true
enable_lazy_ghost_objects: true
enable_native_lazy_objects: true
entity_managers:
default:
validate_xml_mapping: false
report_fields_where_declared: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
dql:
string_functions:
# alternative implementation of ALL() and ANY() where subquery is not required, useful for arrays
ALL_OF: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\All
ANY_OF: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Any
# operators for working with array and json(b) data
GREATEST: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Greatest
LEAST: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Least
CONTAINS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Contains # @>
IS_CONTAINED_BY: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\IsContainedBy # <@
OVERLAPS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Overlaps # &&
RIGHT_EXISTS_ON_LEFT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\TheRightExistsOnTheLeft # ?
ALL_ON_RIGHT_EXIST_ON_LEFT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\AllOnTheRightExistOnTheLeft # ?&
ANY_ON_RIGHT_EXISTS_ON_LEFT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\AnyOnTheRightExistsOnTheLeft # ?|
RETURNS_VALUE_FOR_JSON_VALUE: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ReturnsValueForJsonValue # @?
DELETE_AT_PATH: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\DeleteAtPath # #-
# array and string specific functions
IN_ARRAY: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\InArray
ANY_VALUE: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\AnyValue
ARRAY: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Arr
ARRAY_APPEND: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayAppend
ARRAY_CARDINALITY: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayCardinality
ARRAY_CAT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayCat
ARRAY_DIMENSIONS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayDimensions
ARRAY_LENGTH: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayLength
ARRAY_NUMBER_OF_DIMENSIONS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayNumberOfDimensions
ARRAY_POSITION: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayPosition
ARRAY_POSITIONS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayPositions
ARRAY_PREPEND: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayPrepend
ARRAY_REMOVE: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayRemove
ARRAY_REPLACE: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayReplace
ARRAY_SHUFFLE: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayShuffle
ARRAY_TO_JSON: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayToJson
ARRAY_TO_STRING: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayToString
SPLIT_PART: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\SplitPart
STARTS_WITH: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\StartsWith
STRING_TO_ARRAY: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\StringToArray
UNNEST: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Unnest
# json specific functions
JSON_ARRAY_LENGTH: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonArrayLength
JSON_BUILD_OBJECT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonBuildObject
JSON_EACH: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEach
JSON_EACH_TEXT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonEachText
JSON_EXISTS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonExists
JSON_GET_FIELD: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonGetField
JSON_GET_FIELD_AS_INTEGER: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonGetFieldAsInteger
JSON_GET_FIELD_AS_TEXT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonGetFieldAsText
JSON_GET_OBJECT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonGetObject
JSON_GET_OBJECT_AS_TEXT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonGetObjectAsText
JSON_OBJECT_KEYS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonObjectKeys
JSON_QUERY: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonQuery
JSON_SCALAR: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonScalar
JSON_SERIALIZE: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonSerialize
JSON_STRIP_NULLS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonStripNulls
JSON_TYPEOF: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonTypeof
JSON_VALUE: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonValue
TO_JSON: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ToJson
ROW_TO_JSON: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\RowToJson
# jsonb specific functions
JSONB_ARRAY_ELEMENTS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbArrayElements
JSONB_ARRAY_ELEMENTS_TEXT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbArrayElementsText
JSONB_ARRAY_LENGTH: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbArrayLength
JSONB_BUILD_OBJECT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbBuildObject
JSONB_EACH: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbEach
JSONB_EACH_TEXT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbEachText
JSONB_EXISTS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbExists
JSONB_INSERT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbInsert
JSONB_OBJECT_KEYS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbObjectKeys
JSONB_PATH_EXISTS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbPathExists
JSONB_PATH_MATCH: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbPathMatch
JSONB_PATH_QUERY: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbPathQuery
JSONB_PATH_QUERY_ARRAY: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbPathQueryArray
JSONB_PATH_QUERY_FIRST: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbPathQueryFirst
JSONB_PRETTY: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbPretty
JSONB_SET: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbSet
JSONB_SET_LAX: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbSetLax
JSONB_STRIP_NULLS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbStripNulls
TO_JSONB: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ToJsonb
# text search specific
TO_TSQUERY: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ToTsquery
TO_TSVECTOR: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ToTsvector
TSMATCH: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Tsmatch
# date specific functions
DATE_ADD: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\DateAdd
DATE_BIN: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\DateBin
DATE_EXTRACT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\DateExtract
DATE_OVERLAPS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\DateOverlaps
DATE_SUBTRACT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\DateSubtract
# range functions
DATERANGE: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Daterange
INT4RANGE: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Int4range
INT8RANGE: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Int8range
NUMRANGE: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Numrange
TSRANGE: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Tsrange
TSTZRANGE: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Tstzrange
# Arithmetic functions
CBRT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Cbrt
CEIL: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Ceil
DEGREES: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Degrees
EXP: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exp
FLOOR: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Floor
LN: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Ln
LOG: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Log
PI: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Pi
POWER: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Power
RADIANS: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Radians
RANDOM: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Random
ROUND: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Round
SIGN: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Sign
TRUNC: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Trunc
WIDTH_BUCKET: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\WidthBucket
# other operators
CAST: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Cast
ILIKE: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Ilike
SIMILAR_TO: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\SimilarTo
NOT_SIMILAR_TO: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\NotSimilarTo
UNACCENT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Unaccent
REGEXP: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Regexp
IREGEXP: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\IRegexp
NOT_REGEXP: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\NotRegexp
NOT_IREGEXP: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\NotIRegexp
REGEXP_COUNT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\RegexpCount
REGEXP_INSTR: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\RegexpInstr
REGEXP_LIKE: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\RegexpLike
REGEXP_MATCH: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\RegexpMatch
REGEXP_REPLACE: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\RegexpReplace
REGEXP_SUBSTR: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\RegexpSubstr
ROW: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Row
STRCONCAT: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\StrConcat
DISTANCE: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Distance
# aggregation functions
ARRAY_AGG: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ArrayAgg
JSON_AGG: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonAgg
JSON_OBJECT_AGG: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonObjectAgg
JSONB_AGG: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbAgg
JSONB_OBJECT_AGG: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\JsonbObjectAgg
STRING_AGG: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\StringAgg
XML_AGG: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\XmlAgg
# data type formatting functions
TO_CHAR: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ToChar
TO_DATE: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ToDate
TO_NUMBER: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ToNumber
TO_TIMESTAMP: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\ToTimestamp
mappings:
Aggregator:
is_bundle: false
type: xml
dir: '%kernel.project_dir%/config/doctrine/Aggregator'
prefix: 'Basango\Aggregator\Domain\Model'
IdentityAndAccess:
is_bundle: false
type: xml
dir: '%kernel.project_dir%/config/doctrine/IdentityAndAccess'
prefix: 'Basango\IdentityAndAccess\Domain\Model'
FeedManagement:
is_bundle: false
type: xml
dir: '%kernel.project_dir%/config/doctrine/FeedManagement'
prefix: 'Basango\FeedManagement\Domain\Model'
SharedKernel:
is_bundle: false
type: xml
dir: '%kernel.project_dir%/config/doctrine/SharedKernel'
prefix: 'Basango\SharedKernel\Domain\Model'
controller_resolver:
auto_mapping: false
when@test:
doctrine:
dbal:
# "TEST_TOKEN" is typically set by ParaTest
dbname_suffix: '_test%env(default::TEST_TOKEN)%'
when@prod:
doctrine:
orm:
auto_generate_proxy_classes: false
proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies'
query_cache_driver:
type: pool
pool: doctrine.system_cache_pool
result_cache_driver:
type: pool
pool: doctrine.result_cache_pool
framework:
cache:
pools:
doctrine.result_cache_pool:
adapter: cache.app
doctrine.system_cache_pool:
adapter: cache.system
@@ -0,0 +1,6 @@
doctrine_migrations:
migrations_paths:
# namespace is arbitrary but should be different from Basango\Migrations
# as migrations classes should NOT be autoloaded
'DoctrineMigrations': '%kernel.project_dir%/config/migrations'
enable_profiler: false
@@ -0,0 +1,25 @@
# see https://symfony.com/doc/current/reference/configuration/framework.html
framework:
secret: '%env(APP_SECRET)%'
#csrf_protection: true
http_method_override: false
handle_all_throwables: true
# Enables session support. Note that the session will ONLY be started if you read or write from it.
# Remove or comment this section to explicitly disable session support.
session:
handler_id: null
cookie_secure: auto
cookie_samesite: lax
storage_factory_id: session.storage.factory.native
#esi: true
#fragments: true
php_errors:
log: true
when@test:
framework:
test: true
session:
storage_factory_id: session.storage.factory.mock_file
@@ -0,0 +1,4 @@
gesdinet_jwt_refresh_token:
refresh_token_class: Basango\IdentityAndAccess\Domain\Model\Entity\RefreshToken
ttl: 2592000 # 1 month
ttl_update: true
@@ -0,0 +1,5 @@
lexik_jwt_authentication:
secret_key: '%env(resolve:JWT_SECRET_KEY)%'
public_key: '%env(resolve:JWT_PUBLIC_KEY)%'
pass_phrase: '%env(JWT_PASSPHRASE)%'
token_ttl: '%env(resolve:JWT_TTL)%'
@@ -0,0 +1,3 @@
framework:
mailer:
dsn: '%env(MAILER_DSN)%'
@@ -0,0 +1,39 @@
framework:
messenger:
# Uncomment this (and the failed transport below) to send failed messages to this transport for later handling.
failure_transport: failed
transports:
# https://symfony.com/doc/current/messenger.html#transport-configuration
async:
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
retry_strategy:
max_retries: 3
delay: 1000
multiplier: 2
max_delay: 0
options:
auto_setup: true
failed:
dsn: 'doctrine://default?queue_name=failed'
options:
auto_setup: true
sync: 'sync://'
routing:
Basango\SharedKernel\Application\Messaging\AsyncMessage: async
Symfony\Component\Mailer\Messenger\SendEmailMessage: sync
default_bus: command.bus
buses:
command.bus: ~
query.bus: ~
message.bus: ~
when@test:
framework:
messenger:
transports:
# replace with your transport name here (e.g., my_transport: 'in-memory://')
# For more Messenger testing tools, see https://github.com/zenstruck/messenger-test
async: 'in-memory://'
@@ -0,0 +1,72 @@
monolog:
channels:
- deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists
when@dev:
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: ["!app"]
app:
type: stream
path: "%kernel.logs_dir%/app.%kernel.environment%.log"
level: debug
channels: ["app"]
console:
type: console
level: debug
process_psr_3_messages: false
channels: ["app"]
when@test:
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
excluded_http_codes: [404, 405]
channels: ["!event"]
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
when@prod:
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
excluded_http_codes: [404, 405]
buffer_size: 50 # How many messages should be saved? Prevent memory leaks
telegram:
type: telegram
level: critical
channels: [ "!event" ]
token: "%env(DEVY_TOKEN)%"
channel: "%env(DEVY_CHANNEL)%"
topic: "%env(int:DEVY_TOPIC)%"
parse_mode: "MarkdownV2"
disable_webpage_preview: true
disable_notification: false
split_long_messages: false
formatter: Basango\SharedKernel\Infrastructure\Framework\Symfony\Logging\TelegramFormatter
nested:
type: rotating_file
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: error
max_files: 10
console:
type: console
level: info
process_psr_3_messages: false
channels: ["!event", "!doctrine"]
deprecation:
type: stream
channels: [deprecation]
path: "%kernel.logs_dir%/deprecation.log"
@@ -0,0 +1,12 @@
framework:
router:
utf8: true
# Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
#default_uri: http://localhost
when@prod:
framework:
router:
strict_requirements: null
@@ -0,0 +1,62 @@
security:
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
password_hashers:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
providers:
app_user_provider:
id: Basango\IdentityAndAccess\Infrastructure\Framework\Symfony\Security\SecurityUserProvider
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security:
login:
pattern: ^/api/login
stateless: true
json_login:
check_path: /api/login_check
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure
user_checker: Basango\IdentityAndAccess\Infrastructure\Framework\Symfony\Security\UserChecker
api:
pattern: ^/api
stateless: true
entry_point: jwt
jwt: ~
refresh_jwt:
check_path: /api/token/refresh
logout:
path: api_token_invalidate
user_checker: Basango\IdentityAndAccess\Infrastructure\Framework\Symfony\Security\UserChecker
main:
lazy: true
provider: app_user_provider
user_checker: Basango\IdentityAndAccess\Infrastructure\Framework\Symfony\Security\UserChecker
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
- { path: ^/api/register, roles: PUBLIC_ACCESS }
- { path: ^/api/login, roles: PUBLIC_ACCESS }
- { path: ^/api/token/refresh, roles: PUBLIC_ACCESS }
- { path: ^/api/password/(request|reset), roles: PUBLIC_ACCESS }
- { path: ^/api/account/(unlock|confirm), roles: PUBLIC_ACCESS }
- { path: ^/api/aggregator/articles, roles: PUBLIC_ACCESS }
- { path: ^/api, roles: IS_AUTHENTICATED_FULLY }
when@test:
security:
password_hashers:
# By default, password hashers are resource intensive and take time. This is
# important to generate secure password hashes. In tests however, secure hashes
# are not important, waste resources and increase test times. The following
# reduces the work factor to the lowest possible values.
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
algorithm: auto
cost: 4 # Lowest possible value for bcrypt
time_cost: 3 # Lowest possible value for argon
memory_cost: 10 # Lowest possible value for argon
@@ -0,0 +1,24 @@
when@prod:
sentry:
dsn: "%env(SENTRY_DSN)%"
register_error_listener: false
register_error_handler: false
options:
traces_sample_rate: 0.1
ignore_exceptions:
- 'Symfony\Component\ErrorHandler\Error\FatalError'
- 'Symfony\Component\Debug\Exception\FatalErrorException'
monolog:
handlers:
sentry_fingers_crossed:
type: fingers_crossed
action_level: error
handler: sentry
excluded_http_codes: [404, 405]
buffer_size: 50
sentry:
type: sentry
level: !php/const Monolog\Logger::ERROR
hub_id: Sentry\State\HubInterface
fill_extra_context: true
process_psr_3_messages: false
@@ -0,0 +1,7 @@
framework:
default_locale: fr
translator:
default_path: '%kernel.project_dir%/translations'
fallbacks:
- en
providers:
+16
View File
@@ -0,0 +1,16 @@
twig:
file_name_pattern: '*.twig'
date:
format: 'd M Y'
interval_format: '%d days'
timezone: null
number_format:
decimals: 2
decimal_point: ','
thousands_separator: '.'
globals:
'application': '@Basango\SharedKernel\Domain\Application'
when@test:
twig:
strict_variables: true
@@ -0,0 +1,11 @@
framework:
validation:
# Enables validator auto-mapping support.
# For instance, basic validation constraints will be inferred from Doctrine's metadata.
#auto_mapping:
# App\Entity\: []
when@test:
framework:
validation:
not_compromised_password: false
@@ -0,0 +1,11 @@
when@dev:
web_profiler:
toolbar: true
framework:
profiler:
collect_serializer_data: true
when@test:
framework:
profiler: { collect: false }
+5
View File
@@ -0,0 +1,5 @@
<?php
if (file_exists(dirname(__DIR__) . '/var/cache/prod/App_KernelProdContainer.preload.php')) {
require dirname(__DIR__) . '/var/cache/prod/App_KernelProdContainer.preload.php';
}
+27
View File
@@ -0,0 +1,27 @@
controllers:
resource: ../src/
type: attribute
schemes:
- HTTP
- HTTPS
identity_and_access_login_check:
path: /api/login_check
methods: [POST]
schemes:
- HTTP
- HTTPS
identity_and_access_refresh_token:
path: /api/token/refresh
methods: [POST]
schemes:
- HTTP
- HTTPS
identity_and_access_token_invalidate:
path: /api/token/invalidate
methods: [POST]
schemes:
- HTTP
- HTTPS
@@ -0,0 +1,4 @@
when@dev:
_errors:
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
prefix: /_error
@@ -0,0 +1,2 @@
gesdinet_jwt_refresh_token:
path: /api/token/refresh
@@ -0,0 +1,3 @@
_security_logout:
resource: security.route_loader.logout
type: service
@@ -0,0 +1,8 @@
when@dev:
web_profiler_wdt:
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
prefix: /_wdt
web_profiler_profiler:
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
prefix: /_profiler
+55
View File
@@ -0,0 +1,55 @@
# This file is the entry point to configure your own process.
# Files in the packages/ subdirectory configure your dependencies.
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
parameters:
basango_notification_email: '%env(BASANGO_NOTIFICATION_EMAIL)%'
services:
# default configuration for process in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your process.
autoconfigure: true # Automatically registers your process as commands, event subscribers, etc.
bind:
$projectDir: '%kernel.project_dir%'
$crawlingNotificationEmail: '%basango_notification_email%'
_instanceof:
Basango\SharedKernel\Application\Messaging\CommandHandler:
tags:
- { name: messenger.message_handler, bus: 'command.bus' }
Basango\SharedKernel\Application\Messaging\QueryHandler:
tags:
- { name: messenger.message_handler, bus: 'query.bus' }
Basango\SharedKernel\Application\Messaging\MessageHandler:
tags:
- { name: messenger.message_handler, bus: 'message.bus' }
Basango\SharedKernel\Domain\EventListener\EventListener:
tags:
- { name: kernel.event_listener }
Symfony\Bridge\Monolog\Processor\ConsoleCommandProcessor:
tags:
- { name: monolog.processor, channel: 'app' }
Symfony\Bridge\Monolog\Processor\RouteProcessor:
tags:
- { name: monolog.processor, channel: 'app' }
Symfony\Bridge\Monolog\Processor\TokenProcessor:
tags:
- { name: monolog.processor, channel: 'app' }
Basango\SharedKernel\Infrastructure\Framework\Symfony\Logging\TelegramFormatter:
tags:
- { name: monolog.formatter }
# makes classes in src/ available to be used as process
# this creates a service per class whose id is the fully-qualified class name
Basango\:
resource: '../src/'
exclude:
- '../src/SharedKernel/Infrastructure/Framework/Symfony/Kernel.php'
- '../src/**/Domain/Model/Entity/*'
- '../src/**/Domain/Model/ValueObject/*'
# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones
@@ -0,0 +1,7 @@
services:
_defaults:
autowire: true
autoconfigure: true
Tests\Behat\:
resource: '../tests/Behat/*'
+33
View File
@@ -0,0 +1,33 @@
deptrac:
paths:
- ./src
exclude_files:
- '#.*test.*#'
layers:
- name: Presentation
collectors:
- type: directory
value: src/.*/Presentation/.*
- name: Infrastructure
collectors:
- type: directory
value: src/.*/Infrastructure/.*
- name: Application
collectors:
- type: directory
value: src/.*/Application/.*
- name: Domain
collectors:
- type: directory
value: src/.*/Domain/.*
ruleset:
Presentation:
- Domain
- Application
- Infrastructure
Infrastructure:
- Application
- Domain
Application:
- Domain
Domain: ~
+30
View File
@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
use PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer;
use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer;
use PhpCsFixer\Fixer\Operator\ConcatSpaceFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;
return ECSConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withRules([
NoUnusedImportsFixer::class,
])
->withConfiguredRule(MethodArgumentSpaceFixer::class, [
'on_multiline' => 'ensure_fully_multiline',
'attribute_placement' => 'same_line'
])
->withSkip([
ConcatSpaceFixer::class
])
->withPreparedSets(
psr12: true,
common: true,
cleanCode: true,
);
@@ -0,0 +1,10 @@
--- a/vendor/symfony/monolog-bundle/DependencyInjection/Configuration.php 2023-11-06 11:08:12.000000000 +0200
+++ b/vendor/symfony/monolog-bundle/DependencyInjection/Configuration.php 2024-08-16 05:05:49.286417317 +0200
@@ -595,6 +595,7 @@
->booleanNode('disable_notification')->defaultNull()->end() // telegram
->booleanNode('split_long_messages')->defaultFalse()->end() // telegram
->booleanNode('delay_between_messages')->defaultFalse()->end() // telegram
+ ->integerNode('topic')->defaultNull()->end() // telegram
->integerNode('factor')->defaultValue(1)->min(1)->end() // sampling
->arrayNode('tags') // loggly
->beforeNormalization()
@@ -0,0 +1,9 @@
--- a/vendor/symfony/monolog-bundle/DependencyInjection/MonologExtension.php 2023-11-06 11:08:12.000000000 +0200
+++ b/vendor/symfony/monolog-bundle/DependencyInjection/MonologExtension.php 2024-08-16 05:05:49.266417128 +0200
@@ -351,6 +351,7 @@
$handler['disable_notification'],
$handler['split_long_messages'],
$handler['delay_between_messages'],
+ $handler['topic']
]);
break;
+19
View File
@@ -0,0 +1,19 @@
includes:
- vendor/phpstan/phpstan-symfony/extension.neon
- vendor/phpstan/phpstan-symfony/rules.neon
# - vendor/phpstan/phpstan-doctrine/extension.neon
# - vendor/phpstan/phpstan-doctrine/rules.neon
parameters:
level: 8
paths:
- bin/
- config/
- public/
- src/
- tests/
ignoreErrors:
- identifier: missingType.iterableValue
# doctrine:
# objectManagerLoader: tests/object-manager.php
# allowNullablePropertyForRequiredField: true

Some files were not shown because too many files have changed in this diff Show More