-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Stefan Werfling
committed
Sep 15, 2023
1 parent
ece4b08
commit 47b4ca7
Showing
11 changed files
with
92 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 3 additions & 11 deletions
14
...rc/inc/Db/MariaDb/Entity/NginxUpstream.ts → ...rc/inc/Db/MariaDb/Entity/NginxUpstream.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import {DBService} from './DBService.js'; | ||
import {NginxUpstream} from './Entity/NginxUpstream.js'; | ||
import {DeleteResult} from 'typeorm'; | ||
|
||
/** | ||
* Nginx upstream service object. | ||
*/ | ||
export class NginxUpstreamService extends DBService<NginxUpstream> { | ||
|
||
/** | ||
* register name | ||
*/ | ||
public static REGISTER_NAME = 'nginx_upstream'; | ||
|
||
/** | ||
* Return an intance from nginx upstream service. | ||
* @returns {NginxUpstreamService} | ||
*/ | ||
public static getInstance(): NginxUpstreamService { | ||
return DBService.getSingleInstance( | ||
NginxUpstreamService, | ||
NginxUpstream, | ||
NginxUpstreamService.REGISTER_NAME | ||
); | ||
} | ||
|
||
/** | ||
* Find all Upstreams by stream id. | ||
* @param {number} streamId - ID of a stream. | ||
* @returns {NginxUpstream[]} | ||
*/ | ||
public async findAllStreams(streamId: number): Promise<NginxUpstream[]> { | ||
return this._repository.find({ | ||
where: { | ||
stream_id: streamId | ||
} | ||
}); | ||
} | ||
|
||
/** | ||
* Remove all Upstreams stream id. | ||
* @param {number} streamId - ID of a stream. | ||
*/ | ||
public async removeAllStreams(streamId: number): Promise<DeleteResult> { | ||
return this._repository.delete({ | ||
stream_id: streamId | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters