diff --git a/src/db/relations/collection-likes.relation.ts b/src/db/relations/collection-like.relation.ts similarity index 96% rename from src/db/relations/collection-likes.relation.ts rename to src/db/relations/collection-like.relation.ts index 418415e9b5203365348251b6069f60b9e83967ed..73292d5f525f847e39e4b20d6f5c9647ca35614f 100644 --- a/src/db/relations/collection-likes.relation.ts +++ b/src/db/relations/collection-like.relation.ts @@ -1,6 +1,6 @@ import { integer, pgTable } from "drizzle-orm/pg-core"; import userTable from "../schema/user.schema"; -import collectionTable from "../schema/collections.schema"; +import collectionTable from "../schema/collection.schema"; import { createInsertSchema, createSelectSchema } from "drizzle-zod"; import type { z } from "zod"; import { relations } from "drizzle-orm"; diff --git a/src/db/relations/collection-resources.relation.ts b/src/db/relations/collection-resource.relation.ts similarity index 100% rename from src/db/relations/collection-resources.relation.ts rename to src/db/relations/collection-resource.relation.ts diff --git a/src/db/relations/follows.relation.ts b/src/db/relations/followers.relation.ts similarity index 97% rename from src/db/relations/follows.relation.ts rename to src/db/relations/followers.relation.ts index fdf5982f992e0075a0639b8c2868c31f43e81dd2..cbcc43227b6527cc1e2c43cb5a31568bd2cf83de 100644 --- a/src/db/relations/follows.relation.ts +++ b/src/db/relations/followers.relation.ts @@ -4,7 +4,7 @@ import { relations } from "drizzle-orm" import { createInsertSchema, createSelectSchema } from "drizzle-zod" import type { z } from "zod" -const followRelationTable = pgTable('follows', { +const followRelationTable = pgTable('followers', { id: serial('id').primaryKey() .unique() .notNull(), diff --git a/src/db/relations/notification.relation.ts b/src/db/relations/notification.relation.ts index 32a605c259a09eab7e873371dd7d7e2a368495da..ed932ee0f34bea64e0006685ca6718742e88b926 100644 --- a/src/db/relations/notification.relation.ts +++ b/src/db/relations/notification.relation.ts @@ -4,7 +4,7 @@ import { createInsertSchema, createSelectSchema } from "drizzle-zod" import type { z } from "zod" import { actionTable, collectionTable, resourceTable, userTable } from "../schema" -const notificationRelationTable = pgTable('notification', { +const notificationRelationTable = pgTable('notifications', { id: serial('id').primaryKey() .unique() .notNull(), diff --git a/src/db/schema/resource-educational-stages.schema.ts b/src/db/relations/resource-educational-stage.relation.ts similarity index 94% rename from src/db/schema/resource-educational-stages.schema.ts rename to src/db/relations/resource-educational-stage.relation.ts index e8a79308cbb7836bf67ef01a7f6ccc301a1385af..7821673f58c2842d97acba265e6e361cc489a2b8 100644 --- a/src/db/schema/resource-educational-stages.schema.ts +++ b/src/db/relations/resource-educational-stage.relation.ts @@ -1,6 +1,6 @@ import { integer, pgTable } from "drizzle-orm/pg-core"; -import resourceTable from "./resource.schema"; -import educationalStageTable from "./educational-stages.schema"; +import resourceTable from "../schema/resource.schema"; +import educationalStageTable from "../schema/educational-stage.schema"; import { relations } from "drizzle-orm"; import { createSelectSchema } from "drizzle-zod"; import type { z } from "zod"; diff --git a/src/db/schema/resource-languages.schema.ts b/src/db/relations/resource-language.relation.ts similarity index 100% rename from src/db/schema/resource-languages.schema.ts rename to src/db/relations/resource-language.relation.ts diff --git a/src/db/relations/resource-likes.relation.ts b/src/db/relations/resource-like.relation.ts similarity index 100% rename from src/db/relations/resource-likes.relation.ts rename to src/db/relations/resource-like.relation.ts diff --git a/src/db/schema/resource-subjects.schema.ts b/src/db/relations/resource-subject.relation.ts similarity index 93% rename from src/db/schema/resource-subjects.schema.ts rename to src/db/relations/resource-subject.relation.ts index e8150efcaf89988d9ccc2fd996058693f082b3da..d3add64bb4e8e1c8ddc87b5a222b6f8d97b429e0 100644 --- a/src/db/schema/resource-subjects.schema.ts +++ b/src/db/relations/resource-subject.relation.ts @@ -1,6 +1,6 @@ import { integer, pgTable } from "drizzle-orm/pg-core"; -import resourceTable from "./resource.schema"; -import subjectsTable from "./subjects.schema"; +import resourceTable from "../schema/resource.schema"; +import subjectsTable from "../schema/subject.schema"; import { createInsertSchema, createSelectSchema } from "drizzle-zod"; import type { z } from "zod"; import { relations } from "drizzle-orm"; diff --git a/src/db/relations/user-achievements.relation.ts b/src/db/relations/user-achievement.relation.ts similarity index 100% rename from src/db/relations/user-achievements.relation.ts rename to src/db/relations/user-achievement.relation.ts diff --git a/src/db/relations/user-institution.relation.ts b/src/db/relations/user-institution.relation.ts index 45ed5a143d3e9b86768e7fbd13cd4568a30e842d..6bf889f0834fb7de363aa4e52dbd3d27a75e8e61 100644 --- a/src/db/relations/user-institution.relation.ts +++ b/src/db/relations/user-institution.relation.ts @@ -4,7 +4,7 @@ import { relations } from "drizzle-orm" import { createInsertSchema, createSelectSchema } from "drizzle-zod" import type { z } from "zod" -const userInstitutionRelationTable = pgTable('user_institution', { +const userInstitutionRelationTable = pgTable('user_institutions', { id: serial('id').primaryKey() .unique() .notNull(), diff --git a/src/db/relations/user-item.relation.ts b/src/db/relations/user-item.relation.ts index 1cf7ca81e8c6992001834bf99b9fb0dd489ccd2e..e33a5efe43451fbffd51c3cb63b91c322ae17777 100644 --- a/src/db/relations/user-item.relation.ts +++ b/src/db/relations/user-item.relation.ts @@ -4,7 +4,7 @@ import { relations } from "drizzle-orm" import { createInsertSchema, createSelectSchema } from "drizzle-zod" import type { z } from "zod" -const userItemRelationTable = pgTable('user_item', { +const userItemRelationTable = pgTable('user_items', { id: serial('id').primaryKey() .unique() .notNull(), diff --git a/src/db/relations/user-role.relation.ts b/src/db/relations/user-role.relation.ts index 3d661d362d544b975a7519f157edf2024b486978..690c4f6e61f26d5a01b696982b6e66e15c596df7 100644 --- a/src/db/relations/user-role.relation.ts +++ b/src/db/relations/user-role.relation.ts @@ -4,7 +4,7 @@ import { relations } from "drizzle-orm" import { createInsertSchema, createSelectSchema } from "drizzle-zod" import type { z } from "zod" -const userRoleRelationTable = pgTable('user_role', { +const userRoleRelationTable = pgTable('user_roles', { id: serial('id').primaryKey() .unique() .notNull(), diff --git a/src/db/repo/achievement.repo.ts b/src/db/repo/achievement.repo.ts index 4e700700125fb1823399996ae536b852fa4581dc..749ba7616f39fe559c7370751d562330d227651b 100644 --- a/src/db/repo/achievement.repo.ts +++ b/src/db/repo/achievement.repo.ts @@ -1,7 +1,7 @@ import { Service } from "typedi"; -import type { AchievementInput, AchievementModel, AchievementUpdate } from "../schema/achievements.schema"; +import type { AchievementInput, AchievementModel, AchievementUpdate } from "../schema/achievement.schema"; import db from ".."; -import achievementTable, { achievementSchemas } from "../schema/achievements.schema"; +import achievementTable, { achievementSchemas } from "../schema/achievement.schema"; import { eq } from "drizzle-orm"; @Service() diff --git a/src/db/repo/collection-likes.repo.ts b/src/db/repo/collection-likes.repo.ts index 889edda1c53c9a45f9843ee275c311b30af69b83..e23bc4e688ed37a4a09657969ee0f1653587f1e6 100644 --- a/src/db/repo/collection-likes.repo.ts +++ b/src/db/repo/collection-likes.repo.ts @@ -1,11 +1,11 @@ import { Service } from "typedi"; -import type { CollectionModel } from "../schema/collections.schema"; +import type { CollectionModel } from "../schema/collection.schema"; import type { UserModel } from "../schema/user.schema"; import db from ".."; -import collectionLikesTable from "../relations/collection-likes.relation"; +import collectionLikesTable from "../relations/collection-like.relation"; import { and, eq, inArray } from "drizzle-orm"; import userTable from "../schema/user.schema"; -import collectionTable from "../schema/collections.schema"; +import collectionTable from "../schema/collection.schema"; @Service() export class collectionLikesRepo { diff --git a/src/db/repo/collection-resources.repo.ts b/src/db/repo/collection-resources.repo.ts index 6c7d45ddaf03c9305dd8094bb4dfa9f56cfdc247..b2471a04304b41e6e11e3d522d61cd3e5c22e482 100644 --- a/src/db/repo/collection-resources.repo.ts +++ b/src/db/repo/collection-resources.repo.ts @@ -1,11 +1,11 @@ import { Service } from "typedi"; -import type { CollectionModel } from "../schema/collections.schema"; +import type { CollectionModel } from "../schema/collection.schema"; import type { ResourceModel } from "../schema/resource.schema"; import db from ".."; -import collectionResourcesTable from "../relations/collection-resources.relation"; +import collectionResourcesTable from "../relations/collection-resource.relation"; import { and, eq, inArray, name } from "drizzle-orm"; import resourceTable from "../schema/resource.schema"; -import collectionTable from "../schema/collections.schema"; +import collectionTable from "../schema/collection.schema"; @Service() export class collectionResourcesRepo { diff --git a/src/db/repo/collections.repo.ts b/src/db/repo/collections.repo.ts index c388618d34253c396046736ae12f9cd57d3ce66e..3f6d010aaadde1401e50da04c3e7da60a1a81d1e 100644 --- a/src/db/repo/collections.repo.ts +++ b/src/db/repo/collections.repo.ts @@ -3,9 +3,9 @@ import type { CollectionInput, CollectionModel, CollectionUpdate, -} from '../schema/collections.schema' +} from '../schema/collection.schema' import db from ".."; -import collectionTable, { collectionSchemas } from "../schema/collections.schema"; +import collectionTable, { collectionSchemas } from "../schema/collection.schema"; import { eq } from 'drizzle-orm' @Service() diff --git a/src/db/repo/complaint.repo.ts b/src/db/repo/complaint.repo.ts index 3380cfdd82e3e6f9bb40e86265f08ea4ec456cef..895bae1cf873b91b9556c678ef9551112993a9fb 100644 --- a/src/db/repo/complaint.repo.ts +++ b/src/db/repo/complaint.repo.ts @@ -1,7 +1,7 @@ import { Service } from "typedi"; -import type { ComplaintInput, ComplaintModel, ComplaintUpdate } from "../schema/complaints.schema"; +import type { ComplaintInput, ComplaintModel, ComplaintUpdate } from "../schema/complaint.schema"; import db from ".."; -import complaintTable, { complaintSchemas } from "../schema/complaints.schema"; +import complaintTable, { complaintSchemas } from "../schema/complaint.schema"; import { eq } from "drizzle-orm"; @Service() diff --git a/src/db/repo/educational-stage.repo.ts b/src/db/repo/educational-stage.repo.ts index c61a02a6a78f71a0bffe8457d91f1a000f208137..aba2d80fc2176468baefcb20c424e870f05124f9 100644 --- a/src/db/repo/educational-stage.repo.ts +++ b/src/db/repo/educational-stage.repo.ts @@ -1,7 +1,7 @@ import { Service } from "typedi"; -import type { EducationalStagesInput, EducationalStagesModel, EducationalStagesUpdate } from "../schema/educational-stages.schema"; +import type { EducationalStagesInput, EducationalStagesModel, EducationalStagesUpdate } from "../schema/educational-stage.schema"; import db from ".."; -import educationalStageTable, { educationalStageSchema } from "../schema/educational-stages.schema"; +import educationalStageTable, { educationalStageSchema } from "../schema/educational-stage.schema"; import { eq } from "drizzle-orm"; diff --git a/src/db/repo/follow.repo.ts b/src/db/repo/follow.repo.ts index 1204e7b8fd593d2a27be81bf6ee59c3c9a3e419a..0350c9710b35cc743edc60377878aec98972d46a 100644 --- a/src/db/repo/follow.repo.ts +++ b/src/db/repo/follow.repo.ts @@ -1,5 +1,5 @@ import { Service } from "typedi"; -import followRelationTable, { followRelationSchemas, type FollowRelationInput, type FollowRelationModel, type FollowRelationUpdate } from "../relations/follows.relation"; +import followRelationTable, { followRelationSchemas, type FollowRelationInput, type FollowRelationModel, type FollowRelationUpdate } from "../relations/followers.relation"; import { z } from "zod"; import db from "@/db"; import { and, eq } from "drizzle-orm"; diff --git a/src/db/repo/institutions.repo.ts b/src/db/repo/institutions.repo.ts index 4b2f9daeb30760727ad3bff9cd5d5311abf6d02a..06fd0c431210a7501b2e48c5087e43d3b3014d37 100644 --- a/src/db/repo/institutions.repo.ts +++ b/src/db/repo/institutions.repo.ts @@ -1,5 +1,5 @@ import { Service } from "typedi"; -import institutionTable, { institutionSchemas, type InstitutionInput, type InstitutionModel, type InstitutionUpdate } from "../schema/institutions.schema"; +import institutionTable, { institutionSchemas, type InstitutionInput, type InstitutionModel, type InstitutionUpdate } from "../schema/institution.schema"; import db from "@/db"; import { z } from "zod"; import { eq } from "drizzle-orm"; diff --git a/src/db/repo/items.repo.ts b/src/db/repo/items.repo.ts index e9d24c78cc5846d9954ab50a84d8d7e87d8b8495..639285e3362bac35f3f73b2c4f1804492c53b7ac 100644 --- a/src/db/repo/items.repo.ts +++ b/src/db/repo/items.repo.ts @@ -1,7 +1,7 @@ import { Service } from "typedi"; -import type { ItemsInput, ItemsModel, ItemsUpdate } from "../schema/items.schema"; +import type { ItemsInput, ItemsModel, ItemsUpdate } from "../schema/item.schema"; import db from ".."; -import itemsTable, { itemsSchema } from "../schema/items.schema"; +import itemsTable, { itemsSchema } from "../schema/item.schema"; import { and, eq } from "drizzle-orm"; diff --git a/src/db/repo/licenses.repo.ts b/src/db/repo/licenses.repo.ts index 50d7e5c168ef2e2dcd232536c3be8bd5e2d3e389..8841442af39ccada4e349a68afce38219e752c12 100644 --- a/src/db/repo/licenses.repo.ts +++ b/src/db/repo/licenses.repo.ts @@ -1,7 +1,7 @@ import { Service } from "typedi"; -import type { LicenseInput, LicenseModel, LicenseUpdate } from "../schema/licenses.schema"; +import type { LicenseInput, LicenseModel, LicenseUpdate } from "../schema/license.schema"; import db from ".."; -import licenseTable, { licenseSchema } from "../schema/licenses.schema"; +import licenseTable, { licenseSchema } from "../schema/license.schema"; import { eq } from "drizzle-orm"; diff --git a/src/db/repo/resource-educational-stages.repo.ts b/src/db/repo/resource-educational-stages.repo.ts index 27169f752d4fc916077e2ccf15e48480b4fcd541..fa6a9a7cd8f9ecf6b280602187c35ff9276d1917 100644 --- a/src/db/repo/resource-educational-stages.repo.ts +++ b/src/db/repo/resource-educational-stages.repo.ts @@ -1,10 +1,10 @@ import { Service } from "typedi"; import db from ".."; import type { ResourceModel } from "../schema/resource.schema"; -import type { EducationalStagesModel } from "../schema/educational-stages.schema"; -import resourceEducationalStagesTable from "../schema/resource-educational-stages.schema"; +import type { EducationalStagesModel } from "../schema/educational-stage.schema"; +import resourceEducationalStagesTable from "../relations/resource-educational-stage.relation"; import { and, eq, inArray } from "drizzle-orm"; -import educationalStageTable from "../schema/educational-stages.schema"; +import educationalStageTable from "../schema/educational-stage.schema"; import resourceTable from "../schema/resource.schema"; diff --git a/src/db/repo/resource-language.repo.ts b/src/db/repo/resource-language.repo.ts index 630581eba51f640d05b6a492ef44ae213cd7ea6b..a03ce233f8dba83b061077267f800db6e87159b1 100644 --- a/src/db/repo/resource-language.repo.ts +++ b/src/db/repo/resource-language.repo.ts @@ -1,7 +1,7 @@ import { Service } from "typedi"; import db from ".."; import type { ResourceModel } from "../schema/resource.schema"; -import resourceLanguagesTable from "../schema/resource-languages.schema"; +import resourceLanguagesTable from "../relations/resource-language.relation"; import type { LanguageModel } from "../schema/language.schema"; import languageTable from "../schema/language.schema"; import { and, eq, inArray } from "drizzle-orm"; diff --git a/src/db/repo/resource-subjects.repo.ts b/src/db/repo/resource-subjects.repo.ts index c3a4e6b7ddd2f542d6e109a6b5a3d9ceefc35711..5108f3909f04ba7846b4bf6afae716d0219d6440 100644 --- a/src/db/repo/resource-subjects.repo.ts +++ b/src/db/repo/resource-subjects.repo.ts @@ -1,10 +1,10 @@ import { Service } from "typedi"; import db from ".."; -import resourceSubjectsTable from "../schema/resource-subjects.schema"; +import resourceSubjectsTable from "../relations/resource-subject.relation"; import { and, eq, inArray } from "drizzle-orm"; import type { ResourceModel } from "../schema/resource.schema"; -import type { SubjectModel } from "../schema/subjects.schema"; -import subjectsTable from "../schema/subjects.schema"; +import type { SubjectModel } from "../schema/subject.schema"; +import subjectsTable from "../schema/subject.schema"; import resourceTable from "../schema/resource.schema"; diff --git a/src/db/repo/role.repo.ts b/src/db/repo/role.repo.ts index 84a65fe4c40dc696410c4e23379912b0edd4067d..d153c9122fcdca11bbd783728e7c122b40e3fffb 100644 --- a/src/db/repo/role.repo.ts +++ b/src/db/repo/role.repo.ts @@ -1,7 +1,7 @@ import { Service } from "typedi"; -import type { RoleInput, RoleModel, RoleUpdate } from "../schema/roles.schema"; +import type { RoleInput, RoleModel, RoleUpdate } from "../schema/role.schema"; import db from ".."; -import roleTable, { roleSchemas } from "../schema/roles.schema"; +import roleTable, { roleSchemas } from "../schema/role.schema"; import { eq } from "drizzle-orm"; import { z } from "zod"; diff --git a/src/db/repo/stats-resources.repo.ts b/src/db/repo/stats-resources.repo.ts index f199c601a65d38197b2e24a94c6418fbca016b0b..ed929412d8d4ce7a6d63a41f757856b11d695030 100644 --- a/src/db/repo/stats-resources.repo.ts +++ b/src/db/repo/stats-resources.repo.ts @@ -1,86 +1,86 @@ import { Service } from "typedi"; import db from '..' -import statsResourcesTable, { statsResourcesSchema, type StatsResourcesInput, type StatsResourcesModel, type StatsResourcesUpdate } from "../schema/stats-resources.schema"; +import resourceStatsTable, { resourceStatsSchema, type ResourceStatsInput, type ResourceStatsModel, type ResourceStatsUpdate } from "../schema/resource-stats.schema"; import { eq } from 'drizzle-orm' import { sql } from "drizzle-orm"; @Service() export class statsResourceRepo { - async create(statsResource: StatsResourcesInput - ): Promise<StatsResourcesModel> { + async create(statsResource: ResourceStatsInput + ): Promise<ResourceStatsModel> { const [ret] = await db - .insert(statsResourcesTable) + .insert(resourceStatsTable) .values(statsResource) .returning() - return statsResourcesSchema.model.parse(ret) + return resourceStatsSchema.model.parse(ret) } - async update(statsResource: StatsResourcesUpdate): Promise<StatsResourcesModel> { + async update(statsResource: ResourceStatsUpdate): Promise<ResourceStatsModel> { const [ret] = await db - .update(statsResourcesTable) + .update(resourceStatsTable) .set(statsResource) - .where(eq(statsResourcesTable.resource_id, statsResource.resource_id)) + .where(eq(resourceStatsTable.resource_id, statsResource.resource_id)) .returning() - return statsResourcesSchema.model.parse(ret) + return resourceStatsSchema.model.parse(ret) } - async sharesUpdate(resource_id: StatsResourcesModel['resource_id']): Promise<StatsResourcesModel> { + async sharesUpdate(resource_id: ResourceStatsModel['resource_id']): Promise<ResourceStatsModel> { const [ret] = await db - .update(statsResourcesTable) + .update(resourceStatsTable) .set({ - shares: sql`${statsResourcesTable.shares} + 1` // Incrementa diretamente no SQL + shares: sql`${resourceStatsTable.shares} + 1` // Incrementa diretamente no SQL }) - .where(eq(statsResourcesTable.resource_id, resource_id)) + .where(eq(resourceStatsTable.resource_id, resource_id)) .returning(); - return statsResourcesSchema.model.parse(ret) + return resourceStatsSchema.model.parse(ret) } - async viewUpdate(resource_id: StatsResourcesModel['resource_id']): Promise<StatsResourcesModel> { + async viewUpdate(resource_id: ResourceStatsModel['resource_id']): Promise<ResourceStatsModel> { const [ret] = await db - .update(statsResourcesTable) + .update(resourceStatsTable) .set({ - views: sql`${statsResourcesTable.views} + 1` // Incrementa diretamente no SQL + views: sql`${resourceStatsTable.views} + 1` // Incrementa diretamente no SQL }) - .where(eq(statsResourcesTable.resource_id, resource_id)) + .where(eq(resourceStatsTable.resource_id, resource_id)) .returning(); - return statsResourcesSchema.model.parse(ret) + return resourceStatsSchema.model.parse(ret) } - async downloadUpdate(resource_id: StatsResourcesModel['resource_id']): Promise<StatsResourcesModel> { + async downloadUpdate(resource_id: ResourceStatsModel['resource_id']): Promise<ResourceStatsModel> { const [ret] = await db - .update(statsResourcesTable) + .update(resourceStatsTable) .set({ - downloads: sql`${statsResourcesTable.downloads} + 1` // Incrementa diretamente no SQL + downloads: sql`${resourceStatsTable.downloads} + 1` // Incrementa diretamente no SQL }) - .where(eq(statsResourcesTable.resource_id, resource_id)) + .where(eq(resourceStatsTable.resource_id, resource_id)) .returning(); - return statsResourcesSchema.model.parse(ret) + return resourceStatsSchema.model.parse(ret) } - async delete(id: StatsResourcesModel['id']): Promise<StatsResourcesModel> { + async delete(id: ResourceStatsModel['id']): Promise<ResourceStatsModel> { const [ret] = await db - .delete(statsResourcesTable) - .where(eq(statsResourcesTable.id, id)) + .delete(resourceStatsTable) + .where(eq(resourceStatsTable.id, id)) .returning() - return statsResourcesSchema.model.parse(ret) + return resourceStatsSchema.model.parse(ret) } - async find(id: StatsResourcesModel['id']): Promise<StatsResourcesModel | undefined> { - const statsResource = await db.query.statsResourcesTable.findFirst({ - where: eq(statsResourcesTable.id, id), + async find(id: ResourceStatsModel['id']): Promise<ResourceStatsModel | undefined> { + const statsResource = await db.query.resourceStatsTable.findFirst({ + where: eq(resourceStatsTable.id, id), }) - return statsResourcesSchema.model.parse(statsResource) + return resourceStatsSchema.model.parse(statsResource) } - async findMany(): Promise<StatsResourcesModel[]> { + async findMany(): Promise<ResourceStatsModel[]> { - return statsResourcesSchema.model.array().parse(await db.query.statsResourcesTable.findMany()) + return resourceStatsSchema.model.array().parse(await db.query.resourceStatsTable.findMany()) } } \ No newline at end of file diff --git a/src/db/repo/subjects.repo.ts b/src/db/repo/subjects.repo.ts index 1ad4087786656ad17ade079df451f53eed7585dc..16b32c98fcac7b5a1b0852966fa0ddd503116de8 100644 --- a/src/db/repo/subjects.repo.ts +++ b/src/db/repo/subjects.repo.ts @@ -1,7 +1,7 @@ import { Service } from "typedi"; -import {type SubjectInput, type SubjectModel, type SubjectUpdate} from "../schema/subjects.schema"; +import {type SubjectInput, type SubjectModel, type SubjectUpdate} from "../schema/subject.schema"; import db from ".."; -import subjectsTable, { subjectSchema } from "../schema/subjects.schema"; +import subjectsTable, { subjectSchema } from "../schema/subject.schema"; import { eq } from "drizzle-orm"; @Service() diff --git a/src/db/repo/user-achievements.repo.ts b/src/db/repo/user-achievements.repo.ts index b9057c28b80540c7c75d7d6954233dc0ea9ab871..06f63cbedafccdca46089a2807b5d14909dabee2 100644 --- a/src/db/repo/user-achievements.repo.ts +++ b/src/db/repo/user-achievements.repo.ts @@ -3,7 +3,7 @@ import type { UserModel } from "../schema/user.schema"; import db from ".."; import { achievementTable, userAchievementsTable, userTable } from "../schema"; import { and, eq, inArray } from "drizzle-orm"; -import type { AchievementModel } from "../schema/achievements.schema"; +import type { AchievementModel } from "../schema/achievement.schema"; @Service() export class userAchievementsRepo { diff --git a/src/db/schema/achievements.schema.ts b/src/db/schema/achievement.schema.ts similarity index 97% rename from src/db/schema/achievements.schema.ts rename to src/db/schema/achievement.schema.ts index b78896d42ae80007780cf417f68f76a48b56675d..4bcc9f9ab02d0ca1f122cffe5a81ab94d2180a00 100644 --- a/src/db/schema/achievements.schema.ts +++ b/src/db/schema/achievement.schema.ts @@ -4,7 +4,7 @@ import { z } from "zod"; const stateEnum = pgEnum('state', ['active', 'inactive', 'under_review']) -const achievementTable = pgTable('achievement', { +const achievementTable = pgTable('achievements', { id: serial('id').primaryKey().notNull().unique(), name: varchar('name', { length: 255 }).notNull(), description: text('description'), diff --git a/src/db/schema/action.schema.ts b/src/db/schema/action.schema.ts index 59f7d1280fd54591e8bbb2935d7eafd48bb2b909..1bf4ecea73225cdd0764ed253f14dfcaad8f92cc 100644 --- a/src/db/schema/action.schema.ts +++ b/src/db/schema/action.schema.ts @@ -3,7 +3,7 @@ import { pgTable, serial, text, timestamp, varchar } from "drizzle-orm/pg-core" import { createInsertSchema, createSelectSchema } from "drizzle-zod" import type { z } from "zod" -const actionTable = pgTable('action', { +const actionTable = pgTable('actions', { id: serial('id').primaryKey() .unique() .notNull(), diff --git a/src/db/schema/collection-stats.schema.ts b/src/db/schema/collection-stats.schema.ts index cec4928ef9b3b30c09315f6479cba5ec2b1a1b5e..b5022022c24e6d264b48f4a5296193095dbbbcae 100644 --- a/src/db/schema/collection-stats.schema.ts +++ b/src/db/schema/collection-stats.schema.ts @@ -5,7 +5,7 @@ import { } from 'drizzle-orm/pg-core' import { createInsertSchema, createSelectSchema } from 'drizzle-zod' import { z } from 'zod' -import collectionTable from './collections.schema' +import collectionTable from './collection.schema' const collectionStatsTable = pgTable('collection_stats', { id: serial('id').primaryKey().notNull().unique(), diff --git a/src/db/schema/collections.schema.ts b/src/db/schema/collection.schema.ts similarity index 96% rename from src/db/schema/collections.schema.ts rename to src/db/schema/collection.schema.ts index 1c544ce2b60aa37c5339ce2c9fe39f2cd18b9fdd..dba310adad5be409b32f833b43a3f51992d44a67 100644 --- a/src/db/schema/collections.schema.ts +++ b/src/db/schema/collection.schema.ts @@ -9,7 +9,7 @@ import { import { createInsertSchema, createSelectSchema } from 'drizzle-zod' import { z } from 'zod' -const collectionTable = pgTable('collection', { +const collectionTable = pgTable('collections', { id: serial('id').primaryKey().notNull().unique(), name: varchar('name', { length: 255 }), description: text('description'), diff --git a/src/db/schema/complaints.schema.ts b/src/db/schema/complaint.schema.ts similarity index 96% rename from src/db/schema/complaints.schema.ts rename to src/db/schema/complaint.schema.ts index 2d685714bb160a0c70247229aef0de0a12f3dfc3..063865220ae06dbbec98f500226388a9d0be6fc1 100644 --- a/src/db/schema/complaints.schema.ts +++ b/src/db/schema/complaint.schema.ts @@ -3,7 +3,7 @@ import userTable from "./user.schema"; import { createInsertSchema, createSelectSchema } from "drizzle-zod"; import type { z } from "zod"; -const complaintTable = pgTable('complaint', { +const complaintTable = pgTable('complaints', { id: serial('id').primaryKey().notNull(), state: integer('state').notNull().default(0), description: text('description').notNull(), diff --git a/src/db/schema/educational-stages.schema.ts b/src/db/schema/educational-stage.schema.ts similarity index 100% rename from src/db/schema/educational-stages.schema.ts rename to src/db/schema/educational-stage.schema.ts diff --git a/src/db/schema/index.ts b/src/db/schema/index.ts index c69e574f7301579e55f1ce6dc06ca39c741bb2d3..1b9bd16a07f8278f0b8e231385380bd961bd2f08 100644 --- a/src/db/schema/index.ts +++ b/src/db/schema/index.ts @@ -1,34 +1,33 @@ import resourceTable from './resource.schema' -import statsResourcesTable from './stats-resources.schema' +import resourceStatsTable from './resource-stats.schema' import collectionStatsTable from './collection-stats.schema' -import collectionTable from './collections.schema' -import subjectsTable from './subjects.schema' +import collectionTable from './collection.schema' +import subjectsTable from './subject.schema' import submissionTable from './submission.schema' -import licenseTable from './licenses.schema' +import licenseTable from './license.schema' import languageTable from './language.schema' -import educationalStageTable from './educational-stages.schema' +import educationalStageTable from './educational-stage.schema' import passwordRecoveryTable, { passwordRecoveryTableRelations } from './password-recovery.schema' import userStatsTable from './user-stats.schema' import userTable from './user.schema' import objectTypeTable from './object-type.schema' -import complaintTable from './complaints.schema' -import resourceSubjectsTable from './resource-subjects.schema' -import achievementTable from './achievements.schema' - -import resourceLanguagesTable from './resource-languages.schema' -import followRelationTable from '../relations/follows.relation' -import roleTable from './roles.schema' -import collectionLikesTable from '../relations/collection-likes.relation' +import complaintTable from './complaint.schema' +import resourceSubjectsTable from '../relations/resource-subject.relation' +import achievementTable from './achievement.schema' +import resourceLanguagesTable from '../relations/resource-language.relation' +import followRelationTable from '../relations/followers.relation' +import roleTable from './role.schema' +import collectionLikesTable from '../relations/collection-like.relation' import userRoleRelationTable from '../relations/user-role.relation' -import collectionResourcesTable from '../relations/collection-resources.relation' -import institutionTable from './institutions.schema' +import collectionResourcesTable from '../relations/collection-resource.relation' +import institutionTable from './institution.schema' import userInstitutionRelationTable from '../relations/user-institution.relation' -import resourceLikesTable from '../relations/resource-likes.relation' -import resourceEducationalStagesTable from './resource-educational-stages.schema' -import itemsTable from './items.schema' -import userAchievementsTable from '../relations/user-achievements.relation' +import resourceLikesTable from '../relations/resource-like.relation' +import resourceEducationalStagesTable from '../relations/resource-educational-stage.relation' +import itemsTable from './item.schema' +import userAchievementsTable from '../relations/user-achievement.relation' import actionTable from './action.schema' import notificationRelationTable from '../relations/notification.relation' import userItemRelationTable from '../relations/user-item.relation' @@ -38,7 +37,7 @@ export { userStatsTable, resourceTable, collectionTable, - statsResourcesTable, + resourceStatsTable, collectionStatsTable, subjectsTable, submissionTable, @@ -73,7 +72,7 @@ export const tables = [ passwordRecoveryTable, userStatsTable, resourceTable, - statsResourcesTable, + resourceStatsTable, collectionTable, collectionStatsTable, subjectsTable, diff --git a/src/db/schema/institutions.schema.ts b/src/db/schema/institution.schema.ts similarity index 96% rename from src/db/schema/institutions.schema.ts rename to src/db/schema/institution.schema.ts index 3201cc50ccb95b83b96a0442b4167b4b3c2338d2..b61b94992b13234a5c3bf723c1d9dfc3c4d9b40a 100644 --- a/src/db/schema/institutions.schema.ts +++ b/src/db/schema/institution.schema.ts @@ -3,7 +3,7 @@ import { pgTable, serial, timestamp, varchar } from "drizzle-orm/pg-core"; import { createInsertSchema, createSelectSchema } from "drizzle-zod"; import type { z } from "zod"; -const institutionTable = pgTable('institution', { +const institutionTable = pgTable('institutions', { id: serial('id').primaryKey() .unique() .notNull(), diff --git a/src/db/schema/items.schema.ts b/src/db/schema/item.schema.ts similarity index 96% rename from src/db/schema/items.schema.ts rename to src/db/schema/item.schema.ts index 3694d7a01aa45620fbfd63d85c5cebec0b3d1d9c..2314e1fb57af33b2733d5c8816eb40ab197f4c9e 100644 --- a/src/db/schema/items.schema.ts +++ b/src/db/schema/item.schema.ts @@ -1,6 +1,6 @@ import { boolean, serial, timestamp, varchar } from "drizzle-orm/pg-core"; import { integer, numeric, pgTable } from "drizzle-orm/pg-core"; -import achievementTable from "./achievements.schema"; +import achievementTable from "./achievement.schema"; import { createInsertSchema, createSelectSchema } from "drizzle-zod"; import type { z } from "zod"; import { sql } from "drizzle-orm"; diff --git a/src/db/schema/language.schema.ts b/src/db/schema/language.schema.ts index b51ca14318848811c3de5894e21ac99ae18de4ca..28d28b2476e235d07604c2829cfd9039b918ef22 100644 --- a/src/db/schema/language.schema.ts +++ b/src/db/schema/language.schema.ts @@ -2,10 +2,10 @@ import { relations } from "drizzle-orm"; import { pgTable, serial,varchar } from "drizzle-orm/pg-core"; import { createInsertSchema, createSelectSchema } from "drizzle-zod"; import type { z } from 'zod' -import resourceLanguagesTable from "./resource-languages.schema"; +import resourceLanguagesTable from "../relations/resource-language.relation"; -const languageTable = pgTable('language', { +const languageTable = pgTable('languages', { id: serial('id').primaryKey().unique(), name: varchar('name').notNull().unique(), code: varchar('code').notNull().unique() diff --git a/src/db/schema/licenses.schema.ts b/src/db/schema/license.schema.ts similarity index 100% rename from src/db/schema/licenses.schema.ts rename to src/db/schema/license.schema.ts diff --git a/src/db/schema/password-recovery.schema.ts b/src/db/schema/password-recovery.schema.ts index 2eb90972a7ce94ac1a73bc4bfb1de7f86aa576c0..1a2c79c3bc3b7691d74de6b9210e69232bb5ffb3 100644 --- a/src/db/schema/password-recovery.schema.ts +++ b/src/db/schema/password-recovery.schema.ts @@ -4,7 +4,7 @@ import userTable from "./user.schema"; import { createInsertSchema, createSelectSchema } from "drizzle-zod"; import type { z } from "zod"; -const passwordRecoveryTable = pgTable('reset_ticket',{ +const passwordRecoveryTable = pgTable('reset_tickets',{ id: serial('id').primaryKey() .unique() .notNull(), diff --git a/src/db/schema/resource-stats.schema.ts b/src/db/schema/resource-stats.schema.ts new file mode 100644 index 0000000000000000000000000000000000000000..0e7d1eb2621c9af1e07cd2b23e2e96c05b376ce1 --- /dev/null +++ b/src/db/schema/resource-stats.schema.ts @@ -0,0 +1,39 @@ +import { + pgTable, + serial, + bigint +} from 'drizzle-orm/pg-core' +import resourceTable from './resource.schema' +import { createInsertSchema, createSelectSchema } from 'drizzle-zod' +import type { z } from 'zod' + + +const resourceStatsTable = pgTable('resource_stats', { + id: serial('id').notNull().primaryKey().unique(), + resource_id: bigint('resource_id', {mode: 'number'}).notNull().references(() => resourceTable.id, {onDelete: 'cascade'}), + views: bigint('views', {mode: 'number'}).notNull().default(0), + downloads: bigint('downloads', {mode: 'number'}).notNull().default(0), + shares: bigint('shares', {mode: 'number'}).notNull().default(0), + score: bigint('score', {mode: 'number'}).notNull().default(0) +}) + +const resourceStatsModelSchema = createSelectSchema(resourceStatsTable) +const resourceStatsDtoSchema = resourceStatsModelSchema.omit({}) +const resourceStatsInputSchema = createInsertSchema(resourceStatsTable) +const resourceStatsUpdateSchema = resourceStatsInputSchema + .partial() + .required({ resource_id: true }) + +export type ResourceStatsModel = z.infer<typeof resourceStatsModelSchema> +export type ResourceStatsDto = z.infer<typeof resourceStatsDtoSchema> +export type ResourceStatsInput = z.infer<typeof resourceStatsInputSchema> +export type ResourceStatsUpdate = z.infer<typeof resourceStatsUpdateSchema> + +export const resourceStatsSchema = { + model: resourceStatsModelSchema, + dto: resourceStatsDtoSchema, + input: resourceStatsInputSchema, + update: resourceStatsUpdateSchema, +} + +export default resourceStatsTable diff --git a/src/db/schema/resource.schema.ts b/src/db/schema/resource.schema.ts index 1971ee5c50ca0c2b43fd56f5fc263b6c6e923f73..dd88b01ae1051b3afef842a1b063fc0870f48372 100644 --- a/src/db/schema/resource.schema.ts +++ b/src/db/schema/resource.schema.ts @@ -8,12 +8,12 @@ import { import { relations, sql } from 'drizzle-orm' import { createInsertSchema, createSelectSchema } from 'drizzle-zod' import type { z } from 'zod' -import resourceLanguagesTable from './resource-languages.schema' -import resourceSubjectsTable from './resource-subjects.schema' -import resourceEducationalStagesTable from './resource-educational-stages.schema' +import resourceLanguagesTable from '../relations/resource-language.relation' +import resourceSubjectsTable from '../relations/resource-subject.relation' +import resourceEducationalStagesTable from '../relations/resource-educational-stage.relation' //por padrao active é false, só é true quando o recurso é aprovado -const resourceTable = pgTable('resource', { +const resourceTable = pgTable('resources', { id: serial('id').notNull().primaryKey().unique(), name: varchar('name', { length: 256 }).notNull(), author: varchar('author', { length: 256 }).notNull(), diff --git a/src/db/schema/roles.schema.ts b/src/db/schema/role.schema.ts similarity index 97% rename from src/db/schema/roles.schema.ts rename to src/db/schema/role.schema.ts index b82116434dc439230628c4befabefbf178f5c085..9fe2ac880cbd5cf1b534199816c75d9bbff1ff88 100644 --- a/src/db/schema/roles.schema.ts +++ b/src/db/schema/role.schema.ts @@ -3,7 +3,7 @@ import { pgTable, serial, text, timestamp, varchar } from "drizzle-orm/pg-core" import { createInsertSchema, createSelectSchema } from "drizzle-zod" import type { z } from "zod" -const roleTable = pgTable('role', { +const roleTable = pgTable('roles', { id: serial('id').primaryKey() .unique() .notNull(), diff --git a/src/db/schema/stats-resources.schema.ts b/src/db/schema/stats-resources.schema.ts deleted file mode 100644 index 1d586b9d4640a9a93be5a1ef3a6e988a401ce3d4..0000000000000000000000000000000000000000 --- a/src/db/schema/stats-resources.schema.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { - pgTable, - serial, - bigint -} from 'drizzle-orm/pg-core' -import resourceTable from './resource.schema' -import { createInsertSchema, createSelectSchema } from 'drizzle-zod' -import type { z } from 'zod' - - -const statsResourcesTable = pgTable('stats_resources', { - id: serial('id').notNull().primaryKey().unique(), - resource_id: bigint('resource_id', {mode: 'number'}).notNull().references(() => resourceTable.id, {onDelete: 'cascade'}), - views: bigint('views', {mode: 'number'}).notNull().default(0), - downloads: bigint('downloads', {mode: 'number'}).notNull().default(0), - shares: bigint('shares', {mode: 'number'}).notNull().default(0), - score: bigint('score', {mode: 'number'}).notNull().default(0) -}) - -const statsResourcesModelSchema = createSelectSchema(statsResourcesTable) -const statsResourcesDtoSchema = statsResourcesModelSchema.omit({}) -const statsResourcesInputSchema = createInsertSchema(statsResourcesTable) -const statsResourcesUpdateSchema = statsResourcesInputSchema - .partial() - .required({ resource_id: true }) - -export type StatsResourcesModel = z.infer<typeof statsResourcesModelSchema> -export type StatsResourcesDto = z.infer<typeof statsResourcesDtoSchema> -export type StatsResourcesInput = z.infer<typeof statsResourcesInputSchema> -export type StatsResourcesUpdate = z.infer<typeof statsResourcesUpdateSchema> - -export const statsResourcesSchema = { - model: statsResourcesModelSchema, - dto: statsResourcesDtoSchema, - input: statsResourcesInputSchema, - update: statsResourcesUpdateSchema, -} - -export default statsResourcesTable diff --git a/src/db/schema/subjects.schema.ts b/src/db/schema/subject.schema.ts similarity index 100% rename from src/db/schema/subjects.schema.ts rename to src/db/schema/subject.schema.ts diff --git a/src/db/schema/submission.schema.ts b/src/db/schema/submission.schema.ts index 2717182aeaa973ff54ed049e96792daff7f9eee7..03eb63b6ce980db92d44569745952a852808b3c6 100644 --- a/src/db/schema/submission.schema.ts +++ b/src/db/schema/submission.schema.ts @@ -4,7 +4,7 @@ import type { z } from "zod"; import resourceTable from "./resource.schema"; import userTable from "./user.schema"; -const submissionTable = pgTable('submission', { +const submissionTable = pgTable('submissions', { id: serial('id').primaryKey().notNull(), is_accepted: boolean('is_accepted').default(false).notNull(), justification: text('justification'), diff --git a/src/db/schema/user.schema.ts b/src/db/schema/user.schema.ts index caac90e0ac7730951e74bb5f3ef6d878347ef910..7c5fdb3908e91392e603d335fb470fa96580200f 100644 --- a/src/db/schema/user.schema.ts +++ b/src/db/schema/user.schema.ts @@ -4,9 +4,9 @@ import { createInsertSchema, createSelectSchema } from 'drizzle-zod' import { z } from 'zod' import userStatsTable from './user-stats.schema' import passwordRecoveryTable from './password-recovery.schema' -import achievementTable from './achievements.schema' +import userAchievementsTable from '../relations/user-achievement.relation' -const userTable = pgTable('user', { +const userTable = pgTable('users', { id: serial('id').primaryKey() .unique() .notNull(), @@ -62,7 +62,9 @@ const userInputSchema = createInsertSchema(userTable) username: true, password: true, email: true, - birthday: true + birthday: true, + cpf: true, + user_stats_id: true }) const userModelSchema = createSelectSchema(userTable) const userDtoSchema = createSelectSchema(userTable).omit({ diff --git a/src/db/seed.ts b/src/db/seed.ts index 99d3ff9c18013a0ef7decbddce81c65334b29003..fad4420ae27cb9e15919a38b3e4fd53748aa416d 100644 --- a/src/db/seed.ts +++ b/src/db/seed.ts @@ -24,7 +24,7 @@ for (const table of schema.tables) { await seeds.userStatsSeed(db) await seeds.userSeed(db) await seeds.resourceSeed(db) -await seeds.statsResourcesSeed(db) +await seeds.resourceStatsSeed(db) await seeds.collectionSeed(db) await seeds.collectionStatsSeed(db) await seeds.subjectsData(db) diff --git a/src/db/seeds/achievement.seed.ts b/src/db/seeds/achievement.seed.ts index 5ca8158abb7c1114b4f757ff1e7c8a7656d58bc8..7fc5bec01ecc671f1f11b7d4967c6707b3205e3f 100644 --- a/src/db/seeds/achievement.seed.ts +++ b/src/db/seeds/achievement.seed.ts @@ -1,6 +1,6 @@ import type db from ".."; import { achievementTable } from "../schema"; -import type { AchievementInput } from "../schema/achievements.schema"; +import type { AchievementInput } from "../schema/achievement.schema"; export default async function seed(db: db) { await db.insert(achievementTable).values(achievementData) diff --git a/src/db/seeds/collection-likes.seed.ts b/src/db/seeds/collection-likes.seed.ts index 755b40d183bee663a6e02d267c26b73677c36f07..5df379f7d68f3729f46523bed10553cbf7603041 100644 --- a/src/db/seeds/collection-likes.seed.ts +++ b/src/db/seeds/collection-likes.seed.ts @@ -1,5 +1,5 @@ import type db from ".."; -import type { CollectionLikesInput } from "../relations/collection-likes.relation"; +import type { CollectionLikesInput } from "../relations/collection-like.relation"; import { collectionLikesTable } from "../schema"; export default async function seed(db: db) { diff --git a/src/db/seeds/collection-resources.seed.ts b/src/db/seeds/collection-resources.seed.ts index 215175782f1f0472a04c692ca4f101132fcb5556..fb766db3f1d1f8f7ef71231e08923239aa517f20 100644 --- a/src/db/seeds/collection-resources.seed.ts +++ b/src/db/seeds/collection-resources.seed.ts @@ -1,5 +1,5 @@ import type db from ".."; -import type { CollectionResourcesInput } from "../relations/collection-resources.relation"; +import type { CollectionResourcesInput } from "../relations/collection-resource.relation"; import { collectionResourcesTable } from "../schema"; diff --git a/src/db/seeds/collections.seed.ts b/src/db/seeds/collections.seed.ts index c2446a45e64c84d9abf5b8130f79526f3ab6340c..e5fce56f4b94da88fbe70ffeb71cc8f60c1e3a28 100644 --- a/src/db/seeds/collections.seed.ts +++ b/src/db/seeds/collections.seed.ts @@ -1,6 +1,6 @@ import type db from '..' -import type { CollectionInput } from '../schema/collections.schema' -import collectionTable from '../schema/collections.schema' +import type { CollectionInput } from '../schema/collection.schema' +import collectionTable from '../schema/collection.schema' export default async function seed(db:db) { await db.insert(collectionTable).values(collectionData) diff --git a/src/db/seeds/complaints.seed.ts b/src/db/seeds/complaints.seed.ts index ff87a661f452dadd64f90959a5c96b5fb455a209..3fe32e2de68537d69aa4c25409e2dc63da7ebc08 100644 --- a/src/db/seeds/complaints.seed.ts +++ b/src/db/seeds/complaints.seed.ts @@ -1,7 +1,7 @@ import type db from ".."; import { complaintTable } from "../schema"; -import type { ComplaintInput } from "../schema/complaints.schema"; +import type { ComplaintInput } from "../schema/complaint.schema"; export default async function seed(db: db){ await db.insert(complaintTable).values(complaintData) diff --git a/src/db/seeds/educational-stage.seed.ts b/src/db/seeds/educational-stage.seed.ts index 03c4f8b3543522d2979ab6178ba03a722defa5a6..ae3e79ad4c850f1ffc4e3d718ec0774b3446df2c 100644 --- a/src/db/seeds/educational-stage.seed.ts +++ b/src/db/seeds/educational-stage.seed.ts @@ -1,6 +1,6 @@ import type db from ".."; import { educationalStageTable } from "../schema"; -import type { EducationalStagesInput } from "../schema/educational-stages.schema"; +import type { EducationalStagesInput } from "../schema/educational-stage.schema"; export default async function seed(db: db) { diff --git a/src/db/seeds/index.ts b/src/db/seeds/index.ts index 0e6a1758f8d01904909189b713b5c5495b052bc2..dcf31d806de05314f29237c043982ce836759537 100644 --- a/src/db/seeds/index.ts +++ b/src/db/seeds/index.ts @@ -1,7 +1,7 @@ export { default as userSeed } from './user.seed' export { default as userStatsSeed } from './user-stats.seed' export { default as resourceSeed } from './resource.seed' -export { default as statsResourcesSeed } from './statsResources.seed' +export { default as resourceStatsSeed } from './resourceStats.seed' export { default as collectionSeed } from './collections.seed' export { default as collectionStatsSeed } from './collection-stats.seed' export { default as subjectsData } from './subjects.seed' diff --git a/src/db/seeds/institutions.seed.ts b/src/db/seeds/institutions.seed.ts index 34304e23083bb2abb5751ae148ff1e1426b8faba..6af0fbd78cb5a7dea97dc69c99f0e12e9ffc521e 100644 --- a/src/db/seeds/institutions.seed.ts +++ b/src/db/seeds/institutions.seed.ts @@ -1,6 +1,6 @@ import type db from ".."; import { institutionTable } from "../schema"; -import type { InstitutionInput } from "../schema/institutions.schema"; +import type { InstitutionInput } from "../schema/institution.schema"; export default async function seed(db: db) { diff --git a/src/db/seeds/items.seed.ts b/src/db/seeds/items.seed.ts index 779a0893ccbf6c507c2d353769c2c275975cb0c7..e77a8a9b48ff3aa4875acae8eb883187af737985 100644 --- a/src/db/seeds/items.seed.ts +++ b/src/db/seeds/items.seed.ts @@ -1,6 +1,6 @@ import type db from ".."; import { itemsTable } from "../schema"; -import type { ItemsInput } from "../schema/items.schema"; +import type { ItemsInput } from "../schema/item.schema"; export default async function seed(db: db) { diff --git a/src/db/seeds/license.seed.ts b/src/db/seeds/license.seed.ts index d2fbe03c486fbd4962cc19ccf0af6831e42056f0..ea4fe3a82358daa477f8af85310a77754fb80169 100644 --- a/src/db/seeds/license.seed.ts +++ b/src/db/seeds/license.seed.ts @@ -1,6 +1,6 @@ import type db from ".."; import { licenseTable } from "../schema"; -import type { LicenseInput } from "../schema/licenses.schema"; +import type { LicenseInput } from "../schema/license.schema"; export default async function seed(db: db) { diff --git a/src/db/seeds/resource-educational-stages.seed.ts b/src/db/seeds/resource-educational-stages.seed.ts index 29e03d9218a072973a2f9ce43bb72c8d0d8240a2..d3e274ba7ce97e003d3dc5e590603d4577f2ae36 100644 --- a/src/db/seeds/resource-educational-stages.seed.ts +++ b/src/db/seeds/resource-educational-stages.seed.ts @@ -1,5 +1,5 @@ import type db from ".."; -import resourceEducationalStagesTable, { type ResourceEducationalStagesInput } from "../schema/resource-educational-stages.schema"; +import resourceEducationalStagesTable, { type ResourceEducationalStagesInput } from "../relations/resource-educational-stage.relation"; export default async function seed(db: db) { await db.insert(resourceEducationalStagesTable).values(resourceEducationalStagesData); diff --git a/src/db/seeds/resource-language.seed.ts b/src/db/seeds/resource-language.seed.ts index fbb6bf03edca296926e0f6fdb375218cc7435dc0..d76927dfc567e3164fcc0d72b64dae5f85a5c4be 100644 --- a/src/db/seeds/resource-language.seed.ts +++ b/src/db/seeds/resource-language.seed.ts @@ -1,6 +1,6 @@ import type db from '@/db'; import { resourceLanguagesTable } from '../schema'; -import type { ResourceLanguagesInput } from '../schema/resource-languages.schema'; +import type { ResourceLanguagesInput } from '../relations/resource-language.relation'; export default async function seed(db: db) { diff --git a/src/db/seeds/resource-likes.seed.ts b/src/db/seeds/resource-likes.seed.ts index f5d673b41b50145254e0e8fc1af4ae96a5677214..8a9a80adf5b050d6ab9c1efc7a097ecd707007c5 100644 --- a/src/db/seeds/resource-likes.seed.ts +++ b/src/db/seeds/resource-likes.seed.ts @@ -1,5 +1,5 @@ import type db from ".."; -import type { ResourceLikesInput } from "../relations/resource-likes.relation"; +import type { ResourceLikesInput } from "../relations/resource-like.relation"; import { resourceLikesTable } from "../schema"; export default async function seed(db: db) { diff --git a/src/db/seeds/resource-subjects.seed.ts b/src/db/seeds/resource-subjects.seed.ts index 73afff087df3922cca23c9699e33c2850902de27..893cde7195196ddc1f2dac638407582dc1beedc6 100644 --- a/src/db/seeds/resource-subjects.seed.ts +++ b/src/db/seeds/resource-subjects.seed.ts @@ -1,6 +1,6 @@ import type db from ".."; -import type { ResourceSubjectsInput } from "../schema/resource-subjects.schema"; -import resourceSubjectsTable from "../schema/resource-subjects.schema"; +import type { ResourceSubjectsInput } from "../relations/resource-subject.relation"; +import resourceSubjectsTable from "../relations/resource-subject.relation"; export default async function seed(db: db) { diff --git a/src/db/seeds/statsResources.seed.ts b/src/db/seeds/resourceStats.seed.ts similarity index 55% rename from src/db/seeds/statsResources.seed.ts rename to src/db/seeds/resourceStats.seed.ts index cf324dd47c0ca8f95e4e8fd4441011ed8985d398..874752c7ca9d2807943a03c19e03d4979d7274fd 100644 --- a/src/db/seeds/statsResources.seed.ts +++ b/src/db/seeds/resourceStats.seed.ts @@ -1,13 +1,13 @@ import type db from '@/db' -import { statsResourcesTable } from '../schema' -import type { StatsResourcesInput } from '../schema/stats-resources.schema' +import { resourceStatsTable } from '../schema' +import type { ResourceStatsInput } from '../schema/resource-stats.schema' export default async function seed(db: db) { - await db.insert(statsResourcesTable).values(statsResourceData) + await db.insert(resourceStatsTable).values(statsResourceData) } -const statsResourceData: StatsResourcesInput[] = [ +const statsResourceData: ResourceStatsInput[] = [ { resource_id: 1, views: 0, diff --git a/src/db/seeds/role.seed.ts b/src/db/seeds/role.seed.ts index 244882ad2f97cc9f56ef436bebf6f8551e69935e..1c3521533a3661e52cc243b62d15e2581aeb3bd4 100644 --- a/src/db/seeds/role.seed.ts +++ b/src/db/seeds/role.seed.ts @@ -1,5 +1,5 @@ import type db from "@/db"; -import roleTable, { type RoleInput } from "../schema/roles.schema"; +import roleTable, { type RoleInput } from "../schema/role.schema"; export default async function seed(db: db) { await db.insert(roleTable).values(rolesData) diff --git a/src/db/seeds/subjects.seed.ts b/src/db/seeds/subjects.seed.ts index 80a1ffd235ce3a81f006fed6117ae032d429ce45..5e8e10203d387ed3b6c81bd82335aacee2df1cb8 100644 --- a/src/db/seeds/subjects.seed.ts +++ b/src/db/seeds/subjects.seed.ts @@ -1,6 +1,6 @@ import type db from ".."; -import type { SubjectInput } from "../schema/subjects.schema"; -import subjectsTable from "../schema/subjects.schema"; +import type { SubjectInput } from "../schema/subject.schema"; +import subjectsTable from "../schema/subject.schema"; export default async function seed(db:db) { await db.insert(subjectsTable).values(subjectsData) diff --git a/src/db/seeds/user-achievements.seed.ts b/src/db/seeds/user-achievements.seed.ts index 523eae0d88a2d10922dba284435d2b9afc90c6b8..fbd74a92bc2022a02819035d45dbf3f95a1ee1c1 100644 --- a/src/db/seeds/user-achievements.seed.ts +++ b/src/db/seeds/user-achievements.seed.ts @@ -1,5 +1,5 @@ import type db from ".."; -import type { UserAchievementsInput } from "../relations/user-achievements.relation"; +import type { UserAchievementsInput } from "../relations/user-achievement.relation"; import { userAchievementsTable } from "../schema"; export default async function seed(db: db) { diff --git a/src/routes/achievement.route.ts b/src/routes/achievement.route.ts index c0351897bdba79f790f1d9a28b466addccb91c1b..90a8e66095d5beddb45b1d5c2e839bc37a51df1c 100644 --- a/src/routes/achievement.route.ts +++ b/src/routes/achievement.route.ts @@ -2,7 +2,7 @@ import { AchievementService } from "@/services/achievement.service"; import Container, { ContainerInstance } from "typedi"; import { honoWithJwt } from ".."; import { zValidator } from "@hono/zod-validator"; -import { achievementSchemas } from "@/db/schema/achievements.schema"; +import { achievementSchemas } from "@/db/schema/achievement.schema"; import { createApexError, HttpStatus } from "@/services/error.service"; import { Hono } from "hono"; diff --git a/src/routes/collections.route.ts b/src/routes/collections.route.ts index f39ae5d5820c53628f8c63812f7bb787aa1d1c14..effe7fa70ecef455074025168b5e5a5c75d3fa33 100644 --- a/src/routes/collections.route.ts +++ b/src/routes/collections.route.ts @@ -2,7 +2,7 @@ import { CollectionsService } from "@/services/collections.service"; import Container from "typedi"; import { honoWithJwt } from ".."; import { zValidator } from "@hono/zod-validator"; -import { collectionSchemas } from "@/db/schema/collections.schema"; +import { collectionSchemas } from "@/db/schema/collection.schema"; import { createApexError, HttpStatus } from "@/services/error.service"; import { Hono } from "hono"; import { collectionStatsSchemas } from "@/db/schema/collection-stats.schema"; diff --git a/src/routes/complaints.route.ts b/src/routes/complaints.route.ts index 149903fcc60bb071ce3556b26cc7cc4206499d5c..637e724b8cc6b599ec959dd1a32f3fc96759c1b0 100644 --- a/src/routes/complaints.route.ts +++ b/src/routes/complaints.route.ts @@ -1,7 +1,7 @@ import { ComplaintService } from "@/services/complaints.service"; import Container from "typedi"; import { honoWithJwt } from ".."; -import { complaintSchemas } from "@/db/schema/complaints.schema"; +import { complaintSchemas } from "@/db/schema/complaint.schema"; import { zValidator } from "@hono/zod-validator"; import { createApexError, HttpStatus } from "@/services/error.service"; diff --git a/src/routes/educational-stage.routes.ts b/src/routes/educational-stage.routes.ts index 26947aab93a9ad87a1bd75776b4b729967a8ec01..e01e27c89010c2bde6cca6cebda431b3f4a18da9 100644 --- a/src/routes/educational-stage.routes.ts +++ b/src/routes/educational-stage.routes.ts @@ -2,7 +2,7 @@ import { EducationalStageService } from "@/services/educational-stage.service"; import Container from "typedi"; import { honoWithJwt } from ".."; import { zValidator } from "@hono/zod-validator"; -import { educationalStageSchema } from "@/db/schema/educational-stages.schema"; +import { educationalStageSchema } from "@/db/schema/educational-stage.schema"; import { createApexError, HttpStatus } from "@/services/error.service"; import { Hono } from "hono"; diff --git a/src/routes/institution.route.ts b/src/routes/institution.route.ts index d6e5429be6bbde68ce1a1a5ea6ab837c2dc9ec3a..ef4fd30181aa8e01c2e4d39e631063321d216c09 100644 --- a/src/routes/institution.route.ts +++ b/src/routes/institution.route.ts @@ -2,7 +2,7 @@ import { InstitutionService } from "@/services/institution.service"; import Container from "typedi"; import { honoWithJwt } from ".."; import { zValidator } from "@hono/zod-validator"; -import { institutionSchemas } from "@/db/schema/institutions.schema"; +import { institutionSchemas } from "@/db/schema/institution.schema"; import { createApexError, HttpStatus } from "@/services/error.service"; import { z } from "zod"; diff --git a/src/routes/items.route.ts b/src/routes/items.route.ts index 83977e0f6056c73e86a5739ec797b9a736186c03..910e267d5fbf4f6dcc53d18ce820f6c3aa351942 100644 --- a/src/routes/items.route.ts +++ b/src/routes/items.route.ts @@ -2,7 +2,7 @@ import { ItemsService } from "@/services/items.service"; import Container from "typedi"; import { honoWithJwt } from ".."; import { zValidator } from "@hono/zod-validator"; -import { itemsSchema } from "@/db/schema/items.schema"; +import { itemsSchema } from "@/db/schema/item.schema"; import { createApexError, HttpStatus } from "@/services/error.service"; import { Hono } from "hono"; diff --git a/src/routes/license.route.ts b/src/routes/license.route.ts index c5db30ab7312a22577e7ad158a867bab394fedf8..cef1eaa847b31ae19b90be5660130651f353e921 100644 --- a/src/routes/license.route.ts +++ b/src/routes/license.route.ts @@ -2,7 +2,7 @@ import { LicenseService } from "@/services/license.service"; import Container from "typedi"; import { honoWithJwt } from ".."; import { zValidator } from "@hono/zod-validator"; -import { licenseSchema } from "@/db/schema/licenses.schema"; +import { licenseSchema } from "@/db/schema/license.schema"; import { createApexError, HttpStatus } from "@/services/error.service"; import { Hono } from "hono"; diff --git a/src/routes/resource.route.ts b/src/routes/resource.route.ts index 80826cc9a4aa6e58ed4c91d0cf3defbf8348539c..cdb725b44275041a19cb1cdfc06db64adf21f50f 100644 --- a/src/routes/resource.route.ts +++ b/src/routes/resource.route.ts @@ -5,7 +5,7 @@ import { honoWithJwt } from '..'; import Container from "typedi"; import { createApexError, HttpStatus } from "@/services/error.service"; import { Hono } from "hono"; -import { statsResourcesSchema } from "@/db/schema/stats-resources.schema"; +import { resourceStatsSchema } from "@/db/schema/resource-stats.schema"; import { StatsResourceService } from "@/services/stats-resources.service"; const service = Container.get(ResourceService); @@ -22,7 +22,7 @@ export const resourceRouter = honoWithJwt() const resource = resourceSchema.dto.parse(await service.create(input)) //cria o stats do recurso correspondente - const stats = statsResourcesSchema.dto.parse(await serviceStats.create({ resource_id: resource.id })) + const stats = resourceStatsSchema.dto.parse(await serviceStats.create({ resource_id: resource.id })) return c.json({ resource, stats }) } catch (e) { diff --git a/src/routes/role.route.ts b/src/routes/role.route.ts index 7c1a8920e01adf88211557c41787ae3cfb3c4ac2..7d7195c7e7ce363459976d36f5ba1c5ff915dc79 100644 --- a/src/routes/role.route.ts +++ b/src/routes/role.route.ts @@ -2,7 +2,7 @@ import { RoleService } from "@/services/role.service" import Container from "typedi" import { honoWithJwt } from ".." import { zValidator } from "@hono/zod-validator" -import { roleSchemas } from "@/db/schema/roles.schema" +import { roleSchemas } from "@/db/schema/role.schema" import { createApexError, HttpStatus } from "@/services/error.service" import { z } from "zod" diff --git a/src/routes/stats-resource.route.ts b/src/routes/stats-resource.route.ts index bc370558df9ef6b951f0e0117bfdd3b495ee1d1d..cc7aa053295f7c631145a5985808fa036072d977 100644 --- a/src/routes/stats-resource.route.ts +++ b/src/routes/stats-resource.route.ts @@ -4,7 +4,7 @@ import Container from "typedi"; import { honoWithJwt } from '..'; import { createApexError, HttpStatus } from "@/services/error.service"; import { Hono } from "hono"; -import { statsResourcesSchema } from "@/db/schema/stats-resources.schema"; +import { resourceStatsSchema } from "@/db/schema/resource-stats.schema"; const service = Container.get(StatsResourceService) @@ -12,11 +12,11 @@ const service = Container.get(StatsResourceService) export const statsResourceRouter = honoWithJwt() // rota para criar as stats de um recurso .post('/create', - zValidator('json', statsResourcesSchema.input), + zValidator('json', resourceStatsSchema.input), async (c) => { try { const input = await c.req.valid('json') - const statsResource = statsResourcesSchema.dto.parse(await service.create(input)) + const statsResource = resourceStatsSchema.dto.parse(await service.create(input)) return c.json({ statsResource }) } catch (e) { @@ -36,12 +36,12 @@ export const statsResourceRouter = honoWithJwt() // rota para atualizar as stats de um recurso .post('/update', - zValidator('json', statsResourcesSchema.update), + zValidator('json', resourceStatsSchema.update), async (c) => { try { const input = await c.req.valid('json') - const statsResource = statsResourcesSchema.dto.parse(await service.update(input)) + const statsResource = resourceStatsSchema.dto.parse(await service.update(input)) return c.json({ statsResource }) } catch (e) { @@ -64,7 +64,7 @@ export const statsResourceRouter = honoWithJwt() async (c) => { try { const id = +c.req.param('id') - const statsResource = statsResourcesSchema.dto.parse(await service.delete(id)) + const statsResource = resourceStatsSchema.dto.parse(await service.delete(id)) return c.json({ statsResource }) } catch (e) { @@ -88,7 +88,7 @@ export const publicStatsResourceRouter = new Hono() async (c) => { try { const id = +c.req.param('id') - const statsResource = statsResourcesSchema.dto.parse(await service.viewUpdate(id)) + const statsResource = resourceStatsSchema.dto.parse(await service.viewUpdate(id)) return c.json({ statsResource }) } catch (e) { @@ -111,7 +111,7 @@ export const publicStatsResourceRouter = new Hono() async (c) => { try { const id = +c.req.param('id') - const statsResource = statsResourcesSchema.dto.parse(await service.sharesUpdate(id)) + const statsResource = resourceStatsSchema.dto.parse(await service.sharesUpdate(id)) return c.json({ statsResource }) } catch (e) { @@ -134,7 +134,7 @@ export const publicStatsResourceRouter = new Hono() async (c) => { try { const id = +c.req.param('id') - const statsResource = statsResourcesSchema.dto.parse(await service.downloadUpdate(id)) + const statsResource = resourceStatsSchema.dto.parse(await service.downloadUpdate(id)) return c.json({ statsResource }) } catch (e) { @@ -155,9 +155,9 @@ export const publicStatsResourceRouter = new Hono() //rota para pegar todas as stats de todos os recursos .get('/all', async (c) => { try { - const statsResources = statsResourcesSchema.dto.array().parse(await service.findMany()) + const resourceStats = resourceStatsSchema.dto.array().parse(await service.findMany()) - return c.json({ statsResources }) + return c.json({ resourceStats }) } catch (e) { return c.json( createApexError({ @@ -178,7 +178,7 @@ export const publicStatsResourceRouter = new Hono() async (c) => { try { const id = +c.req.param('id') - const statsResource = statsResourcesSchema.dto.parse(await service.findById(id)) + const statsResource = resourceStatsSchema.dto.parse(await service.findById(id)) return c.json({ statsResource }) } catch (e) { diff --git a/src/routes/subjects.route.ts b/src/routes/subjects.route.ts index ff981a963e3bd7088bec7b3e44f3ae172f8f2267..d7396046edcfb3119ad12d85b6b68ecc9175ce31 100644 --- a/src/routes/subjects.route.ts +++ b/src/routes/subjects.route.ts @@ -2,7 +2,7 @@ import { SubjectsService } from "@/services/subjects.service"; import { createApexError, HttpStatus } from "@/services/error.service"; import Container from "typedi"; import { honoWithJwt } from ".."; -import { subjectSchema } from "@/db/schema/subjects.schema"; +import { subjectSchema } from "@/db/schema/subject.schema"; import { Hono } from "hono"; import { zValidator } from "@hono/zod-validator"; diff --git a/src/routes/user-institution.route.ts b/src/routes/user-institution.route.ts index eca7d08515508eb541aa8e51372fc44f639a556a..823a73bd7fcf829cc93d3997cce8870fd72b8747 100644 --- a/src/routes/user-institution.route.ts +++ b/src/routes/user-institution.route.ts @@ -8,7 +8,7 @@ import { z } from "zod"; import { UserService } from "@/services/user.service"; import { userSchemas, type UserProfile } from "@/db/schema/user.schema"; import { InstitutionService } from "@/services/institution.service"; -import { institutionSchemas, type InstitutionModel } from "@/db/schema/institutions.schema"; +import { institutionSchemas, type InstitutionModel } from "@/db/schema/institution.schema"; const service = Container.get(UserInstitutionRelationService) const userService = Container.get(UserService) diff --git a/src/routes/user-item.route.ts b/src/routes/user-item.route.ts index 02ea59701b72ace59616591496d9c2c465a7ef03..ce112391ebda4efa785f7a444f3565325d3f393f 100644 --- a/src/routes/user-item.route.ts +++ b/src/routes/user-item.route.ts @@ -7,7 +7,7 @@ import { z } from "zod"; import { UserService } from "@/services/user.service"; import { userSchemas, type UserProfile } from "@/db/schema/user.schema"; import { ItemsService } from "@/services/items.service"; -import { itemsSchema, type ItemsModel } from "@/db/schema/items.schema"; +import { itemsSchema, type ItemsModel } from "@/db/schema/item.schema"; import { UserItemRelationService } from "@/services/user-item.relation.service"; const service = Container.get(UserItemRelationService) diff --git a/src/routes/user-role.route.ts b/src/routes/user-role.route.ts index 0ad75f18374180ed502abd70dd7f38c6004f7605..0b4ed7780d698a3537b6ce9faf088cde34aada5a 100644 --- a/src/routes/user-role.route.ts +++ b/src/routes/user-role.route.ts @@ -8,7 +8,7 @@ import { z } from "zod"; import { UserService } from "@/services/user.service"; import { userSchemas, type UserProfile } from "@/db/schema/user.schema"; import { RoleService } from "@/services/role.service"; -import { roleSchemas, type RoleModel } from "@/db/schema/roles.schema"; +import { roleSchemas, type RoleModel } from "@/db/schema/role.schema"; const service = Container.get(UserRoleRelationService) const userService = Container.get(UserService) diff --git a/src/routes/user.route.ts b/src/routes/user.route.ts index 7564d1c77fc7719c86d13720360d35fb497f2c54..cd81b42495fc80184a105dbe910cbf35702a1e7d 100644 --- a/src/routes/user.route.ts +++ b/src/routes/user.route.ts @@ -6,7 +6,7 @@ import { zValidator } from '@hono/zod-validator' import { honoWithJwt } from '..' import { Hono } from 'hono' import { createApexError, HttpStatus } from '@/services/error.service' -import { followRelationSchemas } from '@/db/relations/follows.relation' +import { followRelationSchemas } from '@/db/relations/followers.relation' import { UserStatsService } from '@/services/user-stats.service' import { FollowRelationService } from '@/services/follow.relation.service' import { userStatsSchemas } from '@/db/schema/user-stats.schema' diff --git a/src/services/achievement.service.ts b/src/services/achievement.service.ts index fb28f6280109c583413d9b589eeb7ad8d97db81f..f5abce83416f79921ae422fbd8b6aa380fb30a44 100644 --- a/src/services/achievement.service.ts +++ b/src/services/achievement.service.ts @@ -1,5 +1,5 @@ import { AchievementRepo } from "@/db/repo/achievement.repo"; -import type { AchievementInput, AchievementModel, AchievementUpdate } from "@/db/schema/achievements.schema"; +import type { AchievementInput, AchievementModel, AchievementUpdate } from "@/db/schema/achievement.schema"; import { Inject, Service } from "typedi"; @Service() diff --git a/src/services/collection-likes.service.ts b/src/services/collection-likes.service.ts index 1300be1b72cb6dcec2db981a349116835b603960..658360b1b0b4a2e3e11d9e857963be4d29969d86 100644 --- a/src/services/collection-likes.service.ts +++ b/src/services/collection-likes.service.ts @@ -1,5 +1,5 @@ import { collectionLikesRepo } from "@/db/repo/collection-likes.repo"; -import type { CollectionModel } from "@/db/schema/collections.schema"; +import type { CollectionModel } from "@/db/schema/collection.schema"; import type { UserModel } from "@/db/schema/user.schema"; import { Inject, Service } from "typedi"; diff --git a/src/services/collection-resources.service.ts b/src/services/collection-resources.service.ts index 8da5647f30b5f17e13a88f40f70344643dfdf19d..4d0b98487f322ae20bdb6e4eb79b6e26f9d882a7 100644 --- a/src/services/collection-resources.service.ts +++ b/src/services/collection-resources.service.ts @@ -1,5 +1,5 @@ import { collectionResourcesRepo } from "@/db/repo/collection-resources.repo"; -import type { CollectionModel } from "@/db/schema/collections.schema"; +import type { CollectionModel } from "@/db/schema/collection.schema"; import type { ResourceModel } from "@/db/schema/resource.schema"; import { Inject, Service } from "typedi"; diff --git a/src/services/collections.service.ts b/src/services/collections.service.ts index 8783a669e5f77a0376d71a9679c3b23c42b98b5c..024b3903a450f017329f36bcb1f7fa3b23a714b7 100644 --- a/src/services/collections.service.ts +++ b/src/services/collections.service.ts @@ -4,7 +4,7 @@ import type { CollectionInput, CollectionModel, CollectionUpdate -} from '@/db/schema/collections.schema' +} from '@/db/schema/collection.schema' @Service() export class CollectionsService { diff --git a/src/services/complaints.service.ts b/src/services/complaints.service.ts index 1368911adcb27eaf326f346572270c9b33c9905c..3e7d31a4af72f74f359cbe17f48033edc96615f9 100644 --- a/src/services/complaints.service.ts +++ b/src/services/complaints.service.ts @@ -1,5 +1,5 @@ import { ComplaintRepo } from "@/db/repo/complaint.repo"; -import type { ComplaintInput, ComplaintModel, ComplaintUpdate } from "@/db/schema/complaints.schema"; +import type { ComplaintInput, ComplaintModel, ComplaintUpdate } from "@/db/schema/complaint.schema"; import { Inject, Service } from "typedi"; @Service() diff --git a/src/services/educational-stage.service.ts b/src/services/educational-stage.service.ts index fa85463e6ff55ca41d00c3a86b79ada5ff85dad6..679d011557dce15f1c1d4ca1327c86f3cc6af6e5 100644 --- a/src/services/educational-stage.service.ts +++ b/src/services/educational-stage.service.ts @@ -1,5 +1,5 @@ import { educationalStageRepo } from "@/db/repo/educational-stage.repo"; -import type { EducationalStagesInput, EducationalStagesModel, EducationalStagesUpdate } from "@/db/schema/educational-stages.schema"; +import type { EducationalStagesInput, EducationalStagesModel, EducationalStagesUpdate } from "@/db/schema/educational-stage.schema"; import { Inject, Service } from "typedi"; diff --git a/src/services/follow.relation.service.ts b/src/services/follow.relation.service.ts index 5bbbe395a51c387a119df6c105dd0f52221263a8..404c8cf0da2fe70f81facb9ba074b7c1d6bea717 100644 --- a/src/services/follow.relation.service.ts +++ b/src/services/follow.relation.service.ts @@ -4,7 +4,7 @@ import { type FollowRelationModel, type FollowRelationUpdate - } from "@/db/relations/follows.relation"; + } from "@/db/relations/followers.relation"; import { FollowRepo } from "@/db/repo/follow.repo"; import { Inject, Service } from "typedi"; diff --git a/src/services/institution.service.ts b/src/services/institution.service.ts index cbafbbb03ae46b507d39d0453d8e834b0bdfdec4..6280231262b6dd9fbd75ceb3a6d90095010e415c 100644 --- a/src/services/institution.service.ts +++ b/src/services/institution.service.ts @@ -1,6 +1,6 @@ import type db from "@/db"; import { InstitutionRepo } from "@/db/repo/institutions.repo"; -import type { InstitutionModel, InstitutionInput, InstitutionUpdate } from "@/db/schema/institutions.schema"; +import type { InstitutionModel, InstitutionInput, InstitutionUpdate } from "@/db/schema/institution.schema"; import { Inject, Service } from "typedi"; @Service() diff --git a/src/services/items.service.ts b/src/services/items.service.ts index 4c63b0314f9758ed5e02c0332efdc3b3ecedffd8..5fa37022270b74522f614be9e5175c54ae588be8 100644 --- a/src/services/items.service.ts +++ b/src/services/items.service.ts @@ -1,5 +1,5 @@ import { ItemsRepo } from "@/db/repo/items.repo"; -import type { ItemsInput, ItemsModel, ItemsUpdate } from "@/db/schema/items.schema"; +import type { ItemsInput, ItemsModel, ItemsUpdate } from "@/db/schema/item.schema"; import { Inject, Service } from "typedi"; diff --git a/src/services/license.service.ts b/src/services/license.service.ts index 2f4458034eb8e19ca412eeddbad8537ee750656f..3e2e84e66aeda3abcb5724ae30c95de065e2e025 100644 --- a/src/services/license.service.ts +++ b/src/services/license.service.ts @@ -1,5 +1,5 @@ import { LicenseRepo } from "@/db/repo/licenses.repo"; -import type { LicenseInput, LicenseModel, LicenseUpdate } from "@/db/schema/licenses.schema"; +import type { LicenseInput, LicenseModel, LicenseUpdate } from "@/db/schema/license.schema"; import { Inject, Service } from "typedi"; diff --git a/src/services/resource-educational-stages.service.ts b/src/services/resource-educational-stages.service.ts index 37dd70c91be43a47cfc60e0dddf8736a0c9bdfa2..53b018eca9abd30d05404605ef893c6641478f35 100644 --- a/src/services/resource-educational-stages.service.ts +++ b/src/services/resource-educational-stages.service.ts @@ -1,5 +1,5 @@ import { resourceEducationalStages } from "@/db/repo/resource-educational-stages.repo"; -import type { EducationalStagesModel } from "@/db/schema/educational-stages.schema"; +import type { EducationalStagesModel } from "@/db/schema/educational-stage.schema"; import type { ResourceModel } from "@/db/schema/resource.schema"; import { Inject, Service } from "typedi"; diff --git a/src/services/resource-subjects.service.ts b/src/services/resource-subjects.service.ts index 72306d5b0b5bd2293340544c0bd3f969e61c1303..8157f92d35df240ce01ebb0e49a7d45b4f39cc05 100644 --- a/src/services/resource-subjects.service.ts +++ b/src/services/resource-subjects.service.ts @@ -1,6 +1,6 @@ import { resourceSubjects } from "@/db/repo/resource-subjects.repo"; import type { ResourceModel } from "@/db/schema/resource.schema"; -import type { SubjectModel } from "@/db/schema/subjects.schema"; +import type { SubjectModel } from "@/db/schema/subject.schema"; import { Inject, Service } from "typedi"; diff --git a/src/services/role.service.ts b/src/services/role.service.ts index 544594f4bd0437ed51b3d0b636ca73d816986561..68206bc2d654f150102b2d029d3c9ec22c679cfc 100644 --- a/src/services/role.service.ts +++ b/src/services/role.service.ts @@ -1,6 +1,6 @@ import type db from "@/db" import { RoleRepo } from "@/db/repo/role.repo" -import type { RoleModel, RoleInput, RoleUpdate } from "@/db/schema/roles.schema" +import type { RoleModel, RoleInput, RoleUpdate } from "@/db/schema/role.schema" import { Inject, Service } from "typedi" @Service() diff --git a/src/services/stats-resources.service.ts b/src/services/stats-resources.service.ts index bb34788a82777f90c98786f84de8bf754d36a2fc..cb517b98fb5006e6d94681fa4f001d6f3a8477df 100644 --- a/src/services/stats-resources.service.ts +++ b/src/services/stats-resources.service.ts @@ -1,5 +1,5 @@ import { statsResourceRepo } from '@/db/repo/stats-resources.repo' -import type { StatsResourcesInput, StatsResourcesModel, StatsResourcesUpdate } from '@/db/schema/stats-resources.schema' +import type { ResourceStatsInput, ResourceStatsModel, ResourceStatsUpdate } from '@/db/schema/resource-stats.schema' import { Inject, Service } from 'typedi' @Service() @@ -7,35 +7,35 @@ export class StatsResourceService { @Inject() private readonly repo: statsResourceRepo - async create(id: StatsResourcesInput): Promise<StatsResourcesModel> { + async create(id: ResourceStatsInput): Promise<ResourceStatsModel> { return this.repo.create(id) } - async update(statsResource: StatsResourcesUpdate): Promise<StatsResourcesModel> { + async update(statsResource: ResourceStatsUpdate): Promise<ResourceStatsModel> { return this.repo.update(statsResource) } - async viewUpdate(resource_id: StatsResourcesModel['resource_id']): Promise<StatsResourcesModel> { + async viewUpdate(resource_id: ResourceStatsModel['resource_id']): Promise<ResourceStatsModel> { return this.repo.viewUpdate(resource_id) } - async downloadUpdate(resource_id: StatsResourcesModel['resource_id']): Promise<StatsResourcesModel> { + async downloadUpdate(resource_id: ResourceStatsModel['resource_id']): Promise<ResourceStatsModel> { return this.repo.downloadUpdate(resource_id) } - async sharesUpdate(resource_id: StatsResourcesModel['resource_id']): Promise<StatsResourcesModel> { + async sharesUpdate(resource_id: ResourceStatsModel['resource_id']): Promise<ResourceStatsModel> { return this.repo.sharesUpdate(resource_id) } - async delete(id: StatsResourcesModel['id']): Promise<StatsResourcesModel> { + async delete(id: ResourceStatsModel['id']): Promise<ResourceStatsModel> { return this.repo.delete(id) } - async findById(id: StatsResourcesModel['id']): Promise<StatsResourcesModel | undefined> { + async findById(id: ResourceStatsModel['id']): Promise<ResourceStatsModel | undefined> { return this.repo.find(id) } - async findMany(): Promise<StatsResourcesModel[]> { + async findMany(): Promise<ResourceStatsModel[]> { return this.repo.findMany() } diff --git a/src/services/subjects.service.ts b/src/services/subjects.service.ts index d8b2f0c6e1821d87c0b9a988f1b4029fbcdc1b29..8bbb445166d836b9c7a6a8de8d228b54075fd01f 100644 --- a/src/services/subjects.service.ts +++ b/src/services/subjects.service.ts @@ -1,5 +1,5 @@ import { subjectsRepo } from "@/db/repo/subjects.repo"; -import type { SubjectInput, SubjectModel, SubjectUpdate } from "@/db/schema/subjects.schema"; +import type { SubjectInput, SubjectModel, SubjectUpdate } from "@/db/schema/subject.schema"; import { Inject, Service } from "typedi"; diff --git a/src/services/user-achievements.service.ts b/src/services/user-achievements.service.ts index c94c632d0a5424c217e123ae4d44009840758efd..ad2b9f6ca9ea9c257532d9003ec86d48d12d2ca4 100644 --- a/src/services/user-achievements.service.ts +++ b/src/services/user-achievements.service.ts @@ -1,5 +1,5 @@ import { userAchievementsRepo } from "@/db/repo/user-achievements.repo"; -import type { AchievementModel } from "@/db/schema/achievements.schema"; +import type { AchievementModel } from "@/db/schema/achievement.schema"; import type { UserModel } from "@/db/schema/user.schema"; import { Inject, Service } from "typedi";