return the async function
此提交包含在:
1 父節點
d890bc5eb1
當前提交
71589fe1b4
1 file changed
+2
-6
@@ -32,19 +32,17 @@ export class AirportService {
|
||||
}
|
||||
|
||||
async registerAirport(airport: Airport): Promise<boolean> {
|
||||
this.airportExists(airport.icao).then(async (exists) => {
|
||||
return this.airportExists(airport.icao).then(async (exists) => {
|
||||
if (!exists) {
|
||||
await this.airportModel.create(airport);
|
||||
}
|
||||
|
||||
return !exists;
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
async updateAirport(airport: Airport): Promise<boolean> {
|
||||
this.airportExists(airport.icao).then(async (exists) => {
|
||||
return this.airportExists(airport.icao).then(async (exists) => {
|
||||
if (exists) {
|
||||
await this.airportModel.findOneAndUpdate(
|
||||
{ icao: airport.icao },
|
||||
@@ -54,8 +52,6 @@ export class AirportService {
|
||||
|
||||
return exists;
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
async deleteAirport(icao: string): Promise<void> {
|
||||
|
||||
Reference in new issue
封鎖使用者