Initial commit

This commit is contained in:
2025-10-05 13:55:28 +02:00
commit 68d521677a
767 changed files with 46947 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
# Unified repository-wide Git attributes
# Mark vendored/non-source directories so GitHub Linguist doesnt skew language stats
projects/backend/public/** linguist-vendored
projects/backend/assets/** linguist-vendored
projects/crawler/notebooks/** linguist-vendored
# Do not count certain generated or data-heavy formats in language stats
*.css linguist-detectable=false
*.scss linguist-detectable=false
*.ipynb linguist-detectable=false
# Enforce LF newlines for text files commonly used in this monorepo
*.css text eol=lf
*.html text eol=lf
*.js text eol=lf
*.json text eol=lf
*.md text eol=lf
*.py text eol=lf
*.scss text eol=lf
*.svg text eol=lf
*.txt text eol=lf
*.xml text eol=lf
*.xml.* text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
*.php text eol=lf
*.twig text eol=lf
*.sh text eol=lf
*.ts text eol=lf
*.tsx text eol=lf
*.py text eol=lf
# Binary formats
*.map binary
*.mmdb filter=lfs diff=lfs merge=lfs -text
*.sqlite filter=lfs diff=lfs merge=lfs -text
+51
View File
@@ -0,0 +1,51 @@
name: audit
on:
workflow_call:
push:
branches-ignore:
- main
paths:
- "projects/backend/**"
- ".github/workflows/backend/**"
pull_request:
branches-ignore:
- main
paths:
- "projects/backend/**"
- ".github/workflows/backend/**"
defaults:
run:
working-directory: projects/backend
jobs:
audit:
name: Security Audit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
tools: composer:v2
- name: Setup cache
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
- name: Cache dependencies installed with composer
uses: actions/cache@v4
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php8.3-composer-${{ hashFiles('projects/backend/composer.lock') }}
restore-keys: |
php8.3-composer-latest-
- name: Update composer
run: composer self-update
- name: Install dependencies with composer
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
- name: Security Audit with composer
run: composer audit
continue-on-error: true
+40
View File
@@ -0,0 +1,40 @@
name: deploy
on:
push:
branches:
- main
paths:
- "projects/backend/**"
- ".github/workflows/backend/**"
jobs:
audit:
uses: ./.github/workflows/backend/audit.yaml
quality:
uses: ./.github/workflows/backend/quality.yaml
tests:
uses: ./.github/workflows/backend/tests.yaml
needs: [audit, quality]
deploy:
name: Deploy
needs: [tests]
runs-on: ubuntu-latest
steps:
- name: execute ssh command
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd /var/www/html/news.devscast.tech
git pull origin main --rebase
make deploy
curl -X POST "https://api.telegram.org/bot${{ secrets.DEVY_TOKEN }}/sendMessage" \
-H "Content-Type: application/json" \
-d '{
"chat_id": "${{ secrets.DEVY_CHAT_ID }}",
"text": "news.devscast.tech : `'"$(git rev-parse --short HEAD)"'` has been deployed! 🎉",
"parse_mode": "Markdown"
}'
+51
View File
@@ -0,0 +1,51 @@
name: quality
on:
workflow_call:
push:
branches-ignore:
- main
paths:
- "projects/backend/**"
- ".github/workflows/backend/**"
pull_request:
branches-ignore:
- main
paths:
- "projects/backend/**"
- ".github/workflows/backend/**"
defaults:
run:
working-directory: projects/backend
jobs:
quality:
name: Quality
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
tools: composer:v2
- name: Setup cache
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
- name: Cache dependencies installed with composer
uses: actions/cache@v4
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php8.3-composer-${{ hashFiles('projects/backend/composer.lock') }}
restore-keys: |
php8.3-composer-latest-
- name: Update composer
run: composer self-update
- name: Install dependencies with composer
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
- name: Run code quality analysis
run: composer app:cs
+67
View File
@@ -0,0 +1,67 @@
name: tests
on:
workflow_call:
push:
branches-ignore:
- main
paths:
- "projects/backend/**"
- ".github/workflows/backend/**"
pull_request:
branches-ignore:
- main
paths:
- "projects/backend/**"
- ".github/workflows/backend/**"
jobs:
functional:
name: Functional Tests
runs-on: ubuntu-latest
# services:
# mysql:
# image: mariadb:10.11.11
# env:
# MYSQL_ALLOW_EMPTY_PASSWORD: false
# MYSQL_ROOT_PASSWORD: root
# MYSQL_DATABASE: root
# ports:
# - 3306/tcp
# options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
php: [8.4]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2
- name: Setup cache
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
- name: Cache dependencies installed with composer
uses: actions/cache@v4
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php }}-composer-latest-
- name: Update composer
run: composer self-update
- name: Install dependencies with composer
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
# - name: Setup mysql
# run: sudo systemctl start mysql
- name: Run functional tests
run: composer app:test
env:
APP_ENV: test
# DATABASE_URL: mysql://root:root@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/app_test
+40
View File
@@ -0,0 +1,40 @@
name: audit
on:
push:
branches:
- main
paths:
- "projects/crawler/**"
- ".github/workflows/crawler/**"
pull_request:
paths:
- "projects/crawler/**"
- ".github/workflows/crawler/**"
jobs:
bandit:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Cache uv dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/uv
.venv
key: ${{ runner.os }}-uv-${{ hashFiles('**/uv.lock') }}
restore-keys: |
${{ runner.os }}-uv-
- name: Sync dependencies (with dev tools)
run: uv sync --dev
- name: Run Bandit (security linter)
run: uv run bandit -r . -c pyproject.toml || true
+49
View File
@@ -0,0 +1,49 @@
name: quality
on:
push:
branches:
- main
paths:
- "projects/crawler/**"
- ".github/workflows/crawler/**"
pull_request:
paths:
- "projects/crawler/**"
- ".github/workflows/crawler/**"
defaults:
run:
working-directory: projects/crawler
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Cache uv dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/uv
projects/crawler/.venv
key: ${{ runner.os }}-uv-${{ hashFiles('projects/crawler/uv.lock') }}
restore-keys: |
${{ runner.os }}-uv-
- name: Sync dependencies (with dev tools)
run: uv sync --dev
- name: Run Ruff (lint + format checks)
run: |
uv run ruff check .
uv run ruff format --check .
- name: Run Pyright (type checks)
run: uv run pyright
+44
View File
@@ -0,0 +1,44 @@
name: tests
on:
push:
branches:
- main
paths:
- "projects/crawler/**"
- ".github/workflows/crawler/**"
pull_request:
paths:
- "projects/crawler/**"
- ".github/workflows/crawler/**"
defaults:
run:
working-directory: projects/crawler
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Cache uv dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/uv
projects/crawler/.venv
key: ${{ runner.os }}-uv-${{ hashFiles('projects/crawler/uv.lock') }}
restore-keys: |
${{ runner.os }}-uv-
- name: Sync dependencies (with dev tools)
run: uv sync --dev
- name: Run Pytest
run: uv run pytest
+51
View File
@@ -0,0 +1,51 @@
name: quality
on:
push:
paths:
- "projects/mobile/**"
- ".github/workflows/mobile/**"
pull_request:
paths:
- "projects/mobile/**"
- ".github/workflows/mobile/**"
defaults:
run:
working-directory: projects/mobile
jobs:
quality:
name: Quality
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Cache Bun Dependencies
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('projects/mobile/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Install Dependencies
run: bun install --frozen-lockfile
- name: Run Code Quality Checks
run: |
bun run check-types
bun run check
bun run lint:check
+94
View File
@@ -0,0 +1,94 @@
.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 ###
.idea/
.vscode/
.ipynb_checkpoints/
*.pyc
.env.local
.env.*.local
var/
var/volumes/
var/volums/
.DS_Store
# Python-generated files
__pycache__/
*.py[oc]
build/
dist/
wheels/
*.egg-info
# Virtual environments
.venv
data/
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
# dependencies
node_modules/
# Expo
.expo/
dist/
web-build/
expo-env.d.ts
# Native
*.orig.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
# Metro
.metro-health-check*
# debug
npm-debug.*
yarn-debug.*
yarn-error.*
# macOS
.idea
.DS_Store
*.pem
# local env files
.env*.local
# typescript
*.tsbuildinfo
app-example
.env.local
+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
+33
View File
@@ -0,0 +1,33 @@
# Basango : Towards a scalable and intelligent system for Congolese News curation
| Scope | Link |
|-------------------|-------------------------------------------|
| Crawler | [README.md](./projects/crawler/README.md) |
| Backend | [README.md](./projects/backend/README.md) |
| Mobile | [README.md](./projects/mobile/README.md) |
---
### Introduction
The **"Basango"** is a structured and scalable system 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.
This system 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/ |
### Acknowledgment:
The compilation and curation of the "Basango" were conducted by Bernard Ngandu 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.
+123
View File
@@ -0,0 +1,123 @@
services:
mariadb:
image: mariadb:10.11.11
environment:
MARIADB_USER: root
MARIADB_ROOT_PASSWORD: root
MARIADB_DATABASE: app
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: 'no'
volumes:
- ./var/volumes/mariadb:/var/lib/mysql:rw
- ./var/volumes/backend-var:/var/www/var
networks:
- basango_network
postgres:
image: pgvector/pgvector:pg16
environment:
POSTGRES_DB: app
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
volumes:
- ./var/volumes/postgres:/var/lib/postgresql/data
networks:
- basango_network
redis:
image: redis:7-alpine
command: ["redis-server", "--appendonly", "yes"]
ports:
- "6379:6379"
volumes:
- ./var/volumes/redis:/data
networks:
- basango_network
redis-commander:
image: rediscommander/redis-commander:latest
environment:
- REDIS_HOSTS=local:redis:6379
ports:
- "8081:8081"
depends_on:
- redis
networks:
- basango_network
nginx:
build: ./docker/nginx
ports:
- "8000:80"
volumes:
- ./projects/backend/public:/var/www/public:delegated
depends_on:
- php
networks:
- basango_network
php:
user: '${USER_ID:-1000}:${GROUP_ID:-1000}'
build: ./docker/php
volumes:
- ./projects/backend:/var/www:delegated
depends_on:
- mariadb
- postgres
- redis
networks:
- basango_network
adminer:
image: adminer:latest
depends_on:
- mariadb
environment:
APP_ENV: dev
ADMINER_DESIGN: pepa-linha
ADMINER_DEFAULT_SERVER: mariadb
ports:
- "8082:8080"
networks:
- basango_network
mailer:
image: axllent/mailpit
ports:
- "1025:1025"
- "8025:8025"
environment:
MP_SMTP_AUTH_ACCEPT_ANY: 1
MP_SMTP_AUTH_ALLOW_INSECURE: 1
networks:
- basango_network
networks:
basango_network:
volumes:
database_data:
driver: local
driver_opts:
type: none
o: bind
device: ./var/volumes/mariadb
backend_var:
driver: local
driver_opts:
type: none
o: bind
device: ./var/volumes/backend-var
redis_data:
driver: local
driver_opts:
type: none
o: bind
device: ./var/volumes/redis
postgres_data:
driver: local
driver_opts:
type: none
o: bind
device: ./var/volumes/postgres
+4
View File
@@ -0,0 +1,4 @@
FROM nginx:1.27.1-alpine
COPY default.conf /etc/nginx/conf.d/default.conf
+37
View File
@@ -0,0 +1,37 @@
server {
listen 80;
server_name localhost;
root /var/www/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
location / {
root /var/www/;
try_files /public/$uri /public/$uri /assets/$uri /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 421 422 423 424 425 426 428 429 431 451 500 501 502 503 504 505 506 507 508 510 511 /error.html;
location ~ \.php$ {
fastcgi_pass php:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
+19
View File
@@ -0,0 +1,19 @@
FROM php:8.4-fpm-alpine
# Install dependencies
RUN apk --no-cache add curl git wget bash dpkg
# Add PHP extensions
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions
RUN install-php-extensions opcache iconv soap
RUN install-php-extensions zip intl fileinfo
RUN install-php-extensions pdo redis mysqli pdo_mysql
RUN install-php-extensions gd
# Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer
WORKDIR /var/www
+70
View File
@@ -0,0 +1,70 @@
# 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 ###
CRAWLING_NOTIFICATION_EMAIL=
TIMEZONE=Africa/Lubumbashi
GOOGLE_CUSTOM_SEARCH_API_KEY=
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@database:3306/app?serverVersion=Mariadb-10.11.11&charset=utf8mb4"
#DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1: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='App\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: DRC News Corpus
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/drc-news-corpus'
repository: >-
https://www.huggingface.c0/datasets/bernard-ng/drc-news-corpus
abstract: >-
The "DRC News Corpus" 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/drc-news-corpus/actions/workflows/deploy.yaml/badge.svg)
![Coding Standard](https://github.com/bernard-ng/drc-news-corpus/actions/workflows/quality.yaml/badge.svg)
![Tests](https://github.com/bernard-ng/drc-news-corpus/actions/workflows/tests.yaml/badge.svg)
![Security](https://github.com/bernard-ng/drc-news-corpus/actions/workflows/audit.yaml/badge.svg)
| Scope | Link |
|-------------------|------------------------------------------------------------|
| core and backend | https://github.com/bernard-ng/drc-news-corpus |
| ML models | https://github.com/bernard-ng/drc-news-ml |
| Mobile App | https://github.com/bernard-ng/drc-news-app |
| Dataset (partial) | https://huggingface.co/datasets/bernard-ng/drc-news-corpus |
---
## DRC News Corpus : Towards a scalable and intelligent system for Congolese News curation
### Introduction
The **"DRC News Corpus"** 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/drc-news-corpus.git && cd drc-news-corpus
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 "DRC News Corpus" 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.
+9
View File
@@ -0,0 +1,9 @@
{
"version": "1",
"name": "drc-news-corpus",
"type": "collection",
"ignore": [
"node_modules",
".git"
]
}
@@ -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: App\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 App\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);
};
+42
View File
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
SOURCES=(
"africanewsrdc.net"
"angazainstitute.ac.cd"
"b-onetv.cd"
"bukavufm.com"
"changement7.net"
"congoactu.net"
"congoindependant.com"
"congoquotidien.com"
"cumulard.cd"
"environews-rdc.net"
"freemediardc.info"
"geopolismagazine.org"
"habarirdc.net"
"infordc.com"
"kilalopress.net"
"laprosperiteonline.net"
"laprunellerdc.cd"
"lesmedias.net"
"lesvolcansnews.net"
"netic-news.net"
"objectif-infos.cd"
"scooprdc.net"
"journaldekinshasa.com"
"lepotentiel.cd"
"acturdc.com"
"matininfos.net"
)
BASE_CMD="/usr/bin/php /var/www/html/news.devscast.tech/bin/console app:crawl"
LOG_DIR="/var/www/html/news.devscast.tech/var"
mkdir -p "$LOG_DIR"
rm -f "${LOG_DIR}"/*.log
for SOURCE in "${SOURCES[@]}"; do
LOG_FILE="${LOG_DIR}/crawling-${SOURCE}.log"
nohup $BASE_CMD "$SOURCE" -vvv > "$LOG_FILE" 2>&1 &
done
echo "All crawlers started in the background."
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
SOURCES=("7sur7.cd" "actualite.cd" "radiookapi.net" "mediacongo.net" "newscd.net")
BASE_CMD="/usr/bin/php /var/www/html/news.devscast.tech/bin/console app:open-graph"
LOG_DIR="/var/www/html/news.devscast.tech/var"
mkdir -p "$LOG_DIR"
rm -f "${LOG_DIR}"/*.log
for SOURCE in "${SOURCES[@]}"; do
LOG_FILE="${LOG_DIR}/${SOURCE}.log"
nohup $BASE_CMD "$SOURCE" -vvv --no-interaction > "$LOG_FILE" 2>&1 &
done
echo "All open graph crawlers started in the background."
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
ps aux | grep '/bin/console app:' | grep -v grep | awk '{print $2}' | xargs -r kill -9
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
SOURCES=("7sur7.cd" "actualite.cd" "radiookapi.net" "mediacongo.net" "newscd.net")
BASE_CMD="/usr/bin/php /var/www/html/news.devscast.tech/bin/console app:update"
LOG_DIR="/var/www/html/news.devscast.tech/var"
mkdir -p "$LOG_DIR"
rm -f "${LOG_DIR}"/*.log
for SOURCE in "${SOURCES[@]}"; do
if [[ "$SOURCE" == "7sur7.cd" ]]; then
CATEGORIES=("politique" "economie" "culture" "sport" "societe")
for CATEGORY in "${CATEGORIES[@]}"; do
LOG_FILE="${LOG_DIR}/${SOURCE}.${CATEGORY}.log"
nohup $BASE_CMD "$SOURCE" --direction=forward -vvv --category="$CATEGORY" > "$LOG_FILE" 2>&1 &
done
else
LOG_FILE="${LOG_DIR}/${SOURCE}.log"
nohup $BASE_CMD "$SOURCE" --direction=forward -vvv > "$LOG_FILE" 2>&1 &
fi
done
echo "All crawlers started in the background."
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
SOURCES=("7sur7.cd" "actualite.cd" "radiookapi.net" "mediacongo.net" "newscd.net")
BASE_CMD="/usr/bin/php /var/www/html/news.devscast.tech/bin/console app:update"
LOG_DIR="/var/www/html/news.devscast.tech/var"
mkdir -p "$LOG_DIR"
rm -f "${LOG_DIR}"/*.log
for SOURCE in "${SOURCES[@]}"; do
if [[ "$SOURCE" == "7sur7.cd" ]]; then
CATEGORIES=("politique" "economie" "culture" "sport" "societe")
for CATEGORY in "${CATEGORIES[@]}"; do
LOG_FILE="${LOG_DIR}/${SOURCE}.${CATEGORY}.log"
$BASE_CMD "$SOURCE" --direction=forward -vvv --category="$CATEGORY" 2>&1 | tee "$LOG_FILE"
done
else
LOG_FILE="${LOG_DIR}/${SOURCE}.log"
$BASE_CMD "$SOURCE" --direction=forward -vvv 2>&1 | tee "$LOG_FILE"
fi
done
echo "All crawlers finished."
+140
View File
@@ -0,0 +1,140 @@
{
"type": "project",
"license": "proprietary",
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": ">=8.4",
"ext-ctype": "*",
"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",
"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",
"ext-dom": "*"
},
"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": {
"App\\": "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"
}
}
}
}
+11379
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,55 @@
<?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="App\Aggregator\Domain\Model\Entity\Article"
repository-class="App\Aggregator\Infrastructure\Persistence\Doctrine\ORM\ArticleOrmRepository"
table="article"
>
<id name="id" type="article_id">
<generator strategy="NONE" />
</id>
<indexes>
<index fields="hash" />
<index fields="publishedAt" />
<index name="IDX_PUBLISHED_AT_ID" fields="publishedAt, id" />
</indexes>
<field name="title" length="1024" />
<field name="body" type="text" />
<embedded name="link" class="App\Aggregator\Domain\Model\ValueObject\Link" use-column-prefix="false" />
<field name="hash" length="32" />
<field name="categories" nullable="true" />
<many-to-one field="source" target-entity="App\Aggregator\Domain\Model\Entity\Source">
<join-column nullable="false" on-delete="CASCADE" />
</many-to-one>
<embedded name="credibility" class="App\Aggregator\Domain\Model\ValueObject\Scoring\Credibility" use-column-prefix="false" />
<field name="sentiment" enum-type="App\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="App\Aggregator\Domain\Model\ValueObject\ReadingTime" use-column-prefix="false" />
<field name="image"
insertable="false"
updatable="false"
column-definition="VARCHAR(1024) GENERATED ALWAYS AS (JSON_UNQUOTE(JSON_EXTRACT(metadata, '$.image'))) STORED"
/>
<field
name="excerpt"
insertable="false"
updatable="false"
column-definition="VARCHAR(255) GENERATED ALWAYS AS (CONCAT(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="App\Aggregator\Domain\Model\Entity\Source"
repository-class="App\Aggregator\Infrastructure\Persistence\Doctrine\ORM\SourceOrmRepository"
table="source"
>
<id name="id" type="source_id">
<generator strategy="NONE"/>
</id>
<field name="url" />
<field name="name" unique="true" />
<embedded name="credibility" class="App\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="App\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="App\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="App\Aggregator\Domain\Model\ValueObject\Scoring\Credibility">
<field name="bias" enum-type="App\Aggregator\Domain\Model\ValueObject\Scoring\Bias" length="30">
<options>
<option name="default">neutral</option>
</options>
</field>
<field name="reliability" enum-type="App\Aggregator\Domain\Model\ValueObject\Scoring\Reliability" length="30">
<options>
<option name="default">reliable</option>
</options>
</field>
<field name="transparency" enum-type="App\Aggregator\Domain\Model\ValueObject\Scoring\Transparency" length="30">
<options>
<option name="default">medium</option>
</options>
</field>
</embeddable>
</doctrine-mapping>
@@ -0,0 +1,42 @@
<?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="App\FeedManagement\Domain\Model\Entity\Bookmark"
repository-class="App\IdentityAndAccess\Infrastructure\Persistence\Doctrine\ORM\BookmarkOrmRepository"
table="bookmark"
>
<id name="id" type="bookmark_id">
<generator strategy="NONE"/>
</id>
<!-- fetching eager cause will always need to check the user's id whenever we deal with a bookmark -->
<many-to-one field="user" target-entity="App\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="App\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="App\FeedManagement\Domain\Model\Entity\Comment"
repository-class="App\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="App\IdentityAndAccess\Domain\Model\Entity\User">
<join-column nullable="false" on-delete="CASCADE" />
</many-to-one>
<many-to-one field="article" target-entity="App\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="App\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="App\FeedManagement\Domain\Model\Entity\FollowedSource"
repository-class="App\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="App\IdentityAndAccess\Domain\Model\Entity\User">
<join-column nullable="false" on-delete="CASCADE" />
</many-to-one>
<many-to-one field="source" target-entity="App\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="App\IdentityAndAccess\Domain\Model\Entity\LoginAttempt"
repository-class="App\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="App\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="App\IdentityAndAccess\Domain\Model\Entity\LoginHistory"
repository-class="App\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="App\IdentityAndAccess\Domain\Model\Entity\User">
<join-column nullable="false" on-delete="CASCADE" />
</many-to-one>
<field name="ipAddress" nullable="true" length="15" />
<embedded name="device" class="App\SharedKernel\Domain\Model\ValueObject\Tracking\Device" />
<embedded name="location" class="App\SharedKernel\Domain\Model\ValueObject\Tracking\GeoLocation" />
<field name="createdAt" type="datetime_immutable"/>
</entity>
</doctrine-mapping>
@@ -0,0 +1,12 @@
<?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="App\IdentityAndAccess\Domain\Model\Entity\RefreshToken"
repository-class="Gesdinet\JWTRefreshTokenBundle\Entity\RefreshTokenRepository"
table="refresh_tokens"
>
</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="App\IdentityAndAccess\Domain\Model\Entity\User"
repository-class="App\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" />
<field name="isLocked" type="boolean">
<options>
<option name="default">0</option>
</options>
</field>
<field name="isConfirmed" type="boolean">
<options>
<option name="default">0</option>
</options>
</field>
<embedded name="roles" class="App\IdentityAndAccess\Domain\Model\ValueObject\Roles" use-column-prefix="false" />
<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="App\IdentityAndAccess\Domain\Model\Entity\VerificationToken"
repository-class="App\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="App\IdentityAndAccess\Domain\Model\Entity\User" fetch="EAGER">
<join-column nullable="false" on-delete="CASCADE" />
</many-to-one>
<field name="purpose" enum-type="App\IdentityAndAccess\Domain\Model\ValueObject\Secret\TokenPurpose" />
<embedded name="token" class="App\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="App\IdentityAndAccess\Domain\Model\ValueObject\Roles">
<field name="roles" type="json"/>
</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="App\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="App\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">0</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="App\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,34 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Class Version20241008030057.
*
* @author bernard-ng <bernard@devscast.tech>
*/
final class Version20241008030057 extends AbstractMigration
{
#[\Override]
public function getDescription(): string
{
return 'Add article table';
}
#[\Override]
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE article (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', title VARCHAR(255) NOT NULL, body LONGTEXT NOT NULL, link VARCHAR(255) NOT NULL, source VARCHAR(255) NOT NULL, categories VARCHAR(255) DEFAULT NULL, published_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', crawled_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_23A0E6636AC99F1 (link), INDEX IDX_23A0E665F8A7F73 (source), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
}
#[\Override]
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE article');
}
}
@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Class Version20241010041217.
*
* @author bernard-ng <bernard@devscast.tech>
*/
final class Version20241010041217 extends AbstractMigration
{
#[\Override]
public function getDescription(): string
{
return 'remove unique index on article link';
}
#[\Override]
public function up(Schema $schema): void
{
$this->addSql('DROP INDEX UNIQ_23A0E6636AC99F1 ON article');
}
#[\Override]
public function down(Schema $schema): void
{
$this->addSql('CREATE UNIQUE INDEX UNIQ_23A0E6636AC99F1 ON article (link)');
}
}
@@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Class Version20241010041432.
*
* @author bernard-ng <bernard@devscast.tech>
*/
final class Version20241010041432 extends AbstractMigration
{
#[\Override]
public function getDescription(): string
{
return 'increase link column size';
}
#[\Override]
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE article CHANGE link link VARCHAR(2048) NOT NULL');
}
#[\Override]
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE article CHANGE link link VARCHAR(255) NOT NULL');
}
}
@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Class Version20241010042241.
*
* @author bernard-ng <bernard@devscast.tech>
*/
final class Version20241010042241 extends AbstractMigration
{
#[\Override]
public function getDescription(): string
{
return 'add hash column to article';
}
#[\Override]
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE article ADD hash VARCHAR(32) NOT NULL');
$this->addSql('UPDATE article SET hash = MD5(link)');
$this->addSql('CREATE INDEX IDX_23A0E66D1B862B8 ON article (hash)');
}
#[\Override]
public function down(Schema $schema): void
{
$this->addSql('DROP INDEX IDX_23A0E66D1B862B8 ON article');
$this->addSql('ALTER TABLE article DROP hash');
}
}
@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Class Version20250314140326.
*
* @author bernard-ng <bernard@devscast.tech>
*/
final class Version20250314140326 extends AbstractMigration
{
#[\Override]
public function getDescription(): string
{
return 'add user table';
}
#[\Override]
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE user (id BINARY(16) NOT NULL COMMENT \'(DC2Type:user_id)\', name VARCHAR(255) NOT NULL, email VARCHAR(500) NOT NULL, password VARCHAR(4098) NOT NULL, created_at DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', updated_at DATE DEFAULT NULL COMMENT \'(DC2Type:date_immutable)\', roles JSON NOT NULL COMMENT \'(DC2Type:json)\', password_reset_token_token VARCHAR(255) DEFAULT NULL, password_reset_token_generated_at DATE DEFAULT NULL COMMENT \'(DC2Type:date_immutable)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
}
#[\Override]
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE user');
}
}
@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Class Version20250314145254.
*
* @author bernard-ng <bernard@devscast.tech>
*/
final class Version20250314145254 extends AbstractMigration
{
#[\Override]
public function getDescription(): string
{
return 'add refresh token';
}
#[\Override]
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE refresh_tokens (id INT AUTO_INCREMENT NOT NULL, refresh_token VARCHAR(128) NOT NULL, username VARCHAR(255) NOT NULL, valid DATETIME NOT NULL, UNIQUE INDEX UNIQ_9BACE7E1C74F2195 (refresh_token), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
}
#[\Override]
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE refresh_tokens');
}
}
@@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250315154326 extends AbstractMigration
{
#[\Override]
public function getDescription(): string
{
return 'fix password_reset_token_generated_at column type';
}
#[\Override]
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE user CHANGE password_reset_token_generated_at password_reset_token_generated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\'');
}
#[\Override]
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE user CHANGE password_reset_token_generated_at password_reset_token_generated_at DATE DEFAULT NULL COMMENT \'(DC2Type:date_immutable)\'');
}
}
@@ -0,0 +1,83 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Class Version20250423183329.
*
* @author bernard-ng <bernard@devscast.tech>
*/
final class Version20250423183329 extends AbstractMigration
{
#[\Override]
public function getDescription(): string
{
return 'refactoring identity and access module';
}
public function up(Schema $schema): void
{
$this->addSql(<<<'SQL'
CREATE TABLE login_attempt (id BINARY(16) NOT NULL COMMENT '(DC2Type:login_attempt_id)', user_id BINARY(16) NOT NULL COMMENT '(DC2Type:user_id)', created_at DATE NOT NULL COMMENT '(DC2Type:date_immutable)', INDEX IDX_8C11C1BA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
SQL);
$this->addSql(<<<'SQL'
CREATE TABLE login_history (id BINARY(16) NOT NULL COMMENT '(DC2Type:login_history_id)', user_id BINARY(16) NOT NULL COMMENT '(DC2Type:user_id)', created_at DATE NOT NULL COMMENT '(DC2Type:date_immutable)', device_operating_system VARCHAR(255) DEFAULT NULL, device_client VARCHAR(255) DEFAULT NULL, device_device VARCHAR(255) DEFAULT NULL, device_is_bot TINYINT(1) DEFAULT 0 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, INDEX IDX_37976E36A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
SQL);
$this->addSql(<<<'SQL'
CREATE TABLE verification_token (id BINARY(16) NOT NULL COMMENT '(DC2Type:verification_token_id)', user_id BINARY(16) NOT NULL COMMENT '(DC2Type:user_id)', purpose VARCHAR(255) NOT NULL, created_at DATE NOT NULL COMMENT '(DC2Type:date_immutable)', token_token VARCHAR(255) DEFAULT NULL, INDEX IDX_C1CC006BA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE login_attempt ADD CONSTRAINT FK_8C11C1BA76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE login_history ADD CONSTRAINT FK_37976E36A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE verification_token ADD CONSTRAINT FK_C1CC006BA76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE article CHANGE id id BINARY(16) NOT NULL COMMENT '(DC2Type:article_id)'
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE user ADD is_locked TINYINT(1) DEFAULT 0 NOT NULL, ADD is_confirmed TINYINT(1) DEFAULT 0 NOT NULL, DROP password_reset_token_token, DROP password_reset_token_generated_at
SQL);
$this->addSql(<<<'SQL'
UPDATE user SET is_locked = 0, is_confirmed = 1
SQL);
}
#[\Override]
public function down(Schema $schema): void
{
$this->addSql(<<<'SQL'
ALTER TABLE login_attempt DROP FOREIGN KEY FK_8C11C1BA76ED395
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE login_history DROP FOREIGN KEY FK_37976E36A76ED395
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE verification_token DROP FOREIGN KEY FK_C1CC006BA76ED395
SQL);
$this->addSql(<<<'SQL'
DROP TABLE login_attempt
SQL);
$this->addSql(<<<'SQL'
DROP TABLE login_history
SQL);
$this->addSql(<<<'SQL'
DROP TABLE verification_token
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE user ADD password_reset_token_token VARCHAR(255) DEFAULT NULL, ADD password_reset_token_generated_at DATETIME DEFAULT NULL COMMENT '(DC2Type:datetime_immutable)', DROP is_locked, DROP is_confirmed
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE article CHANGE id id BINARY(16) NOT NULL COMMENT '(DC2Type:uuid)'
SQL);
}
}
@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Class Version20250423185205.
*
* @author bernard-ng <bernard@devscast.tech>
*/
final class Version20250423185205 extends AbstractMigration
{
#[\Override]
public function getDescription(): string
{
return 'add ip to login history';
}
public function up(Schema $schema): void
{
$this->addSql(<<<'SQL'
ALTER TABLE login_history ADD ip VARCHAR(45) DEFAULT NULL
SQL);
}
#[\Override]
public function down(Schema $schema): void
{
$this->addSql(<<<'SQL'
ALTER TABLE login_history DROP ip
SQL);
}
}
@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250423190105 extends AbstractMigration
{
#[\Override]
public function getDescription(): string
{
return 'remove column prefix';
}
public function up(Schema $schema): void
{
$this->addSql(<<<'SQL'
ALTER TABLE verification_token CHANGE token_token token VARCHAR(255) DEFAULT NULL
SQL);
}
#[\Override]
public function down(Schema $schema): void
{
$this->addSql(<<<'SQL'
ALTER TABLE verification_token CHANGE token token_token VARCHAR(255) DEFAULT NULL
SQL);
}
}
@@ -0,0 +1,66 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
use Symfony\Component\Uid\Uuid;
/**
* Class Version20250501041246.
*
* @author bernard-ng <bernard@devscast.tech>
*/
final class Version20250501041246 extends AbstractMigration
{
#[\Override]
public function getDescription(): string
{
return 'introduce new source entity';
}
public function up(Schema $schema): void
{
$this->addSql(<<<'SQL'
CREATE TABLE source (name VARCHAR(255) NOT NULL, url VARCHAR(255) NOT NULL, updated_at DATE DEFAULT NULL COMMENT '(DC2Type:date_immutable)', bias VARCHAR(255) DEFAULT 'neutral' NOT NULL, reliability VARCHAR(255) DEFAULT 'reliable' NOT NULL, transparency VARCHAR(255) DEFAULT 'medium' NOT NULL, PRIMARY KEY(name)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE article ADD updated_at DATE DEFAULT NULL COMMENT '(DC2Type:date_immutable)', ADD bias VARCHAR(255) DEFAULT 'neutral' NOT NULL, ADD reliability VARCHAR(255) DEFAULT 'reliable' NOT NULL, ADD transparency VARCHAR(255) DEFAULT 'medium' NOT NULL
SQL);
$this->write("Fetching sources from crawled articles...");
$sources = $this->connection
->executeQuery("SELECT DISTINCT source FROM article WHERE source IS NOT NULL")
->fetchFirstColumn();
$this->write(sprintf("%d unique sources found", count($sources)));
foreach ($sources as $sourceName) {
$this->addSql("INSERT INTO source (name, url) VALUES (:name, :url)", [
"name" => $sourceName,
"url" => 'https://' . $sourceName
]);
}
$this->addSql("UPDATE article SET categories = LOWER(categories)");
$this->addSql(<<<'SQL'
ALTER TABLE article ADD CONSTRAINT FK_23A0E665F8A7F73 FOREIGN KEY (source) REFERENCES source (name) ON DELETE RESTRICT
SQL);
}
#[\Override]
public function down(Schema $schema): void
{
$this->addSql(<<<'SQL'
ALTER TABLE article DROP FOREIGN KEY FK_23A0E665F8A7F73
SQL);
$this->addSql(<<<'SQL'
DROP TABLE source
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE article DROP updated_at, DROP bias, DROP reliability, DROP transparency
SQL);
}
}
@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Class Version20250501041950.
*
* @author bernard-ng <bernard@devscast.tech>
*/
final class Version20250501041950 extends AbstractMigration
{
#[\Override]
public function getDescription(): string
{
return 'increase title length';
}
public function up(Schema $schema): void
{
$this->addSql(<<<'SQL'
ALTER TABLE article CHANGE title title VARCHAR(2048) NOT NULL
SQL);
}
#[\Override]
public function down(Schema $schema): void
{
$this->addSql(<<<'SQL'
ALTER TABLE article CHANGE title title VARCHAR(255) NOT NULL
SQL);
}
}
@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Class Version20250501143015.
*
* @author bernard-ng <bernard@devscast.tech>
*/
final class Version20250501143015 extends AbstractMigration
{
public function getDescription(): string
{
return 'add sentiment score';
}
public function up(Schema $schema): void
{
$this->addSql(<<<'SQL'
ALTER TABLE article ADD sentiment VARCHAR(255) DEFAULT 'neutral' NOT NULL
SQL);
}
public function down(Schema $schema): void
{
$this->addSql(<<<'SQL'
ALTER TABLE article DROP sentiment
SQL);
}
}

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