Browse Source

Force guide to be unique

ghorsington 5 years ago
parent
commit
958617aec2
2 changed files with 2 additions and 7 deletions
  1. 1 6
      bot/src/commands/rcg.ts
  2. 1 1
      db/src/entity/Guide.ts

+ 1 - 6
bot/src/commands/rcg.ts

@@ -1,6 +1,6 @@
 import request from "request-promise-native";
 import { Message } from "discord.js";
-import { Command, CommandSet, Action, ActionType } from "../model/command";
+import { Command, CommandSet } from "src/model/command";
 
 const rcgRe = /<input id="rcg_image".+value="([^"]+)".*\/>/i;
 
@@ -20,9 +20,4 @@ export class Rcg {
             files: [ regexResult[1].trim() ]
         });
     }
-
-    @Action(ActionType.DIRECT_MENTION)
-    async testEvent() {
-        console.log("asd");
-    }
 };

+ 1 - 1
db/src/entity/Guide.ts

@@ -32,7 +32,7 @@ export class GuideKeyword {
     @PrimaryGeneratedColumn()
     id: number;
 
-    @Column()
+    @Column({ unique: true })
     keyword: string;
 
     @ManyToMany(type => Guide, guide => guide.keywords)