mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-30 15:17:43 -05:00
Rename badge script use id
This commit is contained in:
@@ -156,7 +156,7 @@ npm run add-badge -- sundae "4v4 Sundaes"
|
||||
### Rename display name of a badge
|
||||
|
||||
```bash
|
||||
npm run rename-badge -- sundae "New 4v4 Sundaes"
|
||||
npm run rename-badge -- 10 "New 4v4 Sundaes"
|
||||
```
|
||||
|
||||
### Convert many .png files to .avif
|
||||
|
||||
@@ -3,10 +3,10 @@ import "dotenv/config";
|
||||
import invariant from "tiny-invariant";
|
||||
import { sql } from "~/db/sql";
|
||||
|
||||
const code = process.argv[2]?.trim();
|
||||
const id = process.argv[2]?.trim();
|
||||
const newName = process.argv[3]?.trim();
|
||||
|
||||
invariant(code, "code of badge is required (argument 1)");
|
||||
invariant(id, "id of badge is required (argument 1)");
|
||||
invariant(newName, "display name of badge is required (argument 2)");
|
||||
invariant(
|
||||
newName !== newName.toLocaleLowerCase(),
|
||||
@@ -14,7 +14,7 @@ invariant(
|
||||
);
|
||||
|
||||
sql
|
||||
.prepare("update badge set displayName = @newName where code = @code")
|
||||
.run({ code, newName });
|
||||
.prepare("update badge set displayName = @newName where id = @id")
|
||||
.run({ id, newName });
|
||||
|
||||
console.log(`Added updated name. New name: ${newName}`);
|
||||
|
||||
Reference in New Issue
Block a user