Skip to content

Commit

Permalink
feat: signup api compatible api calling default space name
Browse files Browse the repository at this point in the history
  • Loading branch information
caoxing9 committed Jul 15, 2024
1 parent 40257ed commit 7bf9eaf
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions apps/nestjs-backend/src/features/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ export class UserService {
isAdmin: isAdmin ? true : null,
},
});
const { id } = newUser;
const { id, name } = newUser;
if (account) {
await this.prismaService.txClient().account.create({
data: { id: generateAccountId(), ...account, userId: id },
});
}
await this.cls.runWith(this.cls.get(), async () => {
this.cls.set('user.id', id);
await this.createSpaceBySignup({ name: defaultSpaceName });
await this.createSpaceBySignup({ name: defaultSpaceName || `${name}'s space` });
});
this.eventEmitterService.emitAsync(Events.USER_SIGNUP, new UserSignUpEvent(id));
return newUser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { SpaceItem } from './SpaceItem';
export const SpaceList: FC = () => {
const router = useRouter();
const { disallowSpaceCreation } = useSetting();
const { t } = useTranslation('space');
const { t } = useTranslation('common');

const queryClient = useQueryClient();
const { data: spaceList } = useQuery({
Expand Down Expand Up @@ -46,7 +46,7 @@ export const SpaceList: FC = () => {
className="w-full"
onClick={() => {
const name = getUniqName(
t('defaultSpaceName'),
t('noun.space'),
spaceList?.data?.length ? spaceList?.data.map((space) => space?.name) : []
);
addSpace({ name });
Expand Down
1 change: 0 additions & 1 deletion packages/common-i18n/src/locales/en/space.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"defaultSpaceName": "Space",
"initialSpaceName": "{{name}}'s space",
"page": {
"title": "Teable App"
Expand Down
1 change: 0 additions & 1 deletion packages/common-i18n/src/locales/zh/space.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"defaultSpaceName": "空间",
"initialSpaceName": "{{name}}的空间",
"page": {
"title": "Teable App"
Expand Down

0 comments on commit 7bf9eaf

Please sign in to comment.