Finished guestbook and gallery. started diary

This commit is contained in:
Torsten Schulz
2024-09-27 07:40:06 +02:00
parent a2ee66c9de
commit c31be3f879
34 changed files with 2298 additions and 185 deletions

View File

@@ -51,6 +51,18 @@ class BaseService {
const ageDate = new Date(ageDifMs);
return Math.abs(ageDate.getUTCFullYear() - 1970);
}
async isUserAdult(userId) {
const birthdateParam = await this.getUserParams(userId, ['birthdate']);
if (!birthdateParam || birthdateParam.length === 0) {
return false;
}
const birthdate = birthdateParam[0].value;
const age = this.calculateAge(birthdate);
return age >= 18;
}
}
export default BaseService;