mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-10 20:52:42 +01:00
🐛 revert file config overwrite
This commit is contained in:
parent
01fb2dbf4d
commit
e58e153c7c
@ -9,6 +9,7 @@ import {
|
|||||||
CreateDateColumn,
|
CreateDateColumn,
|
||||||
Entity,
|
Entity,
|
||||||
FindConditions,
|
FindConditions,
|
||||||
|
Index,
|
||||||
JoinColumn,
|
JoinColumn,
|
||||||
JoinTable,
|
JoinTable,
|
||||||
ManyToMany,
|
ManyToMany,
|
||||||
@ -45,9 +46,11 @@ export enum MessageType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Entity("messages")
|
@Entity("messages")
|
||||||
|
@Index(["channel_id", "id"], { unique: true })
|
||||||
export class Message extends BaseClass {
|
export class Message extends BaseClass {
|
||||||
@Column({ nullable: true })
|
@Column({ nullable: true })
|
||||||
@RelationId((message: Message) => message.channel)
|
@RelationId((message: Message) => message.channel)
|
||||||
|
@Index()
|
||||||
channel_id: string;
|
channel_id: string;
|
||||||
|
|
||||||
@JoinColumn({ name: "channel_id" })
|
@JoinColumn({ name: "channel_id" })
|
||||||
@ -68,10 +71,13 @@ export class Message extends BaseClass {
|
|||||||
|
|
||||||
@Column({ nullable: true })
|
@Column({ nullable: true })
|
||||||
@RelationId((message: Message) => message.author)
|
@RelationId((message: Message) => message.author)
|
||||||
|
@Index()
|
||||||
author_id: string;
|
author_id: string;
|
||||||
|
|
||||||
@JoinColumn({ name: "author_id", referencedColumnName: "id" })
|
@JoinColumn({ name: "author_id", referencedColumnName: "id" })
|
||||||
@ManyToOne(() => User)
|
@ManyToOne(() => User, {
|
||||||
|
onDelete: "CASCADE",
|
||||||
|
})
|
||||||
author?: User;
|
author?: User;
|
||||||
|
|
||||||
@Column({ nullable: true })
|
@Column({ nullable: true })
|
||||||
|
@ -4,7 +4,7 @@ import path from "path";
|
|||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
|
||||||
// TODO: yaml instead of json
|
// TODO: yaml instead of json
|
||||||
const overridePath = path.join(process.cwd(), "config.json");
|
// const overridePath = path.join(process.cwd(), "config.json");
|
||||||
|
|
||||||
var config: ConfigValue;
|
var config: ConfigValue;
|
||||||
var pairs: ConfigEntity[];
|
var pairs: ConfigEntity[];
|
||||||
@ -19,12 +19,12 @@ export const Config = {
|
|||||||
config = pairsToConfig(pairs);
|
config = pairsToConfig(pairs);
|
||||||
config = (config || {}).merge(DefaultConfigOptions);
|
config = (config || {}).merge(DefaultConfigOptions);
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
const overrideConfig = JSON.parse(fs.readFileSync(overridePath, { encoding: "utf8" }));
|
// const overrideConfig = JSON.parse(fs.readFileSync(overridePath, { encoding: "utf8" }));
|
||||||
config = overrideConfig.merge(config);
|
// config = overrideConfig.merge(config);
|
||||||
} catch (error) {
|
// } catch (error) {
|
||||||
fs.writeFileSync(overridePath, JSON.stringify(config, null, 4));
|
// fs.writeFileSync(overridePath, JSON.stringify(config, null, 4));
|
||||||
}
|
// }
|
||||||
|
|
||||||
return this.set(config);
|
return this.set(config);
|
||||||
},
|
},
|
||||||
@ -51,7 +51,7 @@ function applyConfig(val: ConfigValue) {
|
|||||||
pair.value = obj;
|
pair.value = obj;
|
||||||
return pair.save();
|
return pair.save();
|
||||||
}
|
}
|
||||||
fs.writeFileSync(overridePath, JSON.stringify(val, null, 4));
|
// fs.writeFileSync(overridePath, JSON.stringify(val, null, 4));
|
||||||
|
|
||||||
return apply(val);
|
return apply(val);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user