Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
e4a81d6
Update README.md
al-abd Nov 14, 2024
bbe28ec
Merge pull request #196 from NatiqQuran/main
al-abd Nov 14, 2024
27d3a3c
ReCommit dev updates
al-abd Nov 14, 2024
f84e60f
Merge pull request #197 from al-abd/main
al-abd Nov 14, 2024
8476674
New updated
nyzd Nov 21, 2024
1d358cd
tables updated
nyzd Nov 21, 2024
c3d624c
new error code added, formated
nyzd Nov 21, 2024
3dbeb43
Merge branch 'dev' into main
nyzd Nov 21, 2024
ffcbf58
Merge pull request #201 from nyzd/main
al-abd Nov 23, 2024
b1502ba
bug fix
nyzd Nov 29, 2024
33d0066
Merge pull request #204 from nyzd/main
al-abd Nov 29, 2024
7261504
new table added
nyzd Dec 5, 2024
ba64b3c
new table added
nyzd Dec 5, 2024
8c5b192
Tables name changed
nyzd Dec 5, 2024
5954b77
Merge pull request #206 from nyzd/main
al-abd Dec 6, 2024
67a62a7
new update
nyzd Dec 19, 2024
4ae05a4
tables updated
nyzd Dec 26, 2024
9207dfd
New update
nyzd Dec 26, 2024
a8adda6
Merge pull request #212 from nyzd/main
al-abd Dec 26, 2024
01bf2d2
new update
nyzd Jan 2, 2025
03502a0
Merge pull request #215 from nyzd/main
al-abd Jan 4, 2025
d6144e0
new update
nyzd Jan 13, 2025
aec41a8
Merge pull request #217 from nyzd/main
al-abd Jan 14, 2025
8fecc5a
bug fix
nyzd Jan 14, 2025
a808407
Full update
nyzd Jan 26, 2025
e79f21b
Merge pull request #219 from nyzd/main
al-abd Jan 26, 2025
6925b8c
Search terms added to surah
nyzd Jan 26, 2025
ad13e0c
search term column
nyzd Jan 26, 2025
35b2d71
Merge pull request #221 from nyzd/main
al-abd Jan 27, 2025
a7a4112
Order fixed
nyzd Feb 6, 2025
99495c5
word breakers
nyzd Feb 6, 2025
fdf642b
Merge pull request #223 from nyzd/main
al-abd Feb 6, 2025
883b552
Merge pull request #226 from NatiqQuran/main
al-abd Feb 16, 2025
7518139
Merge pull request #229 from NatiqQuran/test
al-abd Feb 20, 2025
3d56806
Merge branch 'NatiqQuran:dev' into dev
Silence0ne Feb 20, 2025
a22291a
filter: surah added to ayah and bug fix
nyzd Feb 22, 2025
cc752a9
Merge pull request #231 from nyzd/dev
al-abd Feb 23, 2025
7eec9f8
Update docker-image.yml
al-abd Feb 23, 2025
0e531e6
Merge pull request #232 from NatiqQuran/al-abd-patch-1
al-abd Feb 23, 2025
e8bf236
Update docker-publish.yml
al-abd Feb 23, 2025
3f5aae3
Merge pull request #233 from NatiqQuran/al-abd-patch-2
al-abd Feb 23, 2025
3d32ce2
Update rust.yml
al-abd Feb 23, 2025
6eab345
Merge pull request #234 from NatiqQuran/al-abd-patch-2
NatiqCurator Feb 23, 2025
a9c2bf3
other branches on docker
al-abd Feb 23, 2025
f020508
other branches on docker
al-abd Feb 23, 2025
8800cb8
Merge pull request #235 from al-abd/main
al-abd Feb 23, 2025
4336128
Merge pull request #236 from NatiqQuran/main
al-abd Feb 23, 2025
eddf456
publish latest on main branch only
al-abd Feb 23, 2025
d690e49
Merge pull request #237 from al-abd/dev
al-abd Feb 23, 2025
01f98e0
Merge branch 'NatiqQuran:dev' into dev
Silence0ne Mar 8, 2025
81cbebc
Routers ayah updated
Silence0ne Mar 8, 2025
e4e4f12
Router mushaf,surah,word, translation
Silence0ne Mar 8, 2025
10ef887
Fixed bug
Silence0ne Mar 8, 2025
444c474
'README.md'Updated.
Silence0ne Mar 8, 2025
05c728c
Merge pull request #238 from Silence0ne/dev
al-abd Mar 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,29 @@ name: Docker Image CI

on:
push:
branches: [ "main" ]
branches:
- "main"
- "test"
- "dev"
pull_request:
branches: [ "main" ]
branches:
- "main"
- "test"
- "dev"

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Build the Docker image
run: docker build . --file Dockerfile --tag natiq-api:$(date +%s)
run: |
if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then
TAG="latest"
else
TAG="${GITHUB_REF##*/}"
fi
docker build . --file Dockerfile --tag natiq-api:$TAG
32 changes: 22 additions & 10 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,42 @@ name: docker-publish

on:
push:
branches:
branches:
- "main"
- "test"
- "dev"

jobs:
build:
runs-on: ubuntu-latest

steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v3
-
name: Login to Docker Hub

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
-
name: Set up Docker Buildx

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Build and push

- name: Set Docker tags
id: set_tags
run: |
base_tag="${{ secrets.DOCKER_HUB_USERNAME }}/nq-api"
if [[ "${GITHUB_REF##*/}" == "main" ]]; then
echo "tags=${base_tag}:latest" >> $GITHUB_ENV
else
echo "tags=${base_tag}:${GITHUB_REF##*/}" >> $GITHUB_ENV
fi

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/nq-api:latest
tags: ${{ env.tags }}
10 changes: 8 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ name: Rust

on:
push:
branches: [ "main" ]
branches:
- "main"
- "test"
- "dev"
pull_request:
branches: [ "main" ]
branches:
- "main"
- "test"
- "dev"

env:
CARGO_TERM_COLOR: always
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# nq-api
[![docker-publish](https://github.com/NatiqQuran/nq-api/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/NatiqQuran/nq-api/actions/workflows/docker-publish.yml)
[![Docker Image CI](https://github.com/NatiqQuran/nq-api/actions/workflows/docker-image.yml/badge.svg)](https://github.com/NatiqQuran/nq-api/actions/workflows/docker-image.yml)
[![Rust](https://github.com/NatiqQuran/nq-api/actions/workflows/rust.yml/badge.svg)](https://github.com/NatiqQuran/nq-api/actions/workflows/rust.yml)
# nq-api-rust

Natiq Quran open API
[![docker-publish](https://github.com/NatiqQuran/nq-api-rust/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/NatiqQuran/nq-api-rust/actions/workflows/docker-publish.yml)
[![Docker Image CI](https://github.com/NatiqQuran/nq-api-rust/actions/workflows/docker-image.yml/badge.svg)](https://github.com/NatiqQuran/nq-api-rust/actions/workflows/docker-image.yml)
[![Rust](https://github.com/NatiqQuran/nq-api-rust/actions/workflows/rust.yml/badge.svg)](https://github.com/NatiqQuran/nq-api-rust/actions/workflows/rust.yml)

Natiq Quran open API \

# Docker

Start nq-api with docker-compose
Start nq-api-rust with docker-compose

```bash
sudo docker compose up
Expand All @@ -22,7 +23,7 @@ cargo build --release
# Run

```bash
./target/release/nq-api
./target/release/nq-api-rust
```

Api will listen to 0.0.0.0:8080
API will listen to 0.0.0.0:8080
172 changes: 88 additions & 84 deletions error_codes.json
Original file line number Diff line number Diff line change
@@ -1,86 +1,90 @@
{
"INTERNAL_ERROR": {
"status_code": 500,
"message": "Internal Error!"
},
"NOT_FOUND": {
"status_code": 404,
"message": "Not found!"
},
"ACTION_NOT_FOUND": {
"status_code": 404,
"message": "Not found!"
},
"SEND_CODE_INTERNAL_ERROR": {
"status_code": 500,
"message": "Internal error when sending verification code!"
},
"VERIFY_CODE_NOT_SENDED": {
"status_code": 410,
"message": "No verification code is sended to this email!"
},
"VERIFY_CODE_NOT_VALID": {
"status_code": 400,
"message": "Verification code is not valid!"
},
"VERIFY_CODE_ALREADY_USED": {
"status_code": 410,
"message": "Verification code is already used!"
},
"VERIFY_CODE_EXPIRED": {
"status_code": 410,
"message": "Verification code is expired!"
},
"CANT_GENERATE_TOKEN": {
"status_code": 500,
"message": "Can't generate token!"
},
"ORGANIZATION_NAME_NOT_AVAILABLE": {
"status_code": 404,
"message": "Organization name is already in use by another account!"
},
"PERMISSION_CONDITION_VALUE_NOT_VALID": {
"status_code": 400,
"message": "Permission condition value is not valid!"
},
"AUTHZ_CONDITION_VALUE_NOT_DEFINED": {
"status_code": 404,
"message": "Authz condition value is not defined!"
},
"MODEL_ATTRIBUTE_NOT_DEFINED": {
"status_code": 404,
"message": "Model attribute value is not defined!"
},
"VALIDATION_ERROR": {
"status_code": 400,
"message": "Request data is not valid"
},
"FILTER_SORT_VALUE_NOT_DEFINED": {
"status_code": 404,
"message": "Filter sort value is not defined!"
},
"AUTHN_TOKEN_NOT_FOUND": {
"status_code": 401,
"message": "Token required!"
},
"AUTHN_TOKEN_INVALID": {
"status_code": 401,
"message": "Token invalid!"
},
"AUTHZ_PERMISSION_DENIED": {
"status_code": 403,
"message": "Permission denied!"
},
"UUID_ERROR": {
"status_code": 400,
"message": "Invalid UUID!"
},
"PHRASE_NOT_FOUND": {
"status_code": 404,
"message": "Phrase not found!"
},
"BAD_PATH": {
"status_code": 400,
"message": "Path format is not correct!"
}
"INTERNAL_ERROR": {
"status_code": 500,
"message": "Internal Error!"
},
"NOT_FOUND": {
"status_code": 404,
"message": "Not found!"
},
"ACTION_NOT_FOUND": {
"status_code": 404,
"message": "Not found!"
},
"SEND_CODE_INTERNAL_ERROR": {
"status_code": 500,
"message": "Internal error when sending verification code!"
},
"VERIFY_CODE_NOT_SENDED": {
"status_code": 410,
"message": "No verification code is sended to this email!"
},
"VERIFY_CODE_NOT_VALID": {
"status_code": 400,
"message": "Verification code is not valid!"
},
"VERIFY_CODE_ALREADY_USED": {
"status_code": 410,
"message": "Verification code is already used!"
},
"VERIFY_CODE_EXPIRED": {
"status_code": 410,
"message": "Verification code is expired!"
},
"CANT_GENERATE_TOKEN": {
"status_code": 500,
"message": "Can't generate token!"
},
"ORGANIZATION_NAME_NOT_AVAILABLE": {
"status_code": 404,
"message": "Organization name is already in use by another account!"
},
"PERMISSION_CONDITION_VALUE_NOT_VALID": {
"status_code": 400,
"message": "Permission condition value is not valid!"
},
"AUTHZ_CONDITION_VALUE_NOT_DEFINED": {
"status_code": 404,
"message": "Authz condition value is not defined!"
},
"MODEL_ATTRIBUTE_NOT_DEFINED": {
"status_code": 404,
"message": "Model attribute value is not defined!"
},
"VALIDATION_ERROR": {
"status_code": 400,
"message": "Request data is not valid"
},
"FILTER_SORT_VALUE_NOT_DEFINED": {
"status_code": 404,
"message": "Filter sort value is not defined!"
},
"AUTHN_TOKEN_NOT_FOUND": {
"status_code": 401,
"message": "Token required!"
},
"AUTHN_TOKEN_INVALID": {
"status_code": 401,
"message": "Token invalid!"
},
"AUTHZ_PERMISSION_DENIED": {
"status_code": 403,
"message": "Permission denied!"
},
"UUID_ERROR": {
"status_code": 400,
"message": "Invalid UUID!"
},
"PHRASE_NOT_FOUND": {
"status_code": 404,
"message": "Phrase not found!"
},
"BAD_PATH": {
"status_code": 400,
"message": "Path format is not correct!"
},
"NO_BISMILLAH": {
"status_code": 400,
"message": "Doesn't have bismillah!"
}
}
5 changes: 2 additions & 3 deletions migrations/00000000000001_create_app_accounts/up.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
CREATE TABLE app_accounts (
id serial NOT NULL,
id serial PRIMARY KEY,
uuid uuid DEFAULT uuid_generate_v4 () NOT NULL,
username VARCHAR(30) NOT NULL,
account_type TEXT NOT NULL,
CONSTRAINT app_accounts_id PRIMARY KEY (id),
UNIQUE(username)
UNIQUE (username)
);
1 change: 0 additions & 1 deletion migrations/00000000000003_create_mushaf/up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ CREATE TABLE quran_mushafs (
short_name VARCHAR(200),
name VARCHAR(400),
source VARCHAR(300),
bismillah_text TEXT,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
CONSTRAINT mushaf_fk_user_id_rel FOREIGN KEY(creator_user_id) REFERENCES app_users(id),
Expand Down
3 changes: 1 addition & 2 deletions migrations/00000000000005_create_quran_surahs/up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ CREATE TABLE quran_surahs (
name VARCHAR(50) NOT NULL,
period VARCHAR(50),
number serial NOT NULL,
bismillah_status BOOLEAN NOT NULL,
bismillah_as_first_ayah BOOLEAN NOT NULL,
mushaf_id serial NOT NULL,
name_pronunciation TEXT,
name_translation_phrase TEXT,
name_transliteration TEXT,
search_terms TEXT ARRAY,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
CONSTRAINT quran_surahs_id PRIMARY KEY (id),
Expand Down
2 changes: 2 additions & 0 deletions migrations/2023-02-19-100955_create_quran_ayahs/up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ CREATE TABLE quran_ayahs (
surah_id serial NOT NULL,
ayah_number serial NOT NULL,
sajdah VARCHAR(20),
is_bismillah BOOLEAN NOT NULL,
bismillah_text TEXT,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
CONSTRAINT quran_ayahs_id PRIMARY KEY (id),
Expand Down
1 change: 0 additions & 1 deletion migrations/2023-03-12-100253_create_translation/up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ CREATE TABLE quran_translations (
release_date DATE,
source VARCHAR(300),
approved BOOLEAN DEFAULT FALSE NOT NULL,
bismillah TEXT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
CONSTRAINT translation_fk_user_id_rel FOREIGN KEY(creator_user_id) REFERENCES app_users(id),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE quran_translations_ayahs;
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
CREATE TABLE quran_translations_text (
CREATE TABLE quran_translations_ayahs (
id serial NOT NULL,
uuid uuid DEFAULT uuid_generate_v4 () NOT NULL,
creator_user_id serial NOT NULL,
translation_id serial NOT NULL,
ayah_id serial NOT NULL,
text TEXT NOT NULL,
bismillah TEXT,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
CONSTRAINT translation_text_id PRIMARY KEY (id),
CONSTRAINT translation_ayah_id PRIMARY KEY (id),
CONSTRAINT fk_translation FOREIGN KEY(translation_id) REFERENCES quran_translations(id) on delete cascade,
CONSTRAINT translation_text_fk_user_id_rel FOREIGN KEY(creator_user_id) REFERENCES app_users(id),
CONSTRAINT translation_ayah_fk_user_id_rel FOREIGN KEY(creator_user_id) REFERENCES app_users(id),
CONSTRAINT fk_ayah FOREIGN KEY(ayah_id) REFERENCES quran_ayahs(id) on delete cascade
);

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE quran_ayahs_breakers;
13 changes: 13 additions & 0 deletions migrations/2024-12-05-083921_create_quran_ayahs_breakers/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CREATE TABLE quran_ayahs_breakers (
id serial,
uuid uuid DEFAULT uuid_generate_v4 () NOT NULL,
creator_user_id serial NOT NULL,
ayah_id serial NOT NULL,
owner_account_id INT REFERENCES app_accounts (id),
name VARCHAR(256) NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
CONSTRAINT ayah_break_id PRIMARY KEY (id),
CONSTRAINT fk_quran_ayah_break_creator_user_id FOREIGN KEY (creator_user_id) REFERENCES app_users (id),
CONSTRAINT fk_break_ayah FOREIGN KEY (ayah_id) REFERENCES quran_ayahs (id) on delete cascade
);
Loading