Skip to content

Commit

Permalink
fix; 改为使用 integer
Browse files Browse the repository at this point in the history
  • Loading branch information
SALTWOOD committed Aug 28, 2024
1 parent fbd925b commit 9108907
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/database/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class ClusterEntity {
@Ignore()
public isOnline: boolean = false;

public isBanned: boolean = false;
public isBanned: number = 0;

public createdAt: number = 0;

Expand Down
4 changes: 2 additions & 2 deletions src/database/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { PrimaryKey, Table } from "../sqlite";
id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT NOT NULL,
photo TEXT,
isSuperUser INTEGER DEFAULT 0
isSuperUser INTEGER
`)
@PrimaryKey('id')
export class UserEntity {
public id: number;
public username: string;
public photo: string;
public isSuperUser: boolean = false;
public isSuperUser: number = 0;

constructor(id: number = 0, username: string = '', photo: string = '') {
this.id = id;
Expand Down
5 changes: 3 additions & 2 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export class Server {
}
}).then(response => response.data) as { id: number, login: string, avatar_url: string };
} catch (error) {
console.error('Error fetching GitHub user info:', error as Error);
console.error('Error fetching GitHub user info: ', error as Error);
throw error; // 或者返回一个默认的错误响应
}

Expand Down Expand Up @@ -239,6 +239,7 @@ export class Server {
});
} catch (error) {
const err = error as Error;
console.error('Error processing GitHub OAuth:', err);
res.status(500).json({
error: `${err.name}: ${err.message}`
});
Expand Down Expand Up @@ -647,7 +648,7 @@ export class Server {
res.status(404).send(); // 集群不存在
return;
}
cluster.isBanned = Boolean(data.ban);
cluster.isBanned = Number(data.ban);
this.db.update(cluster);
res.setHeader('Content-Type', 'application/json');
res.status(200).json(removeSensitiveInfo(cluster));
Expand Down

0 comments on commit 9108907

Please sign in to comment.