我正在尝试构建REST API服务,该服务将允许用户预订会议室: 我在数据库中有两个实体(项目要求):
USER
- id_user LONG
- name: text,max. length 50,required
- surname: text,max. length 100,required
- login: text,required,unique (allows to identify user)
- password: text,min. length 6,required
ROOM
-id_room LONG
-room name: text,unique (allows to identify room)
- location description: text,max. length 256,optional
- number of seats: number,max. 100,required
- projector: yes/no,optional,default: no
- phone number: text,optional
而且我必须能够通过API调用预订到选定日期和时间范围的房间。然后返回带有所有房间或单个房间或单个用户的日程表的JSON文件。
我的解决方案是创建第三个表,并在用户每次预订房间时添加一条记录:
RESERVATIONS_TABLE
- id_reservation
- room_id
- user_id
- start_date
- end_date
这是一个不错的选择,应该使用哪种数据类型(在实体中)? 它将在具有H2数据库和Hibernate的SpringBoot MVC应用程序中运行