-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Change login page url * Add new index page * Add login button to main header * Change height of main layout * Change workspace url spec * Change redirect url after login * Change url of workspace * Change component name from `Editor` to `Document` * Change `injectProtectedRoute` implementation to support protecting children * Change documentSlug to documentId in URL * Delete share mode in `DocumentIndex` * Change API path for document * Change document page url * Change cleanup code for docs * Remove share mode in share modal * Add document share page * Componentize DocumentView * Add share mode * Fix mode button background padding * Change document page to use `useYorkieDocument` * Add tooltip to avatar * Add back button to DocumentHeader * Remove slug in document db * Fix lint * Add check path to API * Fix formatting * Add name conflict checking API * Fix formatting * Remove default nickname * Add API for changing nickname * Change findOptions for user workspaces * Fix lint * Add Change nickname modal * Add name conflict checking on workspace * Add conflict checking to CreateModal * Add queryInvalidation on creating workspace * Move to the note page when created
- Loading branch information
Showing
57 changed files
with
891 additions
and
439 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Test, TestingModule } from "@nestjs/testing"; | ||
import { CheckController } from "./check.controller"; | ||
|
||
describe("CheckController", () => { | ||
let controller: CheckController; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
controllers: [CheckController], | ||
}).compile(); | ||
|
||
controller = module.get<CheckController>(CheckController); | ||
}); | ||
|
||
it("should be defined", () => { | ||
expect(controller).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Body, Controller, Post } from "@nestjs/common"; | ||
import { CheckService } from "./check.service"; | ||
import { CheckNameConflictDto } from "./dto/check-name-conflict.dto"; | ||
import { CheckNameConflicReponse } from "./types/check-name-conflict-response.type"; | ||
import { Public } from "src/utils/decorators/auth.decorator"; | ||
import { ApiBody, ApiOkResponse, ApiOperation, ApiTags } from "@nestjs/swagger"; | ||
|
||
@ApiTags("Check") | ||
@Controller("check") | ||
export class CheckController { | ||
constructor(private checkService: CheckService) {} | ||
|
||
@Public() | ||
@Post("name-conflict") | ||
@ApiOperation({ | ||
summary: "Check Whether The Name Conflicts with Username or Title of Workspace.", | ||
description: "If the name is conflict, it returns true.", | ||
}) | ||
@ApiBody({ type: CheckNameConflictDto }) | ||
@ApiOkResponse({ type: CheckNameConflicReponse }) | ||
async checkNameConflict( | ||
@Body() checkNameConflictDto: CheckNameConflictDto | ||
): Promise<CheckNameConflicReponse> { | ||
return this.checkService.checkNameConflict(checkNameConflictDto.name); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Module } from "@nestjs/common"; | ||
import { CheckService } from "./check.service"; | ||
import { CheckController } from "./check.controller"; | ||
import { PrismaService } from "src/db/prisma.service"; | ||
|
||
@Module({ | ||
providers: [CheckService, PrismaService], | ||
controllers: [CheckController], | ||
}) | ||
export class CheckModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Test, TestingModule } from "@nestjs/testing"; | ||
import { CheckService } from "./check.service"; | ||
|
||
describe("CheckService", () => { | ||
let service: CheckService; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
providers: [CheckService], | ||
}).compile(); | ||
|
||
service = module.get<CheckService>(CheckService); | ||
}); | ||
|
||
it("should be defined", () => { | ||
expect(service).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Injectable } from "@nestjs/common"; | ||
import { PrismaService } from "src/db/prisma.service"; | ||
import { CheckNameConflicReponse } from "./types/check-name-conflict-response.type"; | ||
import slugify from "slugify"; | ||
|
||
@Injectable() | ||
export class CheckService { | ||
constructor(private prismaService: PrismaService) {} | ||
|
||
async checkNameConflict(name: string): Promise<CheckNameConflicReponse> { | ||
const slug = slugify(name, { lower: true }); | ||
const conflictUserList = await this.prismaService.user.findMany({ | ||
where: { | ||
OR: [{ nickname: name }, { nickname: slug }], | ||
}, | ||
}); | ||
const conflictWorkspaceList = await this.prismaService.workspace.findMany({ | ||
where: { | ||
OR: [{ title: name }, { title: slug }], | ||
}, | ||
}); | ||
|
||
return { | ||
conflict: Boolean(conflictUserList.length + conflictWorkspaceList.length), | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { ApiProperty } from "@nestjs/swagger"; | ||
|
||
export class CheckNameConflictDto { | ||
@ApiProperty({ type: String, description: "Name to check conflict" }) | ||
name: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { ApiProperty } from "@nestjs/swagger"; | ||
|
||
export class CheckNameConflicReponse { | ||
@ApiProperty({ type: Boolean, description: "Whether the name is conflict" }) | ||
conflict: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { ApiProperty } from "@nestjs/swagger"; | ||
|
||
export class ChangeNicknameDto { | ||
@ApiProperty({ type: String, description: "Nickname of user to update" }) | ||
nickname: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.