Skip to content

Commit

Permalink
[fix] 2 detail bugs of Lark API
Browse files Browse the repository at this point in the history
  • Loading branch information
TechQuery committed Oct 20, 2024
1 parent 6b3be17 commit d6edf7a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
tags:
- v*
env:
ARTIFACT_PATH: /tmp/artifact.tar
ARTIFACT_PATH: artifact.tar
BOX_NAME: ${{ github.event.repository.name }}
BOX_URL: ${{ github.repository }}
HOST: ${{ secrets.HOST }}
Expand Down
9 changes: 6 additions & 3 deletions src/controller/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
import {
APP_SECRET,
blobURLOf,
lark,
leanClient,
PersonBiDataTable,
searchConditionOf
Expand All @@ -47,15 +48,17 @@ export class UserController {
});

static async signUp({ mobilePhone }: SignInData) {
await lark.getAccessToken();

const [{ name, gender, avatar, email } = {}] =
await new PersonBiDataTable().getList({ 手机号: mobilePhone }),
existed = await store.findOneBy({ mobilePhone });

const saved = await store.save({
...existed,
mobilePhone,
email,
nickName: name || existed.nickName || mobilePhone,
email: email?.text,
nickName: name || existed?.nickName || mobilePhone,
gender:
gender === '女'
? Gender.Female
Expand Down Expand Up @@ -100,7 +103,7 @@ export class UserController {
return { token: body.validate_token };
}

@Post('/session/code')
@Post('/session/SMS-code')
@OnUndefined(201)
async createSMSCode(
@Body() { captchaToken, captchaCode, mobilePhone }: SMSCodeInput
Expand Down
7 changes: 4 additions & 3 deletions src/utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
BiDataQueryOptions,
BiDataTable,
LarkApp,
TableCellLink,
TableCellValue,
TableRecordFields
} from 'mobx-lark';
Expand Down Expand Up @@ -74,8 +75,8 @@ export class CommonBiDataTable extends BiDataTable<TableRecordFields>() {
client = lark.client;
}

export interface Person
extends Record<'name' | 'gender' | 'email' | '手机号', string> {
export interface Person extends Record<'name' | 'gender' | '手机号', string> {
email: TableCellLink;
avatar: TableCellValue;
}

Expand All @@ -94,7 +95,7 @@ export const blobURLOf = (value: TableCellValue) =>
('file_token' in value[0] || 'attachmentToken' in value[0])
? `${OWSBlobRoot}/${value[0].name}`
: ''
: value + '';
: value?.toString();

export const parseBlobConnection = (raw: string) =>
Object.fromEntries(
Expand Down

0 comments on commit d6edf7a

Please sign in to comment.