Skip to content
Snippets Groups Projects
Commit e0332c0a authored by mcs22's avatar mcs22
Browse files

Issue #62: CHANGE files name

parent 2161b5d0
No related branches found
No related tags found
1 merge request!56Issue #62: CHANGE files name
......@@ -2,7 +2,7 @@ import { sql } from "drizzle-orm";
import { boolean, integer, numeric, pgTable, serial, text, timestamp, varchar } from "drizzle-orm/pg-core";
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
import { z } from "zod";
import stateEnum from "./stateEnum.schema";
import stateEnum from "./state-enum.schema";
export const achievementTable = pgTable('achievements', {
id: serial('id').primaryKey()
......
......@@ -4,7 +4,7 @@ import { createInsertSchema, createSelectSchema } from "drizzle-zod";
import type { z } from "zod";
import resourceTable from "./resource.schema";
import collectionTable from "./collections.schema";
import stateEnum from "./stateEnum.schema";
import stateEnum from "./state-enum.schema";
const complaintTable = pgTable('complaints', {
id: serial('id').primaryKey()
......
......@@ -28,8 +28,8 @@ import userAchievementsTable from '../relations/user-achievement.relation'
import actionTable from './actions.schema'
import notificationRelationTable from '../relations/notification.relation'
import userItemRelationTable from '../relations/user-item.relation'
import stateEnum from './stateEnum.schema'
import resourceEnum from './resourceEnum.schema'
import stateEnum from './state-enum.schema'
import resourceEnum from './resource-enum.schema'
import commentsTable from './comments.schema'
import commentReplyTable from './comment-reply.schema'
import userCollectionTable from '../relations/user-collection.relation'
......
import { sql } from "drizzle-orm"
import { integer, pgTable, serial, timestamp } from "drizzle-orm/pg-core"
import { createInsertSchema, createSelectSchema } from "drizzle-zod"
import type { z } from "zod"
import { actionTable, collectionTable, resourceTable, userTable } from "."
const notificationTable = pgTable('notifications', {
id: serial('id').primaryKey()
.unique()
.notNull(),
action_id: integer('action_id')
.references(() => actionTable.id, {onDelete: 'cascade'})
.notNull(),
actor_user_id: integer('actor_user_id')
.references(() => userTable.id, {onDelete: 'cascade'})
.notNull(),
target_user_id: integer('target_user_id')
.references(() => userTable.id, {onDelete: 'cascade'})
.notNull(),
target_resource_id: integer('target_resource_id')
.references(() => resourceTable.id, {onDelete: 'cascade'}),
target_collection_id: integer('target_collection_id')
.references(() => collectionTable.id, {onDelete: 'cascade'}),
createdAt: timestamp('created_at', { mode: 'string' })
.notNull()
.defaultNow(),
updatedAt: timestamp('updated_at', { mode: 'string' })
.notNull()
.defaultNow()
.$onUpdate(() => sql`current_timestamp`),
})
const notificationModelSchema = createSelectSchema(notificationTable)
const notificationDtoSchema = notificationModelSchema
const notificationInputSchema = createInsertSchema(notificationTable)
const notificationUpdateSchema = notificationInputSchema
.partial()
.required({ id: true })
export type NotificationModel = z.infer<typeof notificationModelSchema>
export type NotificationDto = z.infer<typeof notificationDtoSchema>
export type NotificationInput = z.infer<typeof notificationInputSchema>
export type NotificationUpdate = z.infer<typeof notificationUpdateSchema>
export const notificationSchemas = {
model: notificationModelSchema,
dto: notificationDtoSchema,
input: notificationInputSchema,
update: notificationUpdateSchema
}
export default notificationTable
\ No newline at end of file
......@@ -17,7 +17,7 @@ import userTable from './user.schema'
import objectTypeTable from './object-type.schema'
import licenseTable from './license.schema'
import resourceStatsTable from './resource-stats.schema'
import resourceEnum from './resourceEnum.schema'
import resourceEnum from './resource-enum.schema'
//por padrao active é false, só é true quando o recurso é aprovado
const resourceTable = pgTable('resources', {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment