feat: allow users to start the calendar week on Monday (#13295)
resolve twentyhq/core-team-issues#1255 - Introduced a new field isWeekStartMonday in the workspaceMember table. - Added a function updateCalendarStartDay to update the isWeekStartMonday value when the user toggles the corresponding field in the settings. The logic works for me, but I couldn’t find a way to create the column locally in the database for the workspaceMember tables. Please let me know if this approach looks good and how to properly create dynamic columns that are not directly handled via migration. https://github.com/user-attachments/assets/4eebada5-6a96-4a88-8e96-98f1501859e3 --------- Co-authored-by: Félix Malfait <felix.malfait@gmail.com> Co-authored-by: Félix Malfait <felix@twenty.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Field, ObjectType } from '@nestjs/graphql';
|
||||
import { Field, Int, ObjectType } from '@nestjs/graphql';
|
||||
|
||||
import { IDField } from '@ptc-org/nestjs-query-graphql';
|
||||
import { Max, Min } from 'class-validator';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
import { RoleDTO } from 'src/engine/metadata-modules/role/dtos/role.dto';
|
||||
@@ -38,6 +39,11 @@ export class WorkspaceMember {
|
||||
@Field({ nullable: true })
|
||||
locale: string;
|
||||
|
||||
@Field(() => Int, { nullable: true })
|
||||
@Min(0)
|
||||
@Max(7)
|
||||
calendarStartDay: number;
|
||||
|
||||
@Field({ nullable: true })
|
||||
timeZone: string;
|
||||
|
||||
|
||||
+2
@@ -60,6 +60,7 @@ export class WorkspaceMemberTranspiler {
|
||||
timeFormat,
|
||||
timeZone,
|
||||
dateFormat,
|
||||
calendarStartDay,
|
||||
} = workspaceMemberEntity;
|
||||
|
||||
const avatarUrl = this.generateSignedAvatarUrl({
|
||||
@@ -84,6 +85,7 @@ export class WorkspaceMemberTranspiler {
|
||||
timeFormat: timeFormat as WorkspaceMemberTimeFormatEnum,
|
||||
timeZone,
|
||||
roles,
|
||||
calendarStartDay,
|
||||
} satisfies WorkspaceMember;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user