thtsystems / open-visit

Open-source application for visiting scheduling.
MIT License
9 stars 6 forks source link

[Question] What to do about Delete methods of each route? #59

Closed JoaoAlem closed 8 months ago

JoaoAlem commented 8 months ago

Context When writing the routes, i saw that companies schema have a active flag, but the others schemas don't have the flag. And i know that we ain't gonna delete the data in database, so we'll add a flag for everyone.

Solutions To make a standard, we can add active the same flag for every table, but in my opnion, i don't think that is a good idea, because personally i prefer something more verbose. In my opnion, we can change the active flag to a date_delete field and add two more fields: date_create and date_update. This way we can even show to users since when they are members and for each update of the user, we can have last time updated time.

ernestoresende commented 8 months ago

That's a very good idea. You could make it as:

  createdAt: timestamp("created_at", { withTimezone: false, mode: string }).defaultNow().notNull(),
  updatedAt: timestamp("updated_at", { withTimezone: false, mode: string }).defaultNow().notNull(),
  deletedAt: timestamp("deleted_at", { withTimezone: false, mode: string }),
JoaoAlem commented 8 months ago

Thanks, how i don't have anything else to comment in this issue, i'm gonna close it.