Browse Source

Feature/rename orders to activities in Tag database schema (#4783)

* Rename orders to activities in Tag database schema

* Update changelog
pull/4787/head
Thomas Kaul 1 month ago
committed by GitHub
parent
commit
9e74eec04d
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 8
      apps/api/src/services/tag/tag.service.ts
  3. 10
      prisma/schema.prisma

1
CHANGELOG.md

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Renamed `orders` to `activities` in the `Tag` database schema
- Improved the language localization for Dutch (`nl`)
## 2.164.0 - 2025-05-28

8
apps/api/src/services/tag/tag.service.ts

@ -52,7 +52,7 @@ export class TagService {
include: {
_count: {
select: {
orders: {
activities: {
where: {
userId
}
@ -79,7 +79,7 @@ export class TagService {
id,
name,
userId,
isUsed: _count.orders > 0
isUsed: _count.activities > 0
}));
}
@ -87,7 +87,7 @@ export class TagService {
const tagsWithOrderCount = await this.prismaService.tag.findMany({
include: {
_count: {
select: { orders: true }
select: { activities: true }
}
}
});
@ -97,7 +97,7 @@ export class TagService {
id,
name,
userId,
activityCount: _count.orders
activityCount: _count.activities
};
});
}

10
prisma/schema.prisma

@ -233,11 +233,11 @@ model Subscription {
}
model Tag {
id String @id @default(uuid())
name String
orders Order[]
userId String?
User User? @relation(fields: [userId], onDelete: Cascade, references: [id])
activities Order[]
id String @id @default(uuid())
name String
userId String?
User User? @relation(fields: [userId], onDelete: Cascade, references: [id])
@@unique([name, userId])
@@index([name])

Loading…
Cancel
Save