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 e5cb504
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 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

0 comments on commit e5cb504

Please sign in to comment.