Commit 6b649575 authored by Panagiotis Skarvelis's avatar Panagiotis Skarvelis
Browse files

allow custom path for auto protocol

parent 6882cc90
......@@ -3,5 +3,5 @@
* @param protocol_number
* @returns string
*/
declare const protocol: (protocol_string?: string) => Promise<string>;
declare const protocol: (protocol_string?: string, protocol_path?: string) => Promise<string>;
export default protocol;
......@@ -4,9 +4,9 @@ import sequence from './sequence';
* @param protocol_number
* @returns string
*/
const protocol = async (protocol_string = "") => {
const protocol = async (protocol_string = "", protocol_path = "/tmp") => {
const protocol_date = new Date().toISOString().split('T')[0];
const protocol_sequence = await sequence("/tmp/" + protocol_date + ".protocol.sequence"); //Protocol starts from 1 each day.
const protocol_sequence = await sequence(protocol_path + "/" + protocol_date + ".protocol.sequence"); //Protocol starts from 1 each day.
let pn = protocol_sequence + "/" + protocol_date;
if (protocol_string !== "")
pn = protocol_string;
......
......@@ -5,9 +5,9 @@ import sequence from './sequence';
* @param protocol_number
* @returns string
*/
const protocol = async (protocol_string:string="") =>{
const protocol = async (protocol_string:string="",protocol_path:string="/tmp") =>{
const protocol_date = new Date().toISOString().split('T')[0];
const protocol_sequence = await sequence("/tmp/"+protocol_date+".protocol.sequence");//Protocol starts from 1 each day.
const protocol_sequence = await sequence(protocol_path+"/"+protocol_date+".protocol.sequence");//Protocol starts from 1 each day.
let pn = protocol_sequence+"/"+protocol_date;
if (protocol_string!=="") pn = protocol_string;
return pn;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment