Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REFACTOR]: delete postAnonymously variable #392

Merged
merged 4 commits into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions backend/src/libs/utils/generateBoardData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ export const generateSubBoardDtoData = (index: number, users: BoardUserDto[] = [
isSubBoard: true,
maxVotes: undefined,
hideCards: false,
hideVotes: false,
postAnonymously: false
hideVotes: false
};
};

Expand All @@ -43,8 +42,7 @@ export const generateBoardDtoData = (): CreateBoardDto => {
team: null,
isSubBoard: false,
hideCards: false,
hideVotes: false,
postAnonymously: false
hideVotes: false
}
};
};
5 changes: 0 additions & 5 deletions backend/src/modules/boards/dto/board.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ export default class BoardDto {
@IsBoolean()
hideVotes!: boolean;

@ApiProperty({ default: false })
@IsNotEmpty()
@IsBoolean()
postAnonymously!: boolean;

@ApiProperty({ type: BoardDto, isArray: true })
@IsOptional()
@ValidateNested({ each: true })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export interface Configs {
votes?: string | null;
hideCards?: boolean;
hideVotes?: boolean;
anonymously: boolean;
maxUsers: number;
}

Expand Down
3 changes: 0 additions & 3 deletions backend/src/modules/boards/schemas/board.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ export default class Board {
@Prop({ type: Boolean, nullable: false, default: false })
hideVotes?: boolean;

@Prop({ type: Boolean, nullable: false, default: false })
postAnonymously?: boolean;

@Prop({ type: Number, nullable: false, default: 0 })
totalUsedVotes?: Number;
}
Expand Down
9 changes: 3 additions & 6 deletions backend/src/modules/boards/services/create.board.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ export default class CreateBoardServiceImpl implements CreateBoardService {
}

async create(boardData: BoardDto, userId: string) {
const { team, recurrent, maxVotes, postAnonymously, hideCards, hideVotes, maxUsers } =
boardData;
const { team, recurrent, maxVotes, hideCards, hideVotes, maxUsers } = boardData;
const newUsers = [];

const newBoard = await this.createBoard(boardData, userId);
Expand All @@ -127,8 +126,7 @@ export default class CreateBoardServiceImpl implements CreateBoardService {
recurrent,
maxVotes,
hideCards,
hideVotes,
anonymously: postAnonymously
hideVotes
}
};

Expand Down Expand Up @@ -163,8 +161,7 @@ export default class CreateBoardServiceImpl implements CreateBoardService {
recurrent: configs.recurrent,
maxVotes: configs.maxVotes ?? null,
hideCards: configs.hideCards ?? false,
hideVotes: configs.hideVotes ?? false,
postAnonymously: configs.anonymously
hideVotes: configs.hideVotes ?? false
};

const board = await this.create(boardData, ownerId);
Expand Down
3 changes: 0 additions & 3 deletions backend/src/modules/schedules/schemas/schedules.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ export default class Schedules {
@Prop({ type: Boolean, nullable: false, default: false })
hideVotes?: boolean;

@Prop({ type: Boolean, nullable: false, default: false })
postAnonymously?: boolean;

@Prop({ type: Date, nullable: false, default: false })
willRunAt!: Date;
}
Expand Down
4 changes: 0 additions & 4 deletions frontend/src/components/Board/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import Text from 'components/Primitives/Text';
import useBoard from 'hooks/useBoard';
import SchemaUpdateBoard from 'schema/schemaUpdateBoardForm';
import { boardInfoState } from 'store/board/atoms/board.atom';
import { updateBoardError } from 'store/updateBoard/atoms/update-board.atom';
import { UpdateBoardType } from 'types/board/board';
import { BoardUserToAdd } from 'types/board/board.user';
import { BoardUserRoles } from 'utils/enums/board.user.roles';
Expand Down Expand Up @@ -73,8 +72,6 @@ const BoardSettings = ({
const dialogContainerRef = useRef<HTMLSpanElement>(null);
const submitBtnRef = useRef<HTMLButtonElement | null>(null);

const haveError = useRecoilValue(updateBoardError);

// Unique state to handle the switches change
const [switchesState, setSwitchesState] = useState<{ maxVotes: boolean; responsible: boolean }>(
{
Expand Down Expand Up @@ -271,7 +268,6 @@ const BoardSettings = ({
<Text heading="4">Board Name</Text>
<Input
forceState
disabled={haveError}
id="title"
maxChars="30"
placeholder="Board Name"
Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/CreateBoard/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ const CreateBoardContent = () => {
const newSubBoard: CreateBoardDto = { ...subBoard, users: [], dividedBoards: [] };
newSubBoard.hideCards = boardState.board.hideCards;
newSubBoard.hideVotes = boardState.board.hideVotes;
newSubBoard.postAnonymously = boardState.board.postAnonymously;
newSubBoard.maxVotes = maxVotes;
const users = subBoard.users.map((boardUser) => ({
user: boardUser.user._id,
Expand Down
1 change: 0 additions & 1 deletion frontend/src/hooks/useCreateBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const useCreateBoard = (team: Team) => {
maxVotes: undefined,
hideCards: false,
hideVotes: false,
postAnonymously: false,
totalUsedVotes: 0
};
},
Expand Down
1 change: 0 additions & 1 deletion frontend/src/pages/boards/new.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ const NewBoard: NextPage = () => {
const newSubBoard: CreateBoardDto = { ...subBoard, users: [], dividedBoards: [] };
newSubBoard.hideCards = boardState.board.hideCards;
newSubBoard.hideVotes = boardState.board.hideVotes;
newSubBoard.postAnonymously = boardState.board.postAnonymously;
newSubBoard.maxVotes = maxVotes;

newSubBoard.users = subBoard.users.map((boardUser) => ({
Expand Down
1 change: 0 additions & 1 deletion frontend/src/store/createBoard/atoms/create-board.atom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export const createBoardDataState = atom<CreateBoardData>({
isSubBoard: false,
hideCards: false,
hideVotes: false,
postAnonymously: false,
slackGroup: false,
totalUsedVotes: 0
}
Expand Down
22 changes: 0 additions & 22 deletions frontend/src/store/updateBoard/atoms/update-board.atom.tsx

This file was deleted.

1 change: 0 additions & 1 deletion frontend/src/types/board/board.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export default interface BoardType {
hideCards: boolean;
hideVotes: boolean;
votes?: string;
postAnonymously: boolean;
submitedByUser?: string;
submitedAt?: Date;
slackGroup?: boolean;
Expand Down