Open duongdev opened 5 years ago
MealPeriod
createdByUserId
không được nhập thì thông báo lỗi Mã người tạo không được để trống
registrationStartsAt
không được nhập thì thông báo lỗi Ngày mở đăng ký không được để trống
registrationEndsAt
không được nhập thì thông báo lỗi Ngày đóng đăng ký không được để trống
registrationStartsAt
sau ngày registrationEndsAt
thì thông báo lỗi Ngày mở đăng ký phải trước ngày đóng đăng ký (registrationEndsAt)
registrationEndsAt
định dạng theo MM/DD/YYYY
name
registrationStartSince
đến nay hoặc registrationStartUntil
registrationStartSince
đến registrationStartUntil
registrationEndSince
đến nay hoặc registrationStartUntil
registrationEndSince
đến registrationEndUntil
MealPeriod
được trả về mỗi queryreverse_ registrationStartsAt
, thứ tự sắp xếp danh sách MealPeriod
, là một trong các key sau registrationStartsAt
, reverse_ registrationStartsAt
, registrationEndsAt
, reverse_ registrationEndsAt
search
được nhập và không phải là string
thì thông báo lỗi Từ khóa phải là chuỗi ký tự
registrationStartSince
được nhập và không phải ngày thì thông báo lỗi Thời gian mở đăng ký phải là ngày
registrationStartUntil
được nhập và không phải ngày thì thông báo lỗi Thời gian mở đăng ký phải là ngày
registrationStartSince
sau thời gian registrationStartUntil
thì thông báo lỗi Thời gian mở đăng ký "từ" phải trước thời gian đăng ký "đến"
registrationEndSince
được nhập và không phải ngày thì thông báo lỗi Thời gian đóng đăng ký phải là ngày
registrationEndSince
được nhập và không phải ngày thì thông báo lỗi Thời gian đóng đăng ký phải là ngày
registrationEndSince
sau thời gian registrationEndUntil
thì thông báo lỗi Thời gian đóng đăng ký "từ" phải trước thời gian đăng ký "đến"
offset
không phải là số nguyên dương thì thông báo lỗi Số lượng bỏ qua phải là một số nguyên dương
limit
không phải là số nguyên dương thì thông báo lỗi Giới hạn số lượng phải là một số nguyên dương
orderBy
không phải là một trong các từ khóa hợp lệ thì thông báo lỗi Sắp xếp phải là một trong các giá trị sau registrationStartsAt, reverse_ registrationStartsAt, registrationEndsAt, reverse_ registrationEndsAt
mongoose
filter
để tìm các MealPeriod
search
được nhập thì filter.name = { $regex: ${search}, $options: 'i' }
registrationStartSince
được nhập và filter.registrationStartsAt
chưa có thì khởi tạo là {}
, và filter. registrationStartsAt.$gte = ${registrationStartSince}
registrationStartUntil
được nhập và filter.registrationStartsAt
chưa có thì khởi tạo là {}
, và filter. registrationStartsAt.$lt = ${registrationStartUntil}
registrationEndSince
được nhập và filter.registrationEndsAt
chưa có thì khởi tạo là {}
, và filter. registrationEndsAt.$gte = ${registrationEndSince}
registrationEndUntil
được nhập và filter.registrationEndsAt
chưa có thì khởi tạo là {}
, và filter. registrationEndsAt.$lt = ${registrationEndUntil}
orderBy
có reverse
thì sortBy
sẽ có dạng { [key]: -1 }
và { [key]: 1 }
nếu không có reverse
MealPeriod
theo filter
với skip
, limit
và sortBy
vừa lấy được,MealPeriod
theo filter
MealPeriod
và tổng số lượng các MealPeriod
hợp lệ
Một object bao gồm:
MealPeriod
MealPeriod
MealPeriod
MealPeriod
ứng với id
MealPeriod
nếu tìm được, null
nếu không tim đượcunauthorized
roles
là deactivated
thì thông báo lỗi unauthorized
roles
là admin
thì thông báo lỗi permission_denied
registrationStartsAt
không được nhập thì thông báo lỗi Ngày mở đăng ký không được để trống
registrationEndsAt
không được nhập thì thông báo lỗi Ngày đóng đăng ký không được để trống
registrationStartsAt
sau ngày registrationEndsAt
thì thông báo lỗi Ngày mở đăng ký phải trước ngày đóng đăng ký (registrationEndsAt)
registrationEndsAt
định dạng theo MM/DD/YYYY
MealPeriod
thì createdByUserId
sẽ là ID của người dùng đang đăng nhập user.id
createMealPeriod
với input hợp lệ.
MealPeriod
đã tạoname
registrationStartSince
đến nay hoặc registrationStartUntil
registrationStartSince
đến registrationStartUntil
registrationEndSince
đến nay hoặc registrationStartUntil
registrationEndSince
đến registrationEndUntil
MealPeriod
trên một trangreverse_ registrationStartsAt
, thứ tự sắp xếp danh sách MealPeriod
, là một trong các enum sau registrationStartsAt
, reverse_ registrationStartsAt
, registrationEndsAt
, reverse_ registrationEndsAt
getMealPeriods
với input hợp lệ
Một type (MealPeriodsResult) bao gồm:
MealPeriod
MealPeriod
getMealPeriod
MealPeriod
nếu tìm được, null
nếu không tìm đượcbreakfast
, lunch
, dinner
id
món ăn có trong buổiMealPeriod
type
không được nhập thì thông báo lỗi Buổi ăn không được để trống
type
không phải là một trong breakfast
, lunch
, dinner
thì thông báo lỗi Buổi ăn phải là "buổi sáng", "buổi trưa", hoặc "buổi tối"
mealPeriodId
không được nhập thì thông báo lỗi Mã đợt ăn không được để trống
MealPeriod
ứng với mealPeriodId
thì thông báo lỗi Đợt ăn không tồn tại
dishIds
không được nhập thì thông báo lỗi Danh sách món ăn không được để trống
dishId
trong dishIds
thì thông báo lỗi Các món ăn {danh sách dishId không tìm thấy} không tồn tại
date
không được nhập thì thông báo lỗi Ngày ăn không được để trống
dishIds
Một danh sách với mỗi phần tử có dạng
createMeal
createMeal
để tạo một Meal
.Meal
, thông tin dữ liệu đầu vào sẽ được lưu vào danh sách notCreatedMeals
Meal
được tạo thành công sẽ được lưu vào danh sách createdMeals
Meal
đã được tạo thành côngMeal
chưa được tạoMealPeriod
reverse_date
, date
orderBy
không hợp lệ thì thông báo lỗi Sắp xếp phải là một trong reverse_date, date
offset
không phải là số nguyên dương thì thông báo lỗi Số lượng bỏ qua phải là một số nguyên dương
limit
không phải là số nguyên dương thì thông báo lỗi Số lượng giới hạn phải là một số nguyên dương
Meal
theo mealPeriodId
và orderBy
, skip
, limit
skip
= offset
, và limit
= limit
Meal
theo mealPeriodId
Meal
Meal
tìm đượcunauthorized
roles
chứa deactivated
thì thông báo lỗi unauthorized
roles
là admin
thì thông báo lỗi permission_denied
createMeal
Meal
đã được tạo thành côngunauthorized
roles
chứa deactivated
thì thông báo lỗi unauthorized
roles
là admin
thì thông báo lỗi permission_denied
public
createMeals
với dữ liệu đọc được trong excel
Meal
đã được tạo thành côngMeal
chưa được tạo####### Input
MealPeriod
reverse_date
, date
getMeals
với input hợp lệ
####### OutputMeal
Meal
tìm đượcmealId
không được nhập thì thông báo lỗi Mã buổi ăn không được để trống
mealId
không được tìm thấy thì thông báo lỗi Không tìm thấy buổi ăn {mealId}
dishIds
không được nhập thì thông báo lỗi Danh sách món ăn không được để trống
dishId
trong dishIds
thì thông báo lỗi Các món ăn {danh sách dishId không tìm thấy} không tồn tại
userMealBooking
với dữ liệu hợp lệ
userMealBooking
hợp lệ đã tạo đượcDanh sách với mỗi phần tử có dạng
createUserMealBooking
với input hợp lệUserMealBooking
sẽ được thêm vào createdUserMealBookings
, ngược lại thêm vào notCreatedUserMealBookings
UserMealBooking
vừa tạo
Purpose
X
ngày hoặc ngày nghỉ có phép thì sẽ được tự động Approve.