Skip to content
Merged

Dev #18

Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 7 additions & 7 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ MERCURE_JWT_SECRET="!ChangeThisMercureHubJWTSecretKey!"
###> lexik/jwt-authentication-bundle ###
JWT_PRIVATE_KEY_PATH=%kernel.project_dir%/config/jwt/private.pem
JWT_PUBLIC_KEY_PATH=%kernel.project_dir%/config/jwt/public.pem
JWT_PASSPHRASE=
JWT_PASSPHRASE=e357a5e49f1839042101695a96c07c9edfdf4939d4e91b1368d5c177153a71bc
###< lexik/jwt-authentication-bundle ###

VITE_CACHE_DB_NAME=
VITE_CACHE_STORE_NAME=
VITE_GOOGLE_CLIENT_ID=
VITE_GOOGLE_REDIRECT_URI=
VITE_PUSH_PUBLIC_KEY=
VITE_PUSH_PRIVATE_KEY=
VITE_CACHE_DB_NAME=HabitAiCacheDev
VITE_CACHE_STORE_NAME=cache
VITE_GOOGLE_CLIENT_ID=643971601411-8n1r7vok0pk4v4q250dfpr4ibs17jfms.apps.googleusercontent.com
VITE_GOOGLE_REDIRECT_URI=http://localhost:8000/api/auth/google/callback
VITE_PUSH_PUBLIC_KEY=BGFRrWJKC5fnlb_eLwOIqa4bWlbBqRUIFvlDYQ1GX56Hl5Kv4KNopAIqZ2Tq6ohG4hIdLJoim4313yKUyNevXgo
VITE_PUSH_PRIVATE_KEY=EE9lQvPuHsWctURErU3bC4VG9wLguK-JcLI5iTo7G94
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ up-prod-build: ## Start the docker hub in detached mode (no logs)

start: build up ## Build and start the containers

db-reset: ## reset databases
@echo "Stopping containers..."
@$(DOCKER_COMP) down
@echo "Removing PostgreSQL volume..."
@docker volume rm timer_pgdata || true
@echo "Done. You can now rebuild containers."

stop: ## Stop the docker hub
@$(DOCKER_COMP) stop

Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 🚀 HabitAi
**# 🚀 HabitAi

**HabitAi** is an application designed to boost productivity with the help of Artificial Intelligence (AI).

Expand All @@ -11,20 +11,20 @@ Project is currently under **active development**.
## 🛠️ Tech Stack

* **Frontend:** Flutter, React, Vue
* **Backend:** Symfony (PHP 8.3)
* **Architecture:** Clean Architecture, Domain-Driven Design (DDD), Atomic Design
* **Backend:** Symfony (PHP 8.3)
* **Architecture:** Clean Architecture, Domain-Driven Design (DDD), Atomic Design

## ✨ Features

* 📌 **Task Management**
* 🧭 **Eisenhower Matrix** for prioritization
* ⏳ **Pomodoro Timer** for focused work
* 🌍 **Multilingual Support** (5 languages)
* ⚡ **Frontend improvements**:
* 🧭 **Eisenhower Matrix** for prioritization
* ⏳ **Pomodoro Timer** for focused work
* 🌍 **Multilingual Support** (5 languages)
* ⚡ **Frontend improvements**:

* **Cache-Then-Network (CTN)** system for optimized data fetching
* **IndexedDB (IDB)** integration for offline access and reduced server load
* Centralized caching and efficient state management
* **Cache-Then-Network (CTN)** system for optimized data fetching
* **IndexedDB (IDB)** integration for offline access and reduced server load
* Centralized caching and efficient state management

---

Expand Down Expand Up @@ -64,10 +64,10 @@ php bin/console app:resources:sync
exit
```

### 6. Start frontend
### 6. frontend host

```bash
npm run
http://localhost:10001/
```

### 7. Stop and remove containers
Expand All @@ -81,5 +81,5 @@ make down
## 📌 Project Status

🔧 Under active development.
Stay tuned for updates and new releases!
Stay tuned for updates and new releases!**

4 changes: 2 additions & 2 deletions README.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ php bin/console app:resources:sync
exit
```

### 6. Запуск фронтенда
### 6. Адрес фронтенда

```bash
npm run
http://localhost:10001/
```

### 7. Остановка и удаление контейнеров
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
ports:
- 11001:80
- 10001:80
restart: unless-stopped
php:
container_name: timer_app_php
Expand Down
1 change: 0 additions & 1 deletion src/Aplication/UseCase/AuthUseCase/UsersAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public function register(UsersForRegister $users): JwtTokenDto
$userEntity = new Users();
$userEntity->setEmail($users->getEmail());
$userEntity->setName($users->getName());

$hashedPassword = $this->passwordHasher->hash($users->getPassword());
$userEntity->setPassword($hashedPassword);
$userEntity->setRole($users->getRole() ?: 'user');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function getTranslatePageByLang(string $version, string $prefixLang): Lan
{
$translate = $this->language->getPageTranslateByLangId($version, $prefixLang);
if (empty($translate)) {
throw new MessageException('Перевод не получено');
throw new MessageException("Перевод не получено $translate");
}

return $translate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ public function __construct(
public function saveResources(): void
{
$this->sync('языки', [$this->databaseResources, 'getLanguages'], [$this->resourceSync, 'setLanguage']);
$this->sync('переводы', [$this->databaseResources, 'getTranslates'], [$this->resourceSync, 'setTranslation']);
$this->sync('переводы', [$this->databaseResources, 'getTranslates'], function ($translations) {
return $this->resourceSync->setTranslation('v1_translate_site', $translations);
});
$this->sync('планы', [$this->databaseResources, 'getPremiumPlans'], [$this->resourceSync, 'setPremiumPlans']);
$this->sync('шаблоны привычек', [$this->databaseResources, 'getHabitsTemplates'], [$this->resourceSync, 'setHabitsTemplates']);
$this->sync('FAQ', [$this->databaseResources, 'getFaq'], [$this->resourceSync, 'setFaq']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function setLanguage(array $languages): bool;
/**
* @param array<string, array<string, array<string, string>>> $translations
*/
public function setTranslation(array $translations): bool;
public function setTranslation(string $pageName, array $translations): bool;

/**
* @param PremiumPlansDto[] $plans
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function saveDateJunction(ReqDataJunction $data): int
->where('hdj.habitsId = :habitsId')
->andWhere('hdj.data_id = :dataId')
->andWhere('hdj.data_type = :dataType')
->andWhere('hdj.is_delete = 0')
->andWhere('hdj.is_delete = false')
->setParameter('habitsId', $data->getHabitsId())
->setParameter('dataId', $data->getDataId())
->setParameter('dataType', $data->getDataType())
Expand All @@ -57,7 +57,7 @@ public function updateDateJunction(int $habitsId, string $types): int|bool
{
$entity = $this->createQueryBuilder('hdj')
->where('hdj.habitsId = :habitsId')
->andWhere('hdj.is_delete = 0')
->andWhere('hdj.is_delete = false')
->setParameter('habitsId', $habitsId)
->getQuery()
->getOneOrNullResult();
Expand Down Expand Up @@ -89,7 +89,7 @@ public function getDateJunctionByHabitsId(int $habitsId): HabitsDataJuntion
{
$entity = $this->createQueryBuilder('hdj')
->where('hdj.habitsId = :habitsId')
->andWhere('hdj.is_delete = 0')
->andWhere('hdj.is_delete = false')
->setParameter('habitsId', $habitsId)
->getQuery()
->getOneOrNullResult();
Expand All @@ -110,7 +110,7 @@ public function getTypeByHabitsId(int $habitsId): string
{
$entity = $this->createQueryBuilder('djc')
->where('djc.habitsId = :habitsId')
->andWhere('djc.is_delete = 0')
->andWhere('djc.is_delete = false')
->setParameter('habitsId', $habitsId)
->getQuery()
->getOneOrNullResult();
Expand All @@ -131,7 +131,7 @@ public function updateType(int $habitsId, string $types): bool
{
$entity = $this->createQueryBuilder('djc')
->where('djc.habitsId = :habitsId')
->andWhere('djc.is_delete = 0')
->andWhere('djc.is_delete = false')
->setParameter('habitsId', $habitsId)
->getQuery()
->getOneOrNullResult();
Expand All @@ -155,7 +155,7 @@ public function createJunction(int $habitsId, string $types, int $dataId): int|b

$exists = $this->createQueryBuilder('hdj')
->where('hdj.habitsId = :habitsId')
->andWhere('hdj.is_delete = 0')
->andWhere('hdj.is_delete = false')
->setParameter('habitsId', $habitsId)
->getQuery()
->getOneOrNullResult();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function updateDates(int $id, DatesDailyForSaveDto $dates): bool
$em = $this->getEntityManager();
$datesEntity = $this->createQueryBuilder('d')
->where('d.id = :id')
->andWhere('d.is_delete = 0')
->andWhere('d.is_delete = false')
->setParameter('id', $id)
->getQuery()
->getOneOrNullResult();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function updateDatesRepeat(int $id, int $day): bool
$em = $this->getEntityManager();
$repeatEntity = $this->createQueryBuilder('r')
->where('r.id = :id')
->andWhere('r.is_delete = 0')
->andWhere('r.is_delete = false')
->setParameter('id', $id)
->getQuery()
->getOneOrNullResult();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function updateDatesWeekly(int $id, int $count): bool
$em = $this->getEntityManager();
$weeklyEntity = $this->createQueryBuilder('w')
->where('w.id = :id')
->andWhere('w.is_delete = 0')
->andWhere('w.is_delete = false')
->setParameter('id', $id)
->getQuery()
->getOneOrNullResult();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function getProgressToday(int $userId): array|false
$results = $this->createQueryBuilder('h')
->where('h.userId = :userId')
->andWhere('h.recordedAt BETWEEN :start AND :end')
->andWhere('h.is_delete = 0')
->andWhere('h.is_delete = false')
->setParameter('userId', $userId)
->setParameter('start', $todayStart)
->setParameter('end', $todayEnd)
Expand Down Expand Up @@ -100,7 +100,7 @@ public function getAllProgress(int $userId): array|false
{
$qb = $this->createQueryBuilder('h')
->where('h.userId = :userId')
->andWhere('h.is_delete = 0')
->andWhere('h.is_delete = false')
->setParameter('userId', $userId)
->orderBy('h.recordedAt', 'ASC');
$results = $qb->getQuery()->getResult();
Expand Down Expand Up @@ -141,7 +141,7 @@ public function getAllProgressWithHabitsTitle(int $userId): array|false
INNER JOIN habits h ON h.id = hh.habits_id
WHERE hh.user_id = :userId
AND hh.is_deleted = 0
AND h.is_delete = 0
AND h.is_delete = false
ORDER BY hh.recorded_at ASC';

$results = $this->getEntityManager()
Expand Down Expand Up @@ -172,7 +172,7 @@ public function getCountDoneHabits(int $userId): int
->select('COUNT(h.id)')
->where('h.userId = :userId')
->andWhere('h.isDone = 1')
->andWhere('h.is_delete = 0')
->andWhere('h.is_delete = false')
->setParameter('userId', $userId)
->getQuery()
->getSingleScalarResult();
Expand Down
6 changes: 3 additions & 3 deletions src/Infrastructure/Repository/Habits/HabitsRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function getByUserId(int $userId): Habit
{
return $this->createQueryBuilder('h')
->where('h.userId = :userId')
->andWhere('h.is_delete = 0')
->andWhere('h.is_delete = false')
->setParameter('userId', $userId)
->getQuery()
->getResult();
Expand Down Expand Up @@ -138,7 +138,7 @@ public function getHabitsForToday(int $day, int $week, int $month, int $userId):
)
AND h.begin_date <= :todayDate
AND h.user_id = :userId
AND h.is_delete = 0
AND h.is_delete = false
";

$params = [
Expand Down Expand Up @@ -193,7 +193,7 @@ public function getCountHabitsToday(int $day, int $week, int $month, int $userId
(dd.`{$dayOfWeek}` = TRUE OR dw.count_days = :dayOfWeekNumber OR dr.day = :dayOfMonth)
AND h.begin_date <= :today
AND h.user_id = :userId
AND h.is_delete = 0
AND h.is_delete = false
";

$params = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public function getPageTranslateByLangId(string $version, string $prefix): ?Lang
->join('lpt.language', 'lang')
->where('lpt.pageName = :page')
->andWhere('lang.prefix = :prefix')
->andWhere('lpt.is_delete = 0')
->andWhere('lang.is_delete = 0')
->andWhere('lpt.is_delete = false')
->andWhere('lang.is_delete = false')
->setParameter('page', $version)
->setParameter('prefix', $prefix)
->getQuery()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function renameMatricColumn(RenameColumnMatric $dto): bool

$existing = $this->createQueryBuilder('m')
->where('m.userId = :userId')
->andWhere('m.is_delete = 0')
->andWhere('m.is_delete = false')
->setParameter('userId', $dto->userId)
->getQuery()
->getOneOrNullResult();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public function getMatricWithTasks(int $userId, int $tasksId): MatricWithTasks|b
LEFT JOIN tasksHistory th ON th.tasks_id = t.id
WHERE m.user_id = :userId
AND m.tasks_number = :tasksId
AND m.is_delete = 0
AND t.is_delete = 0
AND m.is_delete = false
AND t.is_delete = false
';

$rows = $conn->fetchAllAssociative($sql, [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function getDataByUserIdAndPeriod(int $userId, int $target): array

return $this->createQueryBuilder('h')
->andWhere('h.user_id = :userId')
->andWhere('h.is_delete = 0')
->andWhere('h.is_delete = false')
->andWhere('h.create_date BETWEEN :start AND :end')
->setParameter('userId', $userId)
->setParameter('start', $start)
Expand All @@ -114,7 +114,7 @@ public function getPomoDayByUserId(int $userId): array

return $this->createQueryBuilder('h')
->andWhere('h.user_id = :userId')
->andWhere('h.is_delete = 0')
->andWhere('h.is_delete = false')
->andWhere('h.create_date BETWEEN :start AND :end')
->setParameter('userId', $userId)
->setParameter('start', $start)
Expand All @@ -130,7 +130,7 @@ public function getAllCountPomodorByUserId(int $userId): int|bool
return (int) $this->createQueryBuilder('h')
->select('COUNT(h.id)')
->andWhere('h.user_id = :userId')
->andWhere('h.is_delete = 0')
->andWhere('h.is_delete = false')
->setParameter('userId', $userId)
->getQuery()
->getSingleScalarResult();
Expand Down
6 changes: 3 additions & 3 deletions src/Infrastructure/Repository/Purpose/PurposeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function updatePurposeByHabitId(PurposeDto $dto): bool
$em = $this->getEntityManager();
$purpose = $this->createQueryBuilder('p')
->where('p.habitsId = :habitsId')
->andWhere('p.is_delete = 0')
->andWhere('p.is_delete = false')
->setParameter('habitsId', $dto->getHabitsId())
->getQuery()
->getOneOrNullResult();
Expand All @@ -67,7 +67,7 @@ public function getPurposeCountByHabitId(int $habitId): int
return (int) $this->createQueryBuilder('h')
->select('h.count')
->where('h.habitsId = :habitId')
->andWhere('h.is_delete = 0')
->andWhere('h.is_delete = false')
->setParameter('habitId', $habitId)
->getQuery()
->getSingleScalarResult();
Expand All @@ -78,7 +78,7 @@ public function deletePurposeByHabitId(int $habitId): bool
$em = $this->getEntityManager();
$purpose = $this->createQueryBuilder('p')
->where('p.habitsId = :habitId')
->andWhere('p.is_delete = 0')
->andWhere('p.is_delete = false')
->setParameter('habitId', $habitId)
->getQuery()
->getOneOrNullResult();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function saveStorage(SaveStorageDto $saveStorageDto): int|false
->where('h.fullPath = :fullPath')
->andWhere('h.type = :type')
->andWhere('h.fileType = :fileType')
->andWhere('h.is_delete = 0')
->andWhere('h.is_delete = false')
->setParameter('fullPath', $saveStorageDto->fullPath)
->setParameter('type', $saveStorageDto->type)
->setParameter('fileType', $saveStorageDto->fileType)
Expand Down
Loading